Details
-
Enhancement
-
Resolution: Done
-
Major
-
2.6.0.Final
-
None
Description
Define in our public API a org.modeshape.jcr.api.nodetype.NodeTypeManager interface that extends the standard javax.jcr.nodetype.NodeTypeManager with methods to register node types in supplied CND files.
Current, client applications must use non-public API classes to load the node types in CND files.
The following methods are proposed:
/** * Read the supplied stream containing node type definitions in the standard JCR 2.0 Compact Node Definition (CND) format, and * register the node types with this repository. * * @param stream the stream containing the node type definitions in CND format * @param allowUpdate a boolean stating whether existing node type definitions should be modified/updated * @throws IOException if there is a problem reading from the supplied stream * @throws InvalidNodeTypeDefinitionException if the <code>NodeTypeDefinition</code> is invalid. * @throws NodeTypeExistsException if <code>allowUpdate</code> is <code>false</code> and the <code>NodeTypeDefinition</code> * specifies a node type name that is already registered. * @throws UnsupportedRepositoryOperationException if this implementation does not support node type registration. * @throws RepositoryException if another error occurs. */ void registerNodeTypes( InputStream stream, boolean allowUpdate ) throws IOException, InvalidNodeTypeDefinitionException, NodeTypeExistsException, UnsupportedRepositoryOperationException, RepositoryException; /** * Read the supplied file containing node type definitions in the standard JCR 2.0 Compact Node Definition (CND) format, and * register the node types with this repository. * * @param file the file containing the node types * @param allowUpdate a boolean stating whether existing node type definitions should be modified/updated * @throws IOException if there is a problem reading from the supplied stream * @throws InvalidNodeTypeDefinitionException if the <code>NodeTypeDefinition</code> is invalid. * @throws NodeTypeExistsException if <code>allowUpdate</code> is <code>false</code> and the <code>NodeTypeDefinition</code> * specifies a node type name that is already registered. * @throws UnsupportedRepositoryOperationException if this implementation does not support node type registration. * @throws RepositoryException if another error occurs. */ void registerNodeTypes( File file, boolean allowUpdate ) throws IOException, RepositoryException; /** * Read the supplied stream containing node type definitions in the standard JCR 2.0 Compact Node Definition (CND) format, and * register the node types with this repository. * * @param url the URL that can be resolved to the file containing the node type definitions in CND format * @param allowUpdate a boolean stating whether existing node type definitions should be modified/updated * @throws IOException if there is a problem reading from the supplied stream * @throws InvalidNodeTypeDefinitionException if the <code>NodeTypeDefinition</code> is invalid. * @throws NodeTypeExistsException if <code>allowUpdate</code> is <code>false</code> and the <code>NodeTypeDefinition</code> * specifies a node type name that is already registered. * @throws UnsupportedRepositoryOperationException if this implementation does not support node type registration. * @throws RepositoryException if another error occurs. */ void registerNodeTypes( URL url, boolean allowUpdate ) throws IOException, RepositoryException;