Author: bcarothers
Date: 2009-09-10 10:35:50 -0400 (Thu, 10 Sep 2009)
New Revision: 1202
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java
Log:
DNA-516 Reference Guide example that defines node types programmatically has several
typos
Applied patch that exposes the RTNM registerNodeTypes(JcrNodeTypeSource) method to users
through the JcrNodeTypeManager. The JNTM is the class returned by a call to
JcrWorkspace.getNodeTypeManager().
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java 2009-09-10
13:42:41 UTC (rev 1201)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeTypeManager.java 2009-09-10
14:35:50 UTC (rev 1202)
@@ -441,6 +441,37 @@
}
/**
+ * Registers the node types from the given {@code JcrNodeTypeSource}. This method is
used to register or update a set of node
+ * types with mutual dependencies. Returns an iterator over the resulting {@code
NodeType} objects.
+ * <p>
+ * The effect of the method is "all or nothing"; if an error occurs, no
node types are registered or updated.
+ * </p>
+ *
+ * @param source the new node types to register
+ * @return the {@code newly created node types}
+ * @throws InvalidNodeTypeDefinitionException if a {@code NodeTypeDefinition} within
the collection is invalid
+ * @throws NodeTypeExistsException if {@code allowUpdate} is false and a {@code
NodeTypeDefinition} within the collection
+ * specifies a node type name that already exists
+ * @throws UnsupportedRepositoryOperationException if {@code allowUpdate} is true;
DNA does not allow updating node types at
+ * this time.
+ * @throws AccessDeniedException if the current session does not have the {@link
JcrSession#DNA_REGISTER_TYPE_PERMISSION
+ * register type permission}.
+ * @throws RepositoryException if another error occurs
+ */
+ public NodeTypeIterator registerNodeTypes( JcrNodeTypeSource source )
+ throws InvalidNodeTypeDefinitionException, NodeTypeExistsException,
UnsupportedRepositoryOperationException,
+ AccessDeniedException, RepositoryException {
+
+ try {
+ session.checkPermission((Path)null,
JcrSession.DNA_REGISTER_TYPE_PERMISSION);
+ } catch (AccessControlException ace) {
+ throw new AccessDeniedException(ace);
+ }
+
+ return new
JcrNodeTypeIterator(this.repositoryTypeManager.registerNodeTypes(source));
+ }
+
+ /**
* Allows the collection of node types to be unregistered if they are not referenced
by other node types as supertypes,
* default primary types of child nodes, or required primary types of child nodes.
* <p>
Show replies by date