Package sonia.scm.repository
Interface RepositoryManager
- All Superinterfaces:
AutoCloseable
,Closeable
,HandlerBase<Repository>
,Initable
,LastModifiedAware
,Manager<Repository>
,TypeManager<Repository,
RepositoryHandler>
- All Known Implementing Classes:
AbstractRepositoryManager
,RepositoryManagerDecorator
The central class for managing
Repository
objects.
This class is a singleton and is available via injection.-
Method Summary
Modifier and TypeMethodDescriptionvoid
archive
(Repository repository) Archives the given repository.default Repository
create
(Repository repository, Consumer<Repository> afterCreation) Creates a new repository and afterwards executes the logic from the afterCreation.void
fireHookEvent
(RepositoryHookEvent event) FireRepositoryHookEvent
to the event bus.get
(NamespaceAndName namespaceAndName) Returns aRepository
by its namespace and name or null if theRepository
could not be found.Returns all namespaces.Returns all configured repository types.getHandler
(String type) Returns aRepositoryHandler
by the given type (hg, git, svn ...).void
importRepository
(Repository repository) Imports an existingRepository
.rename
(Repository repository, String newNameSpace, String newName) void
unarchive
(Repository repository) Un-archives the given repository.Methods inherited from interface sonia.scm.HandlerBase
create, delete, modify
Methods inherited from interface sonia.scm.LastModifiedAware
getLastModified
Methods inherited from interface sonia.scm.Manager
get, getAll, getAll, getAll, getAll, getAll, getPage, refresh
Methods inherited from interface sonia.scm.TypeManager
getTypes
-
Method Details
-
fireHookEvent
FireRepositoryHookEvent
to the event bus.- Parameters:
event
- hook event- Since:
- 2.0.0
-
importRepository
Imports an existingRepository
. Note: This method should only be called from aRepositoryHandler
.- Parameters:
repository
-Repository
to import- Throws:
IOException
-
get
Returns aRepository
by its namespace and name or null if theRepository
could not be found.- Parameters:
namespaceAndName
- namespace and name of theRepository
- Returns:
Repository
by its namespace and name or null if theRepository
could not be found
-
getConfiguredTypes
Collection<RepositoryType> getConfiguredTypes()Returns all configured repository types. -
getHandler
Returns aRepositoryHandler
by the given type (hg, git, svn ...).- Specified by:
getHandler
in interfaceTypeManager<Repository,
RepositoryHandler> - Parameters:
type
- the type of theRepositoryHandler
- Returns:
RepositoryHandler
by the given type
-
rename
- Parameters:
repository
- the repositoryRepository
newNameSpace
- the new repository namespacenewName
- the new repository name- Returns:
Repository
the renamed repository
-
getAllNamespaces
Collection<String> getAllNamespaces()Returns all namespaces. -
create
Creates a new repository and afterwards executes the logic from the afterCreation.- Parameters:
repository
- the repository to createafterCreation
- consumer which is executed after the repository was created- Returns:
- created repository
- Since:
- 2.11.0
-
archive
Archives the given repository.- Since:
- 2.12.0
-
unarchive
Un-archives the given repository.- Since:
- 2.12.0
-