public class SVNClientManager extends java.lang.Object implements ISVNRepositoryPool
When you don't have special needs to create, keep and manage separate SVN*Client objects by yourself, you should use SVNClientManager that takes care of all that work for you. These are some of advantages of using SVNClientManager:
ISVNOptions
-
as well as an authentication and network layers driver -
ISVNAuthenticationManager
. When
using an SVNClientManager you have multiple choices to provide
and use those drivers:
//1.default options and authentication drivers to use SVNClientManager clientManager = SVNClientManager.newInstance(); ... //2.provided options and default authentication drivers to use ISVNOptions myOptions; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions); ... //3.provided options and authentication drivers to use ISVNOptions myOptions; ISVNAuthenticationManager myAuthManager; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, myAuthManager); ... //4.provided options driver and user's credentials to make //a default authentication driver use them ISVNOptions myOptions; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, "name", "passw");
get
method:
SVNClientManager clientManager; ... //an update client will be created only at that moment when you //first call this method for getting your update client, but if you //have already called it once before, then the method will return //that update client object instantiated in previous... so, it's //quite cheap, you see.. SVNUpdateClient updateClient = clientManager.getUpdateClient();
import org.tmatesoft.svn.core.wc.ISVNEventHandler; ... ISVNEventHandler commonEventHandler; SVNClientManager clientManager = SVNClientManager.newInstance(); ... //will be used by all SVN*Client objects //obtained from your client manager clientManager.setEventHandler(commonEventHandler);
ISVNEventHandler
,
ExamplesModifier and Type | Method and Description |
---|---|
SVNRepository |
createRepository(SVNURL url,
boolean mayReuse)
Creates a low-level SVN protocol driver to directly work with
a repository.
|
void |
dispose()
Disposes this client object.
|
SVNAdminClient |
getAdminClient()
Returns an instance of the
SVNAdminClient class. |
SVNChangelistClient |
getChangelistClient()
Returns an instance of the
SVNChangelistClient class. |
SVNCommitClient |
getCommitClient()
Returns an instance of the
SVNCommitClient class. |
SVNCopyClient |
getCopyClient()
Returns an instance of the
SVNCopyClient class. |
ISVNDebugLog |
getDebugLog()
Returns the debug logger currently in use.
|
SVNDiffClient |
getDiffClient()
Returns an instance of the
SVNDiffClient class. |
SVNLogClient |
getLogClient()
Returns an instance of the
SVNLogClient class. |
SVNLookClient |
getLookClient()
Returns an instance of the
SVNLookClient class. |
SVNMoveClient |
getMoveClient()
Returns an instance of the
SVNMoveClient class. |
SvnOperationFactory |
getOperationFactory() |
ISVNOptions |
getOptions()
Returns the run-time configuration options driver
which kept by this object.
|
ISVNRepositoryPool |
getRepositoryPool()
Returns the repository pool used by this client manager.
|
SVNStatusClient |
getStatusClient()
Returns an instance of the
SVNStatusClient class. |
SVNUpdateClient |
getUpdateClient()
Returns an instance of the
SVNUpdateClient class. |
SVNWCClient |
getWCClient()
Returns an instance of the
SVNWCClient class. |
protected void |
initClientDefaults(SVNAdminBasicClient client) |
protected void |
initClientDefaults(SVNBasicClient client) |
boolean |
isIgnoreExternals()
Tells wheter externals are ignored or not.
|
static SVNClientManager |
newInstance()
Creates a new instance of this class using default
ISVNOptions
and ISVNAuthenticationManager drivers. |
static SVNClientManager |
newInstance(DefaultSVNOptions options,
java.lang.String userName,
java.lang.String password)
Creates a new instance of this class using the provided
ISVNOptions
driver and user's credentials to make a default implementation of
ISVNAuthenticationManager use them. |
static SVNClientManager |
newInstance(ISVNOptions options)
Creates a new instance of this class using the provided
ISVNOptions
and default ISVNAuthenticationManager drivers. |
static SVNClientManager |
newInstance(ISVNOptions options,
ISVNAuthenticationManager authManager)
Creates a new instance of this class using the provided
ISVNOptions
and ISVNAuthenticationManager drivers. |
static SVNClientManager |
newInstance(ISVNOptions options,
ISVNRepositoryPool repositoryPool)
Creates a new instance of this class using the provided
config driver and creator of of SVNRepository objects.
|
static SVNClientManager |
newInstance(SvnOperationFactory operationFactory) |
void |
setAuthenticationManager(ISVNAuthenticationManager authManager)
Sets an authentication manager to this client manager.
|
void |
setCanceller(ISVNCanceller canceller)
Sets a canceller to this client manager.
|
void |
setDebugLog(ISVNDebugLog log)
Sets a logger to write debug log information to.
|
void |
setEventHandler(ISVNEventHandler handler)
Sets an event handler to all SVN*Client objects
created and kept by this SVNClientManager.
|
void |
setIgnoreExternals(boolean isIgnoreExternals)
Sets whether externals should be ignored or not by all of the SVN*Clinet objects which this client
manager will provide.
|
void |
setOptions(ISVNOptions options)
Sets global run-time configuration options to all of the SVN*Client objects provided by this
client manager.
|
void |
shutdownConnections(boolean shutdownAll)
Deprecated.
use
dispose() instead |
public static SVNClientManager newInstance()
ISVNOptions
and ISVNAuthenticationManager
drivers.
That means this SVNClientManager will use the SVN's default run-time
configuration area. Default options are obtained via a call to
SVNWCUtil.createDefaultOptions(boolean)
.public static SVNClientManager newInstance(ISVNOptions options)
ISVNOptions
and default ISVNAuthenticationManager
drivers.
That means this SVNClientManager will use the caller's configuration options
(which correspond to options found in the default SVN's config
file) and the default SVN's servers configuration and auth storage.
If options
is null, default options are
used which are obtained via a call to SVNWCUtil.createDefaultOptions(boolean)
.options
- a config driverpublic static SVNClientManager newInstance(ISVNOptions options, ISVNAuthenticationManager authManager)
ISVNOptions
and ISVNAuthenticationManager
drivers.
That means this SVNClientManager will use the caller's configuration options
(which correspond to options found in the default SVN's config
file) as well as authentication credentials and servers options (similar to
options found in the default SVN's servers).options
- a config driverauthManager
- an authentication driverpublic static SVNClientManager newInstance(SvnOperationFactory operationFactory)
public static SVNClientManager newInstance(ISVNOptions options, ISVNRepositoryPool repositoryPool)
options
- a config driverrepositoryPool
- a creator of SVNRepository objectspublic static SVNClientManager newInstance(DefaultSVNOptions options, java.lang.String userName, java.lang.String password)
ISVNOptions
driver and user's credentials to make a default implementation of
ISVNAuthenticationManager
use them.
That means this SVNClientManager will use the caller's configuration options
(which correspond to options found in the default SVN's config
file), the default SVN's servers configuration and the caller's
credentials.options
- a config driveruserName
- a user account namepassword
- a user passwordpublic SVNRepository createRepository(SVNURL url, boolean mayReuse) throws SVNException
The driver created will be set a default ISVNAuthenticationManager
manager.
Used by SVN*Client objects (managed by this SVNClientManager) to access a repository when needed.
createRepository
in interface ISVNRepositoryPool
url
- a repository location to establish a
connection with (will be the root directory
for the working session)mayReuse
- if true then tries
first tries to find a reusable driver or creates a new
reusable oneSVNException
DefaultSVNRepositoryPool.createRepository(SVNURL, boolean)
public void shutdownConnections(boolean shutdownAll)
dispose()
insteadISVNRepositoryPool
A default implementation DefaultSVNRepositoryPool is able to cache SVNRepository objects in a common pool shared between multiple threads. This method allows to close connections of all the cached objects.
shutdownConnections
in interface ISVNRepositoryPool
shutdownAll
- whether to shutdown connection
that are considered active at the momentDefaultSVNRepositoryPool
public void dispose()
dispose
in interface ISVNRepositoryPool
public ISVNOptions getOptions()
public void setEventHandler(ISVNEventHandler handler)
The provided event handler will be set only to only those objects
that have been already created (SVN*Client objects are
instantiated by an SVNClientManager at the moment of the
first call to a get*Client()
method). So, the handler
won't be set for those ones that have never been requested. However
as they are first requested (and thus created) the handler will be
set to them, too, since SVNClientManager is still keeping the handler.
handler
- an event handlerpublic void setIgnoreExternals(boolean isIgnoreExternals)
isIgnoreExternals
- whether externals should be ignored or notpublic boolean isIgnoreExternals()
public void setOptions(ISVNOptions options)
options
- run-time configuration optionspublic SVNCommitClient getCommitClient()
SVNCommitClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNAdminClient getAdminClient()
SVNAdminClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNLookClient getLookClient()
SVNLookClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNCopyClient getCopyClient()
SVNCopyClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNDiffClient getDiffClient()
SVNDiffClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNLogClient getLogClient()
SVNLogClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNMoveClient getMoveClient()
SVNMoveClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNStatusClient getStatusClient()
SVNStatusClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNUpdateClient getUpdateClient()
SVNUpdateClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNWCClient getWCClient()
SVNWCClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
public SVNChangelistClient getChangelistClient()
SVNChangelistClient
class.
If it's the first time this method is being called the object is created, initialized and then returned. Further calls to this method will get the same object instantiated at that moment of the first call. SVNClientManager does not reinstantiate its SVN*Client objects.
protected void initClientDefaults(SVNBasicClient client)
protected void initClientDefaults(SVNAdminBasicClient client)
public ISVNDebugLog getDebugLog()
If no debug logger has been specified by the time this call occurs,
a default one (returned by org.tmatesoft.svn.util.SVNDebugLog.getDefaultLog()
)
will be created and used.
public void setDebugLog(ISVNDebugLog log)
setDebugLog
in interface ISVNRepositoryPool
log
- a debug loggerpublic void setAuthenticationManager(ISVNAuthenticationManager authManager)
setAuthenticationManager
in interface ISVNRepositoryPool
authManager
- user's implementation of the authentication manager interfacepublic void setCanceller(ISVNCanceller canceller)
setCanceller
in interface ISVNRepositoryPool
canceller
- user's implementation of the canceller interfacepublic ISVNRepositoryPool getRepositoryPool()
SVNRepository
objects by all the SVN*Client
objects provided by this client manager.public SvnOperationFactory getOperationFactory()
Copyright © 2004-2012 TMate Software Ltd. All Rights Reserved.