Package org.nuxeo.ecm.core.repository
Class RepositoryInitializationHandler
- java.lang.Object
-
- org.nuxeo.ecm.core.repository.RepositoryInitializationHandler
-
- Direct Known Subclasses:
DocumentStoreManager
,RepositoryInitializationListener
,RouteModelsInitializator
public abstract class RepositoryInitializationHandler extends Object
A repository initialization handler is responsible for initializing a repository content.The handler is called each time a repository is opened in a JVM session. This can be used to create a default structure for the repository.
To register a repository initializer
MyInitHandler
you should do:RepositoryInitializationHandler.setInstance(new MyInitHandler());
If you want to create an initialization chain you can implement to delegate to the parent handle the default initialization and then to do your specific initialization stuff
RepositoryInitializationHandler parentHandler = RepositoryInitializationHandler.getInstance(); MyInitHandler myHandler = new MyInitHandler(parentHandler); RepositoryInitializationHandler.setInstance(myHandler); ... class MyHandler extends RepositoryInitializationHandler { ... public initializeRepository(CoreSession session) { if (parentHandler != null) parentHandler.initializeRepository(session); // do my own initialization here ... } ... }
Important Note: Use the given session to initialize the repository. Do not create other repository sessions when initializing the repository to avoid dead locks.
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected static RepositoryInitializationHandler
instance
protected RepositoryInitializationHandler
next
The next handler in the chain if any or null otherwiseprotected RepositoryInitializationHandler
previous
The parent handler if any otherwise null
-
Constructor Summary
Constructors Constructor Description RepositoryInitializationHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
doInitializeRepository(CoreSession session)
static RepositoryInitializationHandler
getInstance()
RepositoryInitializationHandler
getNext()
RepositoryInitializationHandler
getPrevious()
void
initializeRepository(CoreSession session)
Must be implemented by custom initializers.void
install()
void
uninstall()
-
-
-
Field Detail
-
instance
protected static RepositoryInitializationHandler instance
-
previous
protected RepositoryInitializationHandler previous
The parent handler if any otherwise null
-
next
protected RepositoryInitializationHandler next
The next handler in the chain if any or null otherwise
-
-
Method Detail
-
getInstance
public static RepositoryInitializationHandler getInstance()
-
doInitializeRepository
public abstract void doInitializeRepository(CoreSession session)
-
initializeRepository
public void initializeRepository(CoreSession session)
Must be implemented by custom initializers.- Parameters:
session
- the current session
-
install
public void install()
-
uninstall
public void uninstall()
-
getPrevious
public RepositoryInitializationHandler getPrevious()
-
getNext
public RepositoryInitializationHandler getNext()
-
-