java 企业级项目中应用Subversion的配置与理
--JavaSVN + Subversion跟踪数据变化历史
译者:陈海青(http://www.chq.name)
实例学习
现在让我们来确定一下要解决的问题和解决方案,并使用实例来说明如何使用Subversion 和JavaSVN。我们使用JavaSVN将一个简单的领域对象存储到Subversion 中,检索以前的版本,并显示两个版本的差异。
public class LoanData extends BaseTrackingObject {
PRivate String loanId;
private double loanAmount;
private float loanRate;
private int loanTerm;
......
......
}
public void initRepository() {
//initialize the system to work over http
DAVRepositoryFactory.setup();
............
//point to the root folder of repository
SVNURL svnUrl = SVNURL.parseURIEncoded
("http://localhost/repos/");
//initialize the SVNRepository
theRepository = SVNRepositoryFactory.
create(svnUrl);
//Creates the Auth manager with our user
//and passWord credentials
ISVNAuthenticationManager authManager =
new BasicAuthenticationManager
(name, password);
//provides the credentials to the
//SVNRepository
theManager.setAuthenticationManager
(authManager);
........
}
新闻热点
疑难解答