javax.jcr.nodetype
Interface NodeTypeManager


public interface NodeTypeManager

Allows for the retrieval and (in implementations that support it) the registration of node types. Accessed via Workspace.getNodeTypeManager().


Method Summary
 NodeDefinitionTemplate createNodeDefinitionTemplate()
          Returns an empty NodeDefinitionTemplate which can then be used to create a child node definition and attached to a NodeTypeTemplate.
 NodeTypeTemplate createNodeTypeTemplate()
          Returns an empty NodeTypeTemplate which can then be used to define a node type and passed to NodeTypeManager.registerNodeType.
 NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd)
          Returns a NodeTypeTemplate holding the specified node type definition.
 PropertyDefinitionTemplate createPropertyDefinitionTemplate()
          Returns an empty PropertyDefinitionTemplate which can then be used to create a property definition and attached to a NodeTypeTemplate.
 NodeTypeIterator getAllNodeTypes()
          Returns an iterator over all available node types (primary and mixin).
 NodeTypeIterator getMixinNodeTypes()
          Returns an iterator over all available mixin node types.
 NodeType getNodeType(java.lang.String nodeTypeName)
          Returns the named node type.
 NodeTypeIterator getPrimaryNodeTypes()
          Returns an iterator over all available primary node types.
 boolean hasNodeType(java.lang.String name)
          Returns true if a node type with the specified name is registered.
 NodeType registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate)
          Registers a new node type or updates an existing node type using the specified definition and returns the resulting NodeType object.
 NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate)
          Registers or updates the specified array of NodeTypeDefinition objects.
 void unregisterNodeType(java.lang.String name)
          Unregisters the specified node type.
 void unregisterNodeTypes(java.lang.String[] names)
          Unregisters the specified set of node types.
 

Method Detail

getNodeType

NodeType getNodeType(java.lang.String nodeTypeName)
                     throws NoSuchNodeTypeException,
                            RepositoryException
Returns the named node type.

Parameters:
nodeTypeName - the name of an existing node type.
Returns:
A NodeType object.
Throws:
NoSuchNodeTypeException - if no node type by the given name exists.
RepositoryException - if another error occurs.

hasNodeType

boolean hasNodeType(java.lang.String name)
                    throws RepositoryException
Returns true if a node type with the specified name is registered. Returns false otherwise.

Parameters:
name - a String.
Returns:
a boolean
Throws:
RepositoryException - if an error occurs.
Since:
JCR 2.0

getAllNodeTypes

NodeTypeIterator getAllNodeTypes()
                                 throws RepositoryException
Returns an iterator over all available node types (primary and mixin).

Returns:
An NodeTypeIterator.
Throws:
RepositoryException - if an error occurs.

getPrimaryNodeTypes

NodeTypeIterator getPrimaryNodeTypes()
                                     throws RepositoryException
Returns an iterator over all available primary node types.

Returns:
An NodeTypeIterator.
Throws:
RepositoryException - if an error occurs.

getMixinNodeTypes

NodeTypeIterator getMixinNodeTypes()
                                   throws RepositoryException
Returns an iterator over all available mixin node types. If none are available, an empty iterator is returned.

Returns:
An NodeTypeIterator.
Throws:
RepositoryException - if an error occurs.

createNodeTypeTemplate

NodeTypeTemplate createNodeTypeTemplate()
                                        throws UnsupportedRepositoryOperationException,
                                               RepositoryException
Returns an empty NodeTypeTemplate which can then be used to define a node type and passed to NodeTypeManager.registerNodeType.

Returns:
A NodeTypeTemplate.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

createNodeTypeTemplate

NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd)
                                        throws UnsupportedRepositoryOperationException,
                                               RepositoryException
Returns a NodeTypeTemplate holding the specified node type definition. This template can then be altered and passed to NodeTypeManager.registerNodeType.

Parameters:
ntd - a NodeTypeDefinition.
Returns:
A NodeTypeTemplate.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

createNodeDefinitionTemplate

NodeDefinitionTemplate createNodeDefinitionTemplate()
                                                    throws UnsupportedRepositoryOperationException,
                                                           RepositoryException
Returns an empty NodeDefinitionTemplate which can then be used to create a child node definition and attached to a NodeTypeTemplate.

Returns:
A NodeDefinitionTemplate.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

createPropertyDefinitionTemplate

PropertyDefinitionTemplate createPropertyDefinitionTemplate()
                                                            throws UnsupportedRepositoryOperationException,
                                                                   RepositoryException
Returns an empty PropertyDefinitionTemplate which can then be used to create a property definition and attached to a NodeTypeTemplate.

Returns:
A PropertyDefinitionTemplate.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

registerNodeType

NodeType registerNodeType(NodeTypeDefinition ntd,
                          boolean allowUpdate)
                          throws InvalidNodeTypeDefinitionException,
                                 NodeTypeExistsException,
                                 UnsupportedRepositoryOperationException,
                                 RepositoryException
Registers a new node type or updates an existing node type using the specified definition and returns the resulting NodeType object.

Typically, the object passed to this method will be a NodeTypeTemplate (a subclass of NodeTypeDefinition) acquired from NodeTypeManager.createNodeTypeTemplate and then filled-in with definition information.

Parameters:
ntd - an NodeTypeDefinition.
allowUpdate - a boolean
Returns:
the registered node type
Throws:
InvalidNodeTypeDefinitionException - if the NodeTypeDefinition is invalid.
NodeTypeExistsException - if allowUpdate is false and the NodeTypeDefinition specifies a node type name that is already registered.
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

registerNodeTypes

NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds,
                                   boolean allowUpdate)
                                   throws InvalidNodeTypeDefinitionException,
                                          NodeTypeExistsException,
                                          UnsupportedRepositoryOperationException,
                                          RepositoryException
Registers or updates the specified array of NodeTypeDefinition objects. This method is used to register or update a set of node types with mutual dependencies. Returns an iterator over the resulting NodeType objects.

The effect of the method is "all or nothing"; if an error occurs, no node types are registered or updated.

Parameters:
ntds - a collection of NodeTypeDefinitions
allowUpdate - a boolean
Returns:
the registered node types.
Throws:
InvalidNodeTypeDefinitionException - if a NodeTypeDefinition within the Collection is invalid or if the Collection contains an object of a type other than NodeTypeDefinition.
NodeTypeExistsException - if allowUpdate is false and a NodeTypeDefinition within the Collection specifies a node type name that is already registered.
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
RepositoryException - if another error occurs.
Since:
JCR 2.0

unregisterNodeType

void unregisterNodeType(java.lang.String name)
                        throws UnsupportedRepositoryOperationException,
                               NoSuchNodeTypeException,
                               RepositoryException
Unregisters the specified node type.

Parameters:
name - a String.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
NoSuchNodeTypeException - if no registered node type exists with the specified name.
RepositoryException - if another error occurs.
Since:
JCR 2.0

unregisterNodeTypes

void unregisterNodeTypes(java.lang.String[] names)
                         throws UnsupportedRepositoryOperationException,
                                NoSuchNodeTypeException,
                                RepositoryException
Unregisters the specified set of node types. Used to unregister a set of node types with mutual dependencies.

Parameters:
names - a String array
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support node type registration.
NoSuchNodeTypeException - if one of the names listed is not a registered node type.
RepositoryException - if another error occurs.
Since:
JCR 2.0


Copyright © 2009 Day Software. All Rights Reserved.