@Service(value="repositoryRegistry") public class ArchivaRepositoryRegistry extends Object implements ConfigurationListener, EventHandler<Event>, RepositoryRegistry
The modification methods addXX and removeXX persist the changes immediately to the configuration. If the configuration save fails the changes are rolled back.
TODO: Audit events
Constructor and Description |
---|
ArchivaRepositoryRegistry() |
Modifier and Type | Method and Description |
---|---|
ManagedRepository |
clone(ManagedRepository repo,
String newId)
Creates a new repository instance with the same settings as this one.
|
RemoteRepository |
clone(RemoteRepository repo,
String newId)
Creates a new repository instance with the same settings as this one.
|
<T extends Repository> |
clone(T repo,
String newId) |
void |
configurationEvent(ConfigurationEvent event)
Generic event point to notify components that something has happend in the configuration.
|
void |
destroy() |
ArchivaIndexManager |
getIndexManager(RepositoryType type) |
Collection<ManagedRepository> |
getManagedRepositories()
Returns only the managed repositories.
|
ManagedRepository |
getManagedRepository(String repoId)
Convenience method, that returns the managed repository with the given id.
|
Collection<RemoteRepository> |
getRemoteRepositories()
Returns only the remote repositories.
|
RemoteRepository |
getRemoteRepository(String repoId)
Convenience method, that returns the remote repository with the given id.
|
Collection<Repository> |
getRepositories()
Returns all repositories that are registered.
|
Repository |
getRepository(String repoId)
Returns the repository with the given id.
|
RepositoryGroup |
getRepositoryGroup(String groupId) |
Collection<RepositoryGroup> |
getRepositoryGroups() |
void |
handle(Event event) |
ManagedRepository |
putRepository(ManagedRepository managedRepository)
Adds a new repository to the current list, or replaces the repository definition with
the same id, if it exists already.
|
ManagedRepository |
putRepository(ManagedRepositoryConfiguration managedRepositoryConfiguration)
Adds a new repository or updates the repository with the same id, if it exists already.
|
ManagedRepository |
putRepository(ManagedRepositoryConfiguration managedRepositoryConfiguration,
Configuration configuration)
Adds a new repository or updates the repository with the same id.
|
RemoteRepository |
putRepository(RemoteRepository remoteRepository)
Adds a remote repository, or overwrites the repository definition with the same id, if it exists already.
|
RemoteRepository |
putRepository(RemoteRepositoryConfiguration remoteRepositoryConfiguration)
Adds a new repository or updates the repository with the same id, if it exists already.
|
RemoteRepository |
putRepository(RemoteRepository remoteRepository,
Configuration configuration) |
RemoteRepository |
putRepository(RemoteRepositoryConfiguration remoteRepositoryConfiguration,
Configuration configuration)
Adds a new repository or updates the repository with the same id.
|
RepositoryGroup |
putRepositoryGroup(RepositoryGroup repositoryGroup)
Adds a new repository group to the current list, or replaces the repository group definition with
the same id, if it exists already.
|
RepositoryGroup |
putRepositoryGroup(RepositoryGroupConfiguration repositoryGroupConfiguration)
Adds a new repository group or updates the repository with the same id, if it exists already.
|
RepositoryGroup |
putRepositoryGroup(RepositoryGroupConfiguration repositoryGroupConfiguration,
Configuration configuration)
Adds a new repository group or updates the repository group with the same id.
|
<T extends Event> |
registerEventHandler(EventType<T> type,
EventHandler<? super T> eventHandler) |
void |
reload()
Reloads the registry from the configuration.
|
void |
removeRepository(ManagedRepository managedRepository)
Removes a managed repository from the registry and configuration, if it exists.
|
void |
removeRepository(ManagedRepository managedRepository,
Configuration configuration) |
void |
removeRepository(RemoteRepository remoteRepository)
Removes the remote repository from the registry and configuration.
|
void |
removeRepository(RemoteRepository remoteRepository,
Configuration configuration) |
void |
removeRepository(Repository repo) |
void |
removeRepository(String repoId) |
void |
removeRepositoryGroup(RepositoryGroup repositoryGroup)
Removes a repository group from the registry and configuration, if it exists.
|
void |
removeRepositoryGroup(RepositoryGroup repositoryGroup,
Configuration configuration) |
void |
resetIndexingContext(Repository repository)
Resets the indexing context of a given repository.
|
void |
setArchivaConfiguration(ArchivaConfiguration archivaConfiguration) |
<T extends Event> |
unregisterEventHandler(EventType<T> type,
EventHandler<? super T> eventHandler) |
public ArchivaRepositoryRegistry()
public void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration)
setArchivaConfiguration
in interface RepositoryRegistry
@PreDestroy public void destroy()
public ArchivaIndexManager getIndexManager(RepositoryType type)
getIndexManager
in interface RepositoryRegistry
public Collection<Repository> getRepositories()
getRepositories
in interface RepositoryRegistry
public Collection<ManagedRepository> getManagedRepositories()
getManagedRepositories
in interface RepositoryRegistry
public Collection<RemoteRepository> getRemoteRepositories()
getRemoteRepositories
in interface RepositoryRegistry
public Collection<RepositoryGroup> getRepositoryGroups()
getRepositoryGroups
in interface RepositoryRegistry
public Repository getRepository(String repoId)
getRepository
in interface RepositoryRegistry
repoId
- the repository idpublic ManagedRepository getManagedRepository(String repoId)
getManagedRepository
in interface RepositoryRegistry
repoId
- the repository idpublic RemoteRepository getRemoteRepository(String repoId)
getRemoteRepository
in interface RepositoryRegistry
repoId
- the repository idpublic RepositoryGroup getRepositoryGroup(String groupId)
getRepositoryGroup
in interface RepositoryRegistry
public ManagedRepository putRepository(ManagedRepository managedRepository) throws RepositoryException
putRepository
in interface RepositoryRegistry
managedRepository
- the new repository.RepositoryException
- if the new repository could not be saved to the configuration.public ManagedRepository putRepository(ManagedRepositoryConfiguration managedRepositoryConfiguration) throws RepositoryException
putRepository
in interface RepositoryRegistry
managedRepositoryConfiguration
- the repository configurationRepositoryException
- if an error occurs, or the configuration is not valid.public ManagedRepository putRepository(ManagedRepositoryConfiguration managedRepositoryConfiguration, Configuration configuration) throws RepositoryException
putRepository
in interface RepositoryRegistry
managedRepositoryConfiguration
- the new or changed managed repository configurationconfiguration
- the configuration object (may be null
)RepositoryException
- if the configuration cannot be saved or updatedpublic RepositoryGroup putRepositoryGroup(RepositoryGroup repositoryGroup) throws RepositoryException
putRepositoryGroup
in interface RepositoryRegistry
repositoryGroup
- the new repository group.RepositoryException
- if the new repository group could not be saved to the configuration.public RepositoryGroup putRepositoryGroup(RepositoryGroupConfiguration repositoryGroupConfiguration) throws RepositoryException
putRepositoryGroup
in interface RepositoryRegistry
repositoryGroupConfiguration
- the repository configurationRepositoryException
- if an error occurs, or the configuration is not valid.public RepositoryGroup putRepositoryGroup(RepositoryGroupConfiguration repositoryGroupConfiguration, Configuration configuration) throws RepositoryException
putRepositoryGroup
in interface RepositoryRegistry
repositoryGroupConfiguration
- The configuration of the new or changed repository group.configuration
- The configuration object. If it is null
, the configuration is not saved.RepositoryException
- if the configuration cannot be saved or updatedpublic RemoteRepository putRepository(RemoteRepository remoteRepository, Configuration configuration) throws RepositoryException
putRepository
in interface RepositoryRegistry
RepositoryException
public RemoteRepository putRepository(RemoteRepository remoteRepository) throws RepositoryException
putRepository
in interface RepositoryRegistry
remoteRepository
- the remote repository to addRepositoryException
- if an error occurs during configuration savepublic RemoteRepository putRepository(RemoteRepositoryConfiguration remoteRepositoryConfiguration) throws RepositoryException
putRepository
in interface RepositoryRegistry
remoteRepositoryConfiguration
- the repository configurationRepositoryException
- if an error occurs, or the configuration is not valid.public RemoteRepository putRepository(RemoteRepositoryConfiguration remoteRepositoryConfiguration, Configuration configuration) throws RepositoryException
putRepository
in interface RepositoryRegistry
remoteRepositoryConfiguration
- the new or changed repository configurationconfiguration
- the configuration objectRepositoryException
- if the configuration cannot be saved or updatedpublic void removeRepository(String repoId) throws RepositoryException
removeRepository
in interface RepositoryRegistry
RepositoryException
public void removeRepository(Repository repo) throws RepositoryException
removeRepository
in interface RepositoryRegistry
RepositoryException
public void removeRepository(ManagedRepository managedRepository) throws RepositoryException
removeRepository
in interface RepositoryRegistry
managedRepository
- the managed repository to removeRepositoryException
- if a error occurs during configuration savepublic void removeRepository(ManagedRepository managedRepository, Configuration configuration) throws RepositoryException
removeRepository
in interface RepositoryRegistry
RepositoryException
public void removeRepositoryGroup(RepositoryGroup repositoryGroup) throws RepositoryException
removeRepositoryGroup
in interface RepositoryRegistry
repositoryGroup
- the repository group to removeRepositoryException
- if a error occurs during configuration savepublic void removeRepositoryGroup(RepositoryGroup repositoryGroup, Configuration configuration) throws RepositoryException
removeRepositoryGroup
in interface RepositoryRegistry
RepositoryException
public void removeRepository(RemoteRepository remoteRepository) throws RepositoryException
removeRepository
in interface RepositoryRegistry
remoteRepository
- the remote repository to removeRepositoryException
- if a error occurs during configuration savepublic void removeRepository(RemoteRepository remoteRepository, Configuration configuration) throws RepositoryException
removeRepository
in interface RepositoryRegistry
RepositoryException
public void reload()
reload
in interface RepositoryRegistry
public void resetIndexingContext(Repository repository) throws IndexUpdateFailedException
resetIndexingContext
in interface RepositoryRegistry
repository
- The repositoryIndexUpdateFailedException
- If the index could not be resetted.public ManagedRepository clone(ManagedRepository repo, String newId) throws RepositoryException
clone
in interface RepositoryRegistry
repo
- The origin repositoryRepositoryException
public <T extends Repository> Repository clone(T repo, String newId) throws RepositoryException
clone
in interface RepositoryRegistry
RepositoryException
public RemoteRepository clone(RemoteRepository repo, String newId) throws RepositoryException
clone
in interface RepositoryRegistry
repo
- The origin repositoryRepositoryException
public void configurationEvent(ConfigurationEvent event)
ConfigurationListener
configurationEvent
in interface ConfigurationListener
public <T extends Event> void registerEventHandler(EventType<T> type, EventHandler<? super T> eventHandler)
registerEventHandler
in interface EventSource
public <T extends Event> void unregisterEventHandler(EventType<T> type, EventHandler<? super T> eventHandler)
unregisterEventHandler
in interface EventSource
public void handle(Event event)
handle
in interface EventHandler<Event>
Copyright © 2006–2019 The Apache Software Foundation. All rights reserved.