org.tmatesoft.svn.core.wc
Class SVNWCUtil

java.lang.Object
  extended by org.tmatesoft.svn.core.wc.SVNWCUtil

public class SVNWCUtil
extends java.lang.Object

The SVNWCUtil is a utility class providing some common methods used by Working Copy API classes for such purposes as creating default run-time configuration and authentication drivers and some others.

Since:
1.2
See Also:
ISVNOptions, Examples

Constructor Summary
SVNWCUtil()
           
 
Method Summary
static ISVNAuthenticationManager createDefaultAuthenticationManager()
          Creates a default authentication manager that uses the default SVN's servers configuration and authentication storage.
static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir)
          Creates a default authentication manager that uses the servers configuration and authentication storage located in the provided directory.
static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir, java.lang.String userName, java.lang.String password)
          Creates a default authentication manager that uses the provided configuration directory and user's credentials.
static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir, java.lang.String userName, java.lang.String password, boolean storeAuth)
          Creates a default authentication manager that uses the provided configuration directory and user's credentials.
static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir, java.lang.String userName, java.lang.String password, java.io.File privateKey, java.lang.String passphrase, boolean storeAuth)
          Creates a default authentication manager that uses the provided configuration directory and user's credentials.
static ISVNAuthenticationManager createDefaultAuthenticationManager(java.lang.String userName, java.lang.String password)
          Creates a default authentication manager that uses the default SVN's servers configuration and provided user's credentials.
static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultOptions(boolean readonly)
          Creates a default run-time configuration options driver that uses the default SVN's run-time configuration area.
static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultOptions(java.io.File dir, boolean readonly)
          Creates a default run-time configuration options driver that uses the provided configuration directory.
static java.io.File getDefaultConfigurationDirectory()
          Gets the location of the default SVN's run-time configuration area on the current machine.
static java.io.File getWorkingCopyRoot(java.io.File versionedDir, boolean stopOnExternals)
          Returns the Working Copy root directory given a versioned directory that belongs to the Working Copy.
static boolean isVersionedDirectory(java.io.File dir)
          Determines if a directory is under version control.
static boolean isWorkingCopyRoot(java.io.File versionedDir)
          Determines if a directory is the root of the Working Copy.
static boolean isWorkingCopyRoot(java.io.File versionedDir, boolean externalIsRoot)
          Deprecated. use isWorkingCopyRoot(File)} instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNWCUtil

public SVNWCUtil()
Method Detail

getDefaultConfigurationDirectory

public static java.io.File getDefaultConfigurationDirectory()
Gets the location of the default SVN's run-time configuration area on the current machine. The result path depends on the platform on which SVNKit is running:

Returns:
a File representation of the default SVN's run-time configuration area location

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager()
Creates a default authentication manager that uses the default SVN's servers configuration and authentication storage. Whether the default auth storage is used or not depends on the 'store-auth-creds' option that can be found in the SVN's config file under the [auth] section.

Returns:
a default implementation of the credentials and servers configuration driver interface
See Also:
getDefaultConfigurationDirectory()

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir)
Creates a default authentication manager that uses the servers configuration and authentication storage located in the provided directory. The authentication storage is enabled.

Parameters:
configDir - a new location of the run-time configuration area
Returns:
a default implementation of the credentials and servers configuration driver interface

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.lang.String userName,
                                                                           java.lang.String password)
Creates a default authentication manager that uses the default SVN's servers configuration and provided user's credentials. Whether the default auth storage is used or not depends on the 'store-auth-creds' option that can be found in the SVN's config file under the [auth] section.

Parameters:
userName - a user's name
password - a user's password
Returns:
a default implementation of the credentials and servers configuration driver interface

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir,
                                                                           java.lang.String userName,
                                                                           java.lang.String password)
Creates a default authentication manager that uses the provided configuration directory and user's credentials. Whether the default auth storage is used or not depends on the 'store-auth-creds' option that is looked up in the config file under the [auth] section. Files config and servers will be created (if they still don't exist) in the specified directory (they are the same as those ones you can find in the default SVN's run-time configuration area).

Parameters:
configDir - a new location of the run-time configuration area
userName - a user's name
password - a user's password
Returns:
a default implementation of the credentials and servers configuration driver interface

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir,
                                                                           java.lang.String userName,
                                                                           java.lang.String password,
                                                                           boolean storeAuth)
Creates a default authentication manager that uses the provided configuration directory and user's credentials. The storeAuth parameter affects on using the auth storage.

Parameters:
configDir - a new location of the run-time configuration area
userName - a user's name
password - a user's password
storeAuth - if true then the auth storage is enabled, otherwise disabled
Returns:
a default implementation of the credentials and servers configuration driver interface

createDefaultAuthenticationManager

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir,
                                                                           java.lang.String userName,
                                                                           java.lang.String password,
                                                                           java.io.File privateKey,
                                                                           java.lang.String passphrase,
                                                                           boolean storeAuth)
Creates a default authentication manager that uses the provided configuration directory and user's credentials. The storeAuth parameter affects on using the auth storage.

Parameters:
configDir - a new location of the run-time configuration area
userName - a user's name
password - a user's password
privateKey - a private key file for SSH session
passphrase - a passphrase that goes with the key file
storeAuth - if true then the auth storage is enabled, otherwise disabled
Returns:
a default implementation of the credentials and servers configuration driver interface

createDefaultOptions

public static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultOptions(java.io.File dir,
                                                                                        boolean readonly)
Creates a default run-time configuration options driver that uses the provided configuration directory.

If dir is not null then all necessary config files (in particular config and servers) will be created in this directory if they still don't exist. Those files are the same as those ones you can find in the default SVN's run-time configuration area.

Parameters:
dir - a new location of the run-time configuration area
readonly - if true then run-time configuration options are available only for reading, if false then those options are available for both reading and writing
Returns:
a default implementation of the run-time configuration options driver interface

createDefaultOptions

public static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultOptions(boolean readonly)
Creates a default run-time configuration options driver that uses the default SVN's run-time configuration area.

Parameters:
readonly - if true then run-time configuration options are available only for reading, if false then those options are available for both reading and writing
Returns:
a default implementation of the run-time configuration options driver interface
See Also:
getDefaultConfigurationDirectory()

isVersionedDirectory

public static boolean isVersionedDirectory(java.io.File dir)
Determines if a directory is under version control.

Parameters:
dir - a directory to check
Returns:
true if versioned, otherwise false

isWorkingCopyRoot

public static boolean isWorkingCopyRoot(java.io.File versionedDir)
                                 throws SVNException
Determines if a directory is the root of the Working Copy.

Parameters:
versionedDir - a versioned directory to check
Returns:
true if versionedDir is versioned and the WC root (or the root of externals if considerExternalAsRoot is true), otherwise false
Throws:
SVNException
Since:
1.1

isWorkingCopyRoot

public static boolean isWorkingCopyRoot(java.io.File versionedDir,
                                        boolean externalIsRoot)
                                 throws SVNException
Deprecated. use isWorkingCopyRoot(File)} instead

Parameters:
versionedDir - a versioned directory to check
externalIsRoot -
Returns:
true if versionedDir is versioned and the WC root (or the root of externals if considerExternalAsRoot is true), otherwise false
Throws:
SVNException

getWorkingCopyRoot

public static java.io.File getWorkingCopyRoot(java.io.File versionedDir,
                                              boolean stopOnExternals)
                                       throws SVNException
Returns the Working Copy root directory given a versioned directory that belongs to the Working Copy.

If both versionedDir and its parent directory are not versioned this method returns null.

Parameters:
versionedDir - a directory belonging to the WC which root is to be searched for
stopOnExtenrals - if true then this method will stop at the directory on which any externals definitions are set
Returns:
the WC root directory (if it is found) or null.
Throws:
SVNException