Package org.nuxeo.ecm.core.repository
Class RepositoryService
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.repository.RepositoryService
- All Implemented Interfaces:
Adaptable,Component,Extensible,TimestampedService
Component and service managing low-level repository instances.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Durationstatic final Stringstatic final ComponentNameprotected PoolConfigurationprotected static final Map<String, ThreadLocal<Session>> Thread-local sessions allocated, per repository.static final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateRepository(String repositoryName, RepositoryFactory factory) protected voidCreates all the repositories.protected voidInitializes all the repositories.intintgetActiveSessionsCount(String repositoryName) <T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.intThe component notification order forComponent.start(ComponentContext).protected RepositoryFactorygetFactory(String repositoryName) org.apache.commons.pool2.impl.GenericKeyedObjectPool<String, ?> getPool()getRepository(String repositoryName) Gets a repository given its name.getSession(String repositoryName) Gets a session.protected SessiongetSessionFromPool(String repositoryName, Runnable cleanup) protected voidinitializeRepository(RepositoryInitializationHandler handler, String name) protected voidinitPool()protected voidvoidStart a tx and initialize repositories content.voidvoidshutdown()protected voidvoidstart(ComponentContext context) Start the component.voidstop(ComponentContext context) Stop the component.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Field Details
-
NAME
-
CLUSTER_START_DURATION_PROP
- Since:
- 11.1
- See Also:
-
CLUSTER_START_DURATION_DEFAULT
- Since:
- 11.1
-
XP_REPOSITORY
- See Also:
-
basePool
-
poolConfig
-
pool
-
SESSIONS
Thread-local sessions allocated, per repository.
-
-
Constructor Details
-
RepositoryService
public RepositoryService()
-
-
Method Details
-
shutdown
public void shutdown() -
getApplicationStartedOrder
public int getApplicationStartedOrder()Description copied from interface:ComponentThe component notification order forComponent.start(ComponentContext).Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Returns:
- the order, 1000 by default
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent
-
initPoolConfig
protected void initPoolConfig() -
initPool
protected void initPool() -
shutdownPool
protected void shutdownPool() -
resetPool
public void resetPool() -
getPool
-
initRepositories
public void initRepositories()Start a tx and initialize repositories content. This method is publicly exposed since it is needed by tests to initialize repositories after cleanups (see CoreFeature).- Since:
- 8.4
-
doCreateRepositories
protected void doCreateRepositories()Creates all the repositories. Requires an active transaction.- Since:
- 9.3
-
createRepository
-
doInitRepositories
protected void doInitRepositories()Initializes all the repositories. Requires an active transaction.- Since:
- 9.3
-
getAdapter
Description copied from interface:AdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.- Specified by:
getAdapterin interfaceAdaptable- Overrides:
getAdapterin classDefaultComponent- Parameters:
adapter- the adapter class to look up- Returns:
- a object castable to the given class, or
nullif this object does not have an adapter for the given class
-
initializeRepository
-
getRepository
Gets a repository given its name.Null is returned if no repository with that name was registered.
- Parameters:
repositoryName- the repository name- Returns:
- the repository instance or null if no repository with that name was registered
-
getFactory
-
getRepositoryNames
-
getActiveSessionsCount
public int getActiveSessionsCount() -
getActiveSessionsCount
-
getSession
Gets a session.The session is first looked up in the current transaction, otherwise fetched from a pool.
- Parameters:
repositoryName- the repository name- Returns:
- the session
- Since:
- 11.1
-
getSessionFromPool
-