Package javax.jcr.nodetype
Interface NodeTypeManager
-
- All Known Subinterfaces:
JackrabbitNodeTypeManager
- All Known Implementing Classes:
AbstractNodeTypeManager
,ReadOnlyNodeTypeManager
,ReadWriteNodeTypeManager
public interface NodeTypeManager
Allows for the retrieval and (in implementations that support it) the registration of node types. Accessed viaWorkspace.getNodeTypeManager()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NodeDefinitionTemplate
createNodeDefinitionTemplate()
Returns an emptyNodeDefinitionTemplate
which can then be used to create a child node definition and attached to aNodeTypeTemplate
.NodeTypeTemplate
createNodeTypeTemplate()
Returns an emptyNodeTypeTemplate
which can then be used to define a node type and passed toNodeTypeManager.registerNodeType
.NodeTypeTemplate
createNodeTypeTemplate(NodeTypeDefinition ntd)
Returns aNodeTypeTemplate
holding the specified node type definition.PropertyDefinitionTemplate
createPropertyDefinitionTemplate()
Returns an emptyPropertyDefinitionTemplate
which can then be used to create a property definition and attached to aNodeTypeTemplate
.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)
Returnstrue
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 resultingNodeType
object.NodeTypeIterator
registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate)
Registers or updates the specified array ofNodeTypeDefinition
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
Returnstrue
if a node type with the specified name is registered. Returnsfalse
otherwise.- Parameters:
name
- aString
.- 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 emptyNodeTypeTemplate
which can then be used to define a node type and passed toNodeTypeManager.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 aNodeTypeTemplate
holding the specified node type definition. This template can then be altered and passed toNodeTypeManager.registerNodeType
.- Parameters:
ntd
- aNodeTypeDefinition
.- 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 emptyNodeDefinitionTemplate
which can then be used to create a child node definition and attached to aNodeTypeTemplate
.- 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 emptyPropertyDefinitionTemplate
which can then be used to create a property definition and attached to aNodeTypeTemplate
.- 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 resultingNodeType
object.Typically, the object passed to this method will be a
NodeTypeTemplate
(a subclass ofNodeTypeDefinition
) acquired fromNodeTypeManager.createNodeTypeTemplate
and then filled-in with definition information.- Parameters:
ntd
- anNodeTypeDefinition
.allowUpdate
- a boolean- Returns:
- the registered node type
- Throws:
InvalidNodeTypeDefinitionException
- if theNodeTypeDefinition
is invalid.NodeTypeExistsException
- ifallowUpdate
isfalse
and theNodeTypeDefinition
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 ofNodeTypeDefinition
objects. This method is used to register or update a set of node types with mutual dependencies. Returns an iterator over the resultingNodeType
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 ofNodeTypeDefinition
sallowUpdate
- a boolean- Returns:
- the registered node types.
- Throws:
InvalidNodeTypeDefinitionException
- if aNodeTypeDefinition
within theCollection
is invalid or if theCollection
contains an object of a type other thanNodeTypeDefinition
.NodeTypeExistsException
- ifallowUpdate
isfalse
and aNodeTypeDefinition
within theCollection
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
- aString
.- 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
- aString
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
-
-