You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2010/12/08 18:57:20 UTC
svn commit: r1043554 -
/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
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.