Also, Thierry has created a new platform component that takes care of a domain initialization by using an extension point. Now the default domain and sections/workspaces roots are created in such a manner.
See
org.nuxeo.ecm.platform/nuxeo-platform-content-template-manager/src/ main/resources/OSGI-INF/content-template-contrib.xml

You can create a new extension for org.nuxeo.ecm.platform.content.template.service.ContentTemplateService, point factoryBinding, to create other things if you want.
In particular, that's handy if you want to rename them.

Florent

On 9 Aug 2007, at 14:22, Bogdan Stefanescu wrote:


Hi all,

In latest version of nuxeo there is a method to initialize the repository structure on the first access.

Here is how you can install your own initialization handler:

Define a new nuxeo runtime component. In the activate() method of the component do the following:

RepositoryInitializationHandler.setInstance(new MyInitHandler());

where MyInitHandler is your own handler.
The initialization handler will be called each time a repository is first accessed in a JVM session. This means the handler will be called after each server restart on the first access on a repository. Because of this you should check in your handler if the repository was already initialized and if true to skip the intiialization

Nuxeo ECM ensure that the handler is called in a synchronized block so you can be sure that no other sessions
are used while your handler initializeRepository() is executed.
This also means you *must* not open new sessions on the repository tinside you handler method
otherwise you will end in a dead lock.
Use the session passed as argument to make modification on the repository.

Also, the session passed to your handler is in a system user context so you have all privileges granted on the repository.

If other handler are set by other modules the last one will be used.
If you need to create a handler chain then you can use the following method:

RepositoryInitializationHandler parentHandler = RepositoryInitializationHandler.getInstance();
MyInitHandler myHandler = new MyInitHandler(parentHandler);
RepositoryInitializationHandler.setInstance(myHandler);

And then define your handler like this:

class MyHandler extends RepositoryInitializationHandler {
     public initializeRepository(CoreSession session) {
if (parentHandler != null) { // first delegate initialization to the parent handler
           parentHandler.initializeRepository(session);
       }
       // do my own intialization here
       ...
     }
}



Bogdan

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm


--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87



_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to