jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patricio Echag├╝e <patric...@gmail.com>
Subject Strategy to register new node types.
Date Thu, 19 Nov 2009 05:01:24 GMT
Hi all, I did a research on the email list to see if someone has run into

I'm trying to register a CND file a created. Jackrabbit web page suggests
the following [1].

My question is, where should I place that piece of code? Since it receives a
session, i figure that the CND is attached to a workspace.

Is there any way to execute this code at the moment the repository is
created so that the new node types are available for all workspaces?

I hope my questions make sense.


[1] http://jackrabbit.apache.org/node-types.html

import javax.jcr.Session;
import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
import java.io.FileInputStream;

public class CustomNodeTypeExample {
    public static void RegisterCustomNodeTypes(Session session, String
        throws Exception {

        // Get the JackrabbitNodeTypeManager from the Workspace.
        // Note that it must be cast from the generic JCR NodeTypeManager to the
        // Jackrabbit-specific implementation.
        JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
        // Register the custom node types defined in the CND file
        manager.registerNodeTypes(new FileInputStream(cndFileName),


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message