jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1043554 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
Date Wed, 08 Dec 2010 17:57:20 GMT
Author: jukka
Date: Wed Dec  8 17:57:20 2010
New Revision: 1043554

URL: http://svn.apache.org/viewvc?rev=1043554&view=rev
Log:
JCR_2761: add shortcut method to CndImporter which makes it easier to rereigster node types

Patch by Justin Edelson

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java?rev=1043554&r1=1043553&r2=1043554&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
Wed Dec  8 17:57:20 2010
@@ -76,6 +76,36 @@ public final class CndImporter {
     }
 
     /**
+     * Shortcut for
+     * <pre>
+     *   registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(),
+     *          wsp.getNamespaceRegistry(), session.getValueFactory(), reregisterExisting);
+     * </pre>
+     * where <code>wsp</code> is the workspace of the <code>session</code>
passed.
+     * @see #registerNodeTypes(Reader, String, NodeTypeManager, NamespaceRegistry, ValueFactory,
boolean)
+     * @param cnd
+     * @param session  the session to use for registering the node types
+     * @param reregisterExisting  <code>true</code> if existing node types should
be re-registered
+     *     with those present in the cnd. <code>false</code> 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 <code>cnd</code> format.
      * @param cnd  a reader to the cnd. The reader is closed on return.
      * @param systemId  a informative id of the given cnd input.



Mime
View raw message