⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startup.java

📁 java读取svn配置库.需要安装Subversion服务端
💻 JAVA
字号:
package svnexample;

import java.util.Calendar;
import java.util.Iterator;
import java.util.List;

import org.tmatesoft.svn.core.wc.SVNRevision;

/**
 * The class used to startup the sample application and invoke
 * relevant methods on the SVNManager.
 */
public class Startup {

	public static void main(String[] args) {
		LoanData theDomainObject = new LoanData();
		theDomainObject.setObjectId("LOAN_002");
		theDomainObject.setLoanAmount(500000);
		theDomainObject.setLoanRate(5.25f);
		theDomainObject.setLoanTerm(30);
		theDomainObject.setModificationReason("Created the object");
		theDomainObject.setModifiedDate(Calendar.getInstance().getTime());
		theDomainObject.setModifiedUser("Swami");
		System.out.println("--------------------------------------------------------");
		System.out.println("Starting the demo by creating the demo object LoanObject");
		System.out.println("The domain object looks like : " + 
				theDomainObject.getXmlRepresentation());
		System.out.println("--------------------------------------------------------");				
		SVNManager theManager = new SVNManager();
		System.out.println("Initialized the SVN Manager");
		SVNResult theResult = theManager.checkInObject(theDomainObject);
		System.out.println("Checked in the object into SVN with " +
			"a return flag of " + theResult.isSuccessful());
		System.out.println("The message obtained after checking in object is" +
			" " + theResult.getSvnMessage());
		System.out.println("--------------------------------------------------------");				
		theDomainObject.setLoanAmount(200000);
		theDomainObject.setModificationReason("Reduced loan amount due to surplus tax returns");
		System.out.println("Changed the loan amount and set the approriate reason for change");
		theResult = theManager.checkInObject(theDomainObject);
		System.out.println("Checked in the object into SVN with " +
			"a return flag of " + theResult.isSuccessful());
		System.out.println("The message obtained after checking in object is" +
			" " + theResult.getSvnMessage());
		System.out.println("--------------------------------------------------------");
		System.out.println("Showing the list of history for our loan object in the repository");
		displayRevisionInfo(theManager.getRevisionLog(theDomainObject,0,-1));
		System.out.println("--------------------------------------------------------");
		
		//Uncomment the following code to see the difference between two versions providing
		//the correct version numbers in the repository
		//System.out.println(theManager.showDifferences(theDomainObject, xx, xx));
	}
	
	public static void displayRevisionInfo(List revisions) {
		for(Iterator iter=revisions.iterator();iter.hasNext();) {
			SVNRevisionInfo revisionInfo = (SVNRevisionInfo) iter.next();
			System.out.println("Revision Number   : " + revisionInfo.getRevisionNumber());
			System.out.println("Revision Notes    : " + revisionInfo.getModificationReason());
			System.out.println("Revision User     : " + revisionInfo.getModifiedUser());
			System.out.println("Revision Date     : " + revisionInfo.getRevisionDate());
			System.out.println("Revision Contents : " + revisionInfo.getRevisionContents());
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -