Class RepositoryManagerImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.core.api.repository.RepositoryManagerImpl
-
- All Implemented Interfaces:
RepositoryManager
,Adaptable
,Component
,Extensible
,TimestampedService
public class RepositoryManagerImpl extends DefaultComponent implements RepositoryManager
High-level service to get to aRepository
and from there toCoreSession
objects.
-
-
Field Summary
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description RepositoryManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRepository(Repository repository)
Registers a new repository.<T> T
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.Repository
getDefaultRepository()
Gets the default repository.String
getDefaultRepositoryName()
Gets the name of the default repository.Collection<Repository>
getRepositories()
Gets all registered repositories.Repository
getRepository(String name)
Gets a repository by its name.List<String>
getRepositoryNames()
Gets the names of registered repositories.void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
removeRepository(String name)
Removes a registered repository.void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Method Detail
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
addRepository
public void addRepository(Repository repository)
Description copied from interface:RepositoryManager
Registers a new repository.- Specified by:
addRepository
in interfaceRepositoryManager
- Parameters:
repository
- the repository to register
-
removeRepository
public void removeRepository(String name)
Description copied from interface:RepositoryManager
Removes a registered repository.Do nothing if the repository is not registered.
- Specified by:
removeRepository
in interfaceRepositoryManager
- Parameters:
name
- the repository name to unregister
-
getRepositories
public Collection<Repository> getRepositories()
Description copied from interface:RepositoryManager
Gets all registered repositories.- Specified by:
getRepositories
in interfaceRepositoryManager
- Returns:
- a read-only collection of repositories or an empty one if no repositories was defined
-
getRepositoryNames
public List<String> getRepositoryNames()
Description copied from interface:RepositoryManager
Gets the names of registered repositories.- Specified by:
getRepositoryNames
in interfaceRepositoryManager
- Returns:
- a list of repository names
-
getRepository
public Repository getRepository(String name)
Description copied from interface:RepositoryManager
Gets a repository by its name.- Specified by:
getRepository
in interfaceRepositoryManager
- Parameters:
name
- the repository name- Returns:
- the repository or null if not found
-
getDefaultRepository
public Repository getDefaultRepository()
Description copied from interface:RepositoryManager
Gets the default repository.If there is not a default repository returns the first registered. repository
This is a convenient method to get the repository for application having a single repository.
- Specified by:
getDefaultRepository
in interfaceRepositoryManager
- Returns:
- the default repository
-
getDefaultRepositoryName
public String getDefaultRepositoryName()
Description copied from interface:RepositoryManager
Gets the name of the default repository.If there is not a default repository, returns the name of the first registered repository.
- Specified by:
getDefaultRepositoryName
in interfaceRepositoryManager
- Returns:
- the default repository name
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:Adaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.- Specified by:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classDefaultComponent
- Parameters:
adapter
- the adapter class to look up- Returns:
- a object castable to the given class, or
null
if this object does not have an adapter for the given class
-
-