diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java index 0f6507d..e094b5a 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java @@ -76,6 +76,36 @@ public final class CndImporter { } /** + * Shortcut for + *
+     *   registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(),
+     *          wsp.getNamespaceRegistry(), session.getValueFactory(), reregisterExisting);
+     * 
+ * where wsp is the workspace of the session passed. + * @see #registerNodeTypes(Reader, String, NodeTypeManager, NamespaceRegistry, ValueFactory, boolean) + * @param cnd + * @param session the session to use for registering the node types + * @param reregisterExisting true if existing node types should be re-registered + * with those present in the cnd. false otherwise. + * @return the registered node types + * + * @throws InvalidNodeTypeDefinitionException + * @throws NodeTypeExistsException + * @throws UnsupportedRepositoryOperationException + * @throws ParseException + * @throws RepositoryException + * @throws IOException + */ + public static NodeType[] registerNodeTypes(Reader cnd, Session session, boolean reregisterExisting) + throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, + UnsupportedRepositoryOperationException, ParseException, RepositoryException, IOException { + + Workspace wsp = session.getWorkspace(); + return registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(), wsp.getNamespaceRegistry(), + session.getValueFactory(), reregisterExisting); + } + + /** * Registers nodetypes in cnd format. * @param cnd a reader to the cnd. The reader is closed on return. * @param systemId a informative id of the given cnd input.