Package sonia.scm.repository.api
Class RepositoryServiceFactory
java.lang.Object
sonia.scm.repository.api.RepositoryServiceFactory
The
RepositoryServiceFactory
is the entrypoint of the repository api.
You could create RepositoryService
from a Repository
and
with the RepositoryService
you could browse and control the entire
Repository
.
Simple usage example:
public class Sample {
private final RepositoryServiceFactory factory;
@Inject
public Sample(RepositoryServiceFactory factory){
this.factory = factory;
}
public Changeset getChangeset(String repositoryId, String commitId){
Changeset changeset = null;
RepositoryService service = null;
try {
service = factory.create(repositoryId);
changeset = service.getLogCommand().getChangeset(commitId);
} finally {
if ( service != null ){
service.close();
}
}
return changeset;
}
}
- Since:
- 1.17
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryServiceFactory
(CacheManager cacheManager, RepositoryManager repositoryManager, Set<RepositoryServiceResolver> resolvers, PreProcessorUtil preProcessorUtil, Set<ScmProtocolProvider> protocolProviders, WorkdirProvider workdirProvider, EMail eMail, RepositoryExportingCheck repositoryExportingCheck) Constructs a newRepositoryServiceFactory
.RepositoryServiceFactory
(ScmConfiguration configuration, CacheManager cacheManager, RepositoryManager repositoryManager, Set<RepositoryServiceResolver> resolvers, PreProcessorUtil preProcessorUtil, Set<ScmProtocolProvider> protocolProviders, WorkdirProvider workdirProvider) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new RepositoryService for the given repository.create
(NamespaceAndName namespaceAndName) Creates a new RepositoryService for the given repository.create
(Repository repository) Creates a new RepositoryService for the given repository.
-
Constructor Details
-
RepositoryServiceFactory
@Deprecated public RepositoryServiceFactory(ScmConfiguration configuration, CacheManager cacheManager, RepositoryManager repositoryManager, Set<RepositoryServiceResolver> resolvers, PreProcessorUtil preProcessorUtil, Set<ScmProtocolProvider> protocolProviders, WorkdirProvider workdirProvider) Deprecated.Constructs a newRepositoryServiceFactory
. This constructor should not be called manually, it should only be used by the injection container.- Parameters:
configuration
- configurationcacheManager
- cache managerrepositoryManager
- manager for repositoriesresolvers
- a set ofRepositoryServiceResolver
preProcessorUtil
- helper object for pre processor handlingprotocolProviders
- providers for repository protocolsworkdirProvider
- provider for working directories- Since:
- 1.21
-
RepositoryServiceFactory
@Inject public RepositoryServiceFactory(CacheManager cacheManager, RepositoryManager repositoryManager, Set<RepositoryServiceResolver> resolvers, PreProcessorUtil preProcessorUtil, Set<ScmProtocolProvider> protocolProviders, WorkdirProvider workdirProvider, EMail eMail, RepositoryExportingCheck repositoryExportingCheck) Constructs a newRepositoryServiceFactory
. This constructor should not be called manually, it should only be used by the injection container.- Parameters:
cacheManager
- cache managerrepositoryManager
- manager for repositoriesresolvers
- a set ofRepositoryServiceResolver
preProcessorUtil
- helper object for pre processor handlingprotocolProviders
- providers for repository protocolsworkdirProvider
- provider for working directorieseMail
- handling user emails- Since:
- 2.8.0
-
-
Method Details
-
create
Creates a new RepositoryService for the given repository.- Parameters:
repositoryId
- id of the repository- Returns:
- a implementation of RepositoryService for the given type of repository
- Throws:
NotFoundException
- if no repository with the given id is availableRepositoryServiceNotFoundException
- if no repository service implementation for this kind of repository is availableIllegalArgumentException
- if the repository id is null or emptyScmSecurityException
- if current user has not read permissions for that repository
-
create
Creates a new RepositoryService for the given repository.- Parameters:
namespaceAndName
- namespace and name of the repository- Returns:
- a implementation of RepositoryService for the given type of repository
- Throws:
NotFoundException
- if no repository with the given id is availableRepositoryServiceNotFoundException
- if no repository service implementation for this kind of repository is availableIllegalArgumentException
- if one of the parameters is null or emptyScmSecurityException
- if current user has not read permissions for that repository
-
create
Creates a new RepositoryService for the given repository.- Parameters:
repository
- the repository- Returns:
- a implementation of RepositoryService for the given type of repository
- Throws:
RepositoryServiceNotFoundException
- if no repository service implementation for this kind of repository is availableNullPointerException
- if the repository is nullScmSecurityException
- if current user has not read permissions for that repository
-
RepositoryServiceFactory(CacheManager, RepositoryManager, Set, PreProcessorUtil, Set, WorkdirProvider, EMail, RepositoryExportingCheck)
instead