Package sonia.scm.repository.api
Class RepositoryService
java.lang.Object
sonia.scm.repository.api.RepositoryService
- All Implemented Interfaces:
Closeable
,AutoCloseable
From the
Note: Not every
Warning: You should always close the connection to the repository after work is finished. For closing the connection to the repository use the
RepositoryService
it is possible to access all commands for
a single Repository
. The RepositoryService
is only access
able from the RepositoryServiceFactory
.Note: Not every
RepositoryService
supports every command. If
the command is not supported the method will trow a
CommandNotSupportedException
. It is possible to check if the command
is supported by the RepositoryService
with the
isSupported(Command)
method.Warning: You should always close the connection to the repository after work is finished. For closing the connection to the repository use the
close()
method.- Since:
- 1.17
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the connection to the repository and releases all locks and resources.Creates aBlameCommandBuilder
.Creates aBranchCommandBuilder
.Creates aBranchDetailsCommandBuilder
.Creates aBranchesCommandBuilder
.Creates aBrowseCommandBuilder
.Creates aBundleCommandBuilder
.Creates aCatCommandBuilder
.Creates aChangesetsCommandBuilder
.Creates aDiffCommandBuilder
.Creates aDiffResultCommandBuilder
.Creates aFullHealthCheckCommandBuilder
.Creates aIncomingCommandBuilder
.Creates aFileLockCommandBuilder
.Creates aLogCommandBuilder
.Creates aLookupCommandBuilder
.Creates aMergeCommandBuilder
.Creates aMirrorCommandBuilder
.Creates aModificationsCommandBuilder
.Creates aModifyCommandBuilder
.Creates anOutgoingCommandBuilder
.<T extends ScmProtocol>
TgetProtocol
(Class<T> clazz) Creates aPullCommandBuilder
.Creates aPushCommandBuilder
.Creates aRevertCommandBuilder
.The tag command allows the management of repository tags.The tags command list all repository tag.Creates anUnbundleCommandBuilder
.boolean
isSupported
(Command command) Returns true if the command is supported by the repository service.boolean
isSupported
(Feature feature) Returns true if the feature is supported by the repository service.
-
Method Details
-
close
public void close()Closes the connection to the repository and releases all locks and resources. This method should be called in a finally block; e.g.:RepositoryService service = null; try { service = factory.create("repositoryId"); // do something with the service } finally { if ( service != null ){ service.close(); } }
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
isSupported
Returns true if the command is supported by the repository service.- Parameters:
command
- command- Returns:
- true if the command is supported
-
isSupported
Returns true if the feature is supported by the repository service.- Parameters:
feature
- feature- Returns:
- true if the feature is supported
- Since:
- 1.25
-
getBlameCommand
Creates aBlameCommandBuilder
. It can take the respective parameters and be executed to show changeset information by line for a given file.- Returns:
- instance of
BlameCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBranchCommand
Creates aBranchCommandBuilder
. It can take the respective parameters and be executed to create new branches, if supported by the particular SCM system.- Returns:
- instance of
BranchCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBranchDetailsCommand
Creates aBranchDetailsCommandBuilder
. It can take the respective parameters and be executed to get details for a branch.- Returns:
- instance of
BranchDetailsCommand
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.28.0
-
getBranchesCommand
Creates aBranchesCommandBuilder
. It can take the respective parameters and be executed to list all repository branches.- Returns:
- instance of
BranchesCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBrowseCommand
Creates aBrowseCommandBuilder
. It can take the respective parameters and be executed to browse for content within a repository.- Returns:
- instance of
BrowseCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBundleCommand
Creates aBundleCommandBuilder
. It can take the respective parameters and be executed to create an archive from the repository.- Returns:
- instance of
BundleCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.43
-
getCatCommand
Creates aCatCommandBuilder
. It can take the respective parameters and be executed to show the content of a given file.- Returns:
- instance of
CatCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getChangesetsCommand
Creates aChangesetsCommandBuilder
. It can take the respective parameters and be executed to retrieve a set of at least one changeset.- Returns:
- Instance of
ChangesetsCommandBuilder
. - Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of theRepositoryServiceProvider
.
-
getDiffCommand
Creates aDiffCommandBuilder
. It can take the respective parameters and be executed to show differences between revisions for a specified file or the entire revision.- Returns:
- instance of
DiffCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getDiffResultCommand
Creates aDiffResultCommandBuilder
. It can take the respective parameters and be executed to show differences between revisions for a specified file or the entire revision.- Returns:
- instance of
DiffResultCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getFullCheckCommand
Creates aFullHealthCheckCommandBuilder
. It can take the respective parameters and be executed to inspect a repository profoundly. This might take a while in contrast to the lighter checks executed at startup.- Returns:
- instance of
FullHealthCheckCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.17.0
-
getLockCommand
Creates aFileLockCommandBuilder
. It can take the respective parameters and be executed to lock and unlock files.- Returns:
- instance of
FileLockCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.26.0
-
getIncomingCommand
Creates aIncomingCommandBuilder
. It can take the respective parameters and be executed to show newChangeset
s found in a different repository location.- Returns:
- instance of
IncomingCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getLogCommand
Creates aLogCommandBuilder
. It can take the respective parameters and be executed to show revision history of entire repository or files.- Returns:
- instance of
LogCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getLookupCommand
Creates aLookupCommandBuilder
. It can take the respective parameters and be executed to conduct a lookup which returns additional information for the repository.- Returns:
- instance of
LookupCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.10.0
-
getMergeCommand
Creates aMergeCommandBuilder
. It can take the respective parameters and be executed to conduct a merge of two branches.- Returns:
- instance of
MergeCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.0.0
-
getMirrorCommand
Creates aMirrorCommandBuilder
. It can take the respective parameters and be executed to create a 'mirror' of an existing repository (specified by a URL) by copying all data to the repository of this service. Therefore, this repository has to be empty (otherwise the behaviour is not specified).- Returns:
- instance of
MirrorCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.19.0
-
getModificationsCommand
Creates aModificationsCommandBuilder
. It can take the respective parameters and be executed to show file modifications in a revision.- Returns:
- instance of
ModificationsCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getModifyCommand
Creates aModifyCommandBuilder
. It can take the respective parameters and be executed to makes changes to the files within a changeset.- Returns:
- instance of
ModifyCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.0.0
- See Also:
-
getOutgoingCommand
Creates anOutgoingCommandBuilder
. It can take the respective parameters and be executed to showChangeset
s not found in a remote repository.- Returns:
- instance of
OutgoingCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getPullCommand
Creates aPullCommandBuilder
. It can take the respective parameters and be executed to pull changes from another repository.- Returns:
- instance of
PullCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getPushCommand
Creates aPushCommandBuilder
. It can take the respective parameters and be executed to push changes to another repository.- Returns:
- instance of
PushCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getRevertCommand
Creates aRevertCommandBuilder
. It can take the respective parameters and be executed to apply a revert of a chosen changeset onto the given repository/branch combination.- Returns:
- Instance of
RevertCommandBuilder
. - Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of theRepositoryServiceProvider
.- Since:
- 3.8
- See Also:
-
getTagsCommand
The tags command list all repository tag.- Returns:
- instance of
TagsCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getTagCommand
The tag command allows the management of repository tags.- Returns:
- instance of
TagCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getUnbundleCommand
Creates anUnbundleCommandBuilder
. It can take the respective parameters and be executed to restore a repository from the given bundle.- Returns:
- instance of
UnbundleCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.43
-
getSupportedProtocols
-
getProtocol
-