org.tmatesoft.svn.core.wc.admin

Class SVNAdminClient

public class SVNAdminClient extends SVNBasicClient

The SVNAdminClient class provides methods that brings repository-side functionality and repository synchronizing features.

Repository administrative methods are analogues of the corresponding commands of the native Subversion 'svnadmin' utility, while repository synchronizing methods are the ones for the 'svnsync' utility.

Here's a list of the SVNAdminClient's methods matched against corresponing commands of the Subversion svnsync and svnadmin command-line utilities:

SVNKit Subversion
doInitialize()'svnsync initialize'
doSynchronize()'svnsync synchronize'
doCopyRevisionProperties()'svnsync copy-revprops'
doDump()'svnadmin dump'
doListTransactions()'svnadmin lstxns'
doLoad()'svnadmin load'
doRemoveTransactions()'svnadmin rmtxns'
doVerify()'svnadmin verify'

Since: 1.1.0

Version: 1.1.1

Author: TMate Software Ltd.

Constructor Summary
SVNAdminClient(ISVNAuthenticationManager authManager, ISVNOptions options)
Creates a new admin client.
SVNAdminClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
Creates a new admin client.
Method Summary
voiddoCompleteSynchronize(SVNURL fromURL, SVNURL toURL)
Completely synchronizes two repositories.
voiddoCopyRevisionProperties(SVNURL toURL, long revision)
Copies revision properties from the source repository that the destination one is synchronized with to the given revision of the destination repository itself.
SVNURLdoCreateRepository(File path, String uuid, boolean enableRevisionProperties, boolean force)
Creates an FSFS-type repository.
SVNURLdoCreateRepository(File path, String uuid, boolean enableRevisionProperties, boolean force, boolean pre14Compatible)
Creates an FSFS-type repository.
voiddoDump(File repositoryRoot, OutputStream dumpStream, SVNRevision startRevision, SVNRevision endRevision, boolean isIncremental, boolean useDeltas)
Dumps contents of the repository to the provided output stream in a 'dumpfile' portable format.
voiddoInitialize(SVNURL fromURL, SVNURL toURL)
Initializes synchronization between source and target repositories.
voiddoListLocks(File repositoryRoot)
voiddoListTransactions(File repositoryRoot)
Lists all uncommitted transactions.
voiddoLoad(File repositoryRoot, InputStream dumpStream)
Reads the provided dump stream committing new revisions to a repository.
voiddoLoad(File repositoryRoot, InputStream dumpStream, boolean usePreCommitHook, boolean usePostCommitHook, SVNUUIDAction uuidAction, String parentDir)
Reads the provided dump stream committing new revisions to a repository.
voiddoRemoveLocks(File repositoryRoot, String[] paths)
voiddoRemoveTransactions(File repositoryRoot, String[] transactions)
Removes the specified outstanding transactions from a repository.
voiddoSynchronize(SVNURL toURL)
Synchronizes the repository at the given url.
voiddoVerify(File repositoryRoot)
Verifies the data stored in the repository.
voiddoVerify(File repositoryRoot, SVNRevision startRevision, SVNRevision endRevision)
voidsetEventHandler(ISVNEventHandler handler)
Sets an event handler for this object. ISVNAdminEventHandler should be provided to SVNAdminClent via this method also.
voidsetReplayHandler(ISVNLogEntryHandler handler)
Sets a replication handler that will receive a log entry object per each replayed revision.

Constructor Detail

SVNAdminClient

public SVNAdminClient(ISVNAuthenticationManager authManager, ISVNOptions options)
Creates a new admin client.

Parameters: authManager an auth manager options an options driver

SVNAdminClient

public SVNAdminClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
Creates a new admin client.

Parameters: repositoryPool a repository pool options an options driver

Method Detail

doCompleteSynchronize

public void doCompleteSynchronize(SVNURL fromURL, SVNURL toURL)
Completely synchronizes two repositories.

This method initializes the destination repository and then copies all revision changes (including revision properties) from the given source repository to the destination one. First it tries to use synchronization features similar to the native Subversion 'svnsync' capabilities. But if a server does not support replay functionality, SVNKit uses its own repository replication feature (see SVNRepositoryReplicator})

Parameters: fromURL a url of a repository to copy from toURL a destination repository url

Throws: SVNException

Since: 1.1

doCopyRevisionProperties

public void doCopyRevisionProperties(SVNURL toURL, long revision)
Copies revision properties from the source repository that the destination one is synchronized with to the given revision of the destination repository itself.

This method is equivalent to the command 'copy-revprops' of the native Subversion svnsync utility. Note that the destination repository given as toURL must be synchronized with a source repository. Please, see SVNAdminClient} how to initialize such a synchronization.

Parameters: toURL a url to the destination repository which must be synchronized with another repository revision a particular revision of the source repository to copy revision properties from

Throws: SVNException

Since: 1.1, new in Subversion 1.4

doCreateRepository

public SVNURL doCreateRepository(File path, String uuid, boolean enableRevisionProperties, boolean force)
Creates an FSFS-type repository. This implementation uses SVNRepositoryFactory}.

If uuid is null a new uuid will be generated, otherwise the specified will be used.

If enableRevisionProperties is true, an empty pre-revprop-change hook will be placed into the repository /hooks subdir. This enables changes to revision properties of the newly created repository.

If force is true and path already exists, deletes that path and creates a repository in its place.

Parameters: path a repository root dir path uuid a repository uuid enableRevisionProperties enables/disables changes to revision properties force forces operation to run

Returns: a local URL (file:///) of a newly created repository

Throws: SVNException

Since: 1.1.0

See Also: SVNAdminClient

doCreateRepository

public SVNURL doCreateRepository(File path, String uuid, boolean enableRevisionProperties, boolean force, boolean pre14Compatible)
Creates an FSFS-type repository. This implementation uses SVNRepositoryFactory}.

If uuid is null a new uuid will be generated, otherwise the specified will be used.

If enableRevisionProperties is true, an empty pre-revprop-change hook will be placed into the repository /hooks subdir. This enables changes to revision properties of the newly created repository.

If force is true and path already exists, deletes that path and creates a repository in its place.

Set pre14Compatible to true if you want a new repository to be compatible with pre-1.4 servers.

Parameters: path a repository root dir path uuid a repository uuid enableRevisionProperties enables/disables changes to revision properties force forces operation to run pre14Compatible true to create a repository with pre-1.4 format

Returns: a local URL (file:///) of a newly created repository

Throws: SVNException

Since: 1.1.1

doDump

public void doDump(File repositoryRoot, OutputStream dumpStream, SVNRevision startRevision, SVNRevision endRevision, boolean isIncremental, boolean useDeltas)
Dumps contents of the repository to the provided output stream in a 'dumpfile' portable format.

On each revision dumped this method fires an SVNAdminEvent with action set to REVISION_DUMPED to the registered ISVNAdminEventHandler (if any). To register your ISVNAdminEventHandler pass it to setEventHandler. For this operation the following information can be retrieved out of SVNAdminEvent:

Parameters: repositoryRoot a repository root directory path dumpStream an output stream to write dumped contents to startRevision the first revision to start dumping from endRevision the last revision to end dumping at isIncremental if true then the first revision dumped will be a diff against the previous revision; otherwise the first revision is a fulltext. useDeltas if true deltas will be written instead of fulltexts

Throws: SVNException

Since: 1.1.1

doInitialize

public void doInitialize(SVNURL fromURL, SVNURL toURL)
Initializes synchronization between source and target repositories.

This method is equivalent to the command 'initialize' ('init') of the native Subversion svnsync utility. Initialization places information of a source repository to a destination one (setting special revision properties in revision 0) as well as copies all revision props from revision 0 of the source repository to revision 0 of the destination one.

Parameters: fromURL a source repository url toURL a destination repository url

Throws: SVNException

Since: 1.1, new in Subversion 1.4

doListLocks

public void doListLocks(File repositoryRoot)

doListTransactions

public void doListTransactions(File repositoryRoot)
Lists all uncommitted transactions. On each uncommetted transaction found this method fires an SVNAdminEvent with action set to TRANSACTION_LISTED to the registered ISVNAdminEventHandler (if any). To register your ISVNAdminEventHandler pass it to setEventHandler. For this operation the following information can be retrieved out of SVNAdminEvent:

Parameters: repositoryRoot a repository root directory path

Throws: SVNException

Since: 1.1.1

doLoad

public void doLoad(File repositoryRoot, InputStream dumpStream)
Reads the provided dump stream committing new revisions to a repository.

On each revision loaded this method fires an SVNAdminEvent with action set to REVISION_LOADED to the registered ISVNAdminEventHandler (if any). To register your ISVNAdminEventHandler pass it to setEventHandler. For this operation the following information can be retrieved out of SVNAdminEvent:

A call to this method is equivalent to doLoad(repositoryRoot, dumpStream, false, false, SVNUUIDAction.DEFAULT, null).

Parameters: repositoryRoot the root directory path of the repository where new revisions will be committed dumpStream stream with dumped contents of a repository

Throws: SVNException

Since: 1.1.1

See Also: SVNAdminClient

doLoad

public void doLoad(File repositoryRoot, InputStream dumpStream, boolean usePreCommitHook, boolean usePostCommitHook, SVNUUIDAction uuidAction, String parentDir)
Reads the provided dump stream committing new revisions to a repository.

On each revision loaded this method fires an SVNAdminEvent with action set to REVISION_LOADED to the registered ISVNAdminEventHandler (if any). To register your ISVNAdminEventHandler pass it to setEventHandler. For this operation the following information can be retrieved out of SVNAdminEvent:

Parameters: repositoryRoot the root directory path of the repository where new revisions will be committed dumpStream stream with dumped contents of a repository usePreCommitHook if true then calls a pre-commit hook before committing usePostCommitHook if true then calls a post-commit hook after committing uuidAction one of the three possible ways to treat uuids parentDir if not null then loads at this directory in the repository

Throws: SVNException

Since: 1.1.1

doRemoveLocks

public void doRemoveLocks(File repositoryRoot, String[] paths)

doRemoveTransactions

public void doRemoveTransactions(File repositoryRoot, String[] transactions)
Removes the specified outstanding transactions from a repository. On each transaction removed this method fires an SVNAdminEvent with action set to TRANSACTION_REMOVED to the registered ISVNAdminEventHandler (if any). To register your ISVNAdminEventHandler pass it to setEventHandler. For this operation the following information can be retrieved out of SVNAdminEvent:

Parameters: repositoryRoot a repository root directory path transactions an array with transaction names

Throws: SVNException

Since: 1.1.1

doSynchronize

public void doSynchronize(SVNURL toURL)
Synchronizes the repository at the given url.

Synchronization means copying revision changes and revision properties from the source repository (that the destination one is synchronized with) to the destination one starting at the last merged revision. This method is equivalent to the command 'synchronize' ('sync') of the native Subversion svnsync utility.

Parameters: toURL a destination repository url

Throws: SVNException

Since: 1.1, new in Subversion 1.4

doVerify

public void doVerify(File repositoryRoot)
Verifies the data stored in the repository. This method uses the dump implementation (non incremental, beginning with revision 0, ending at the latest one) passing a dummy output stream to it. This allows to check the integrity of the repository data.

Parameters: repositoryRoot a repository root directory path

Throws: SVNException verification failed - a repository may be corrupted

Since: 1.1.1

doVerify

public void doVerify(File repositoryRoot, SVNRevision startRevision, SVNRevision endRevision)

setEventHandler

public void setEventHandler(ISVNEventHandler handler)
Sets an event handler for this object. ISVNAdminEventHandler should be provided to SVNAdminClent via this method also.

Parameters: handler an event handler

setReplayHandler

public void setReplayHandler(ISVNLogEntryHandler handler)
Sets a replication handler that will receive a log entry object per each replayed revision.

Log entries dispatched to the handler may not contain changed paths and committed log message until this features are implemented in future releases.

Parameters: handler a replay handler

Copyright © 2004-2007 TMate Software Ltd. All Rights Reserved.