https://
), or a custom svn one (svn://
or svn+ssh://
) or immediately on the local machine (file:///
) a user must initialize the library in a proper way: //import neccessary classes import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; import import org.tmatesoft.svn.core.wc.SVNWCUtil; import import org.tmatesoft.svn.core.SVNException; ... //Set up connection protocols support: //http:// and https:// DAVRepositoryFactory.setup(); //svn://, svn+xxx:// (svn+ssh:// in particular) SVNRepositoryFactoryImpl.setup(); //file:/// FSRepositoryFactory.setup();
svn+xxx://
can be any tunnel scheme for tunneled working with a repository. xxx
URL scheme is looked up in the section tunnels
of the standard Subversion config
file. So, only after these setup steps the client can create http | svn | file protocol implementations of the SVNRepository
abstract class to access the repository.
This is a general way how a user creates an SVNRepository driver object:
String url="http://svn.collab.net/svn/trunk"; String name="my name"; String password="my password"; repository = null; try { repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); repository.setAuthenticationManager(authManager); ... } catch (SVNException e){ e.printStackTrace(); System.exit(1); } //work with the repository ...
SVNRepository objects are not thread-safe, we're strongly recommend you not to use one SVNRepository object from within multiple threads.
Also methods of SVNRepository objects are not reenterable - that is, you can not call operation methods of an SVNRepository driver neither from within those handlers that are passed to some of the driver's methods, nor during committing with the help of a commit editor (until the editor's {@link ISVNEditor#closeEdit() closeEdit()} method is called).
To authenticate a user over network SVNRepository drivers use ISVNAuthenticationManager auth drivers. @version 1.3 @author TMate Software Ltd. @since 1.2 @see SVNRepositoryFactory @see org.tmatesoft.svn.core.auth.ISVNAuthenticationManager @see Examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|