import javax.jcr.Session;
import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
import java.io.FileInputStream;
public class CustomNodeTypeExample {
public static void RegisterCustomNodeTypes(Session session, String cndFileName)
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)
session.getWorkspace().getNodeTypeManager();
// Register the custom node types defined in the CND file
manager.registerNodeTypes(new FileInputStream(cndFileName),
JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
}
}