Package javax.jcr.nodetype
Interface NodeTypeManager
-
- All Known Subinterfaces:
JackrabbitNodeTypeManager
- All Known Implementing Classes:
AbstractNodeTypeManager,ReadOnlyNodeTypeManager,ReadWriteNodeTypeManager
public interface NodeTypeManagerAllows 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 NodeDefinitionTemplatecreateNodeDefinitionTemplate()Returns an emptyNodeDefinitionTemplatewhich can then be used to create a child node definition and attached to aNodeTypeTemplate.NodeTypeTemplatecreateNodeTypeTemplate()Returns an emptyNodeTypeTemplatewhich can then be used to define a node type and passed toNodeTypeManager.registerNodeType.NodeTypeTemplatecreateNodeTypeTemplate(NodeTypeDefinition ntd)Returns aNodeTypeTemplateholding the specified node type definition.PropertyDefinitionTemplatecreatePropertyDefinitionTemplate()Returns an emptyPropertyDefinitionTemplatewhich can then be used to create a property definition and attached to aNodeTypeTemplate.NodeTypeIteratorgetAllNodeTypes()Returns an iterator over all available node types (primary and mixin).NodeTypeIteratorgetMixinNodeTypes()Returns an iterator over all available mixin node types.NodeTypegetNodeType(java.lang.String nodeTypeName)Returns the named node type.NodeTypeIteratorgetPrimaryNodeTypes()Returns an iterator over all available primary node types.booleanhasNodeType(java.lang.String name)Returnstrueif a node type with the specified name is registered.NodeTyperegisterNodeType(NodeTypeDefinition ntd, boolean allowUpdate)Registers a new node type or updates an existing node type using the specified definition and returns the resultingNodeTypeobject.NodeTypeIteratorregisterNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate)Registers or updates the specified array ofNodeTypeDefinitionobjects.voidunregisterNodeType(java.lang.String name)Unregisters the specified node type.voidunregisterNodeTypes(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
NodeTypeobject. - Throws:
NoSuchNodeTypeException- if no node type by the given name exists.RepositoryException- if another error occurs.
-
hasNodeType
boolean hasNodeType(java.lang.String name) throws RepositoryExceptionReturnstrueif a node type with the specified name is registered. Returnsfalseotherwise.- 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 emptyNodeTypeTemplatewhich 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 aNodeTypeTemplateholding 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 emptyNodeDefinitionTemplatewhich 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 emptyPropertyDefinitionTemplatewhich 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 resultingNodeTypeobject.Typically, the object passed to this method will be a
NodeTypeTemplate(a subclass ofNodeTypeDefinition) acquired fromNodeTypeManager.createNodeTypeTemplateand then filled-in with definition information.- Parameters:
ntd- anNodeTypeDefinition.allowUpdate- a boolean- Returns:
- the registered node type
- Throws:
InvalidNodeTypeDefinitionException- if theNodeTypeDefinitionis invalid.NodeTypeExistsException- ifallowUpdateisfalseand theNodeTypeDefinitionspecifies 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 ofNodeTypeDefinitionobjects. This method is used to register or update a set of node types with mutual dependencies. Returns an iterator over the resultingNodeTypeobjects.The effect of the method is "all or nothing"; if an error occurs, no node types are registered or updated.
- Parameters:
ntds- a collection ofNodeTypeDefinitionsallowUpdate- a boolean- Returns:
- the registered node types.
- Throws:
InvalidNodeTypeDefinitionException- if aNodeTypeDefinitionwithin theCollectionis invalid or if theCollectioncontains an object of a type other thanNodeTypeDefinition.NodeTypeExistsException- ifallowUpdateisfalseand aNodeTypeDefinitionwithin theCollectionspecifies 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, RepositoryExceptionUnregisters 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, RepositoryExceptionUnregisters the specified set of node types. Used to unregister a set of node types with mutual dependencies.- Parameters:
names- aStringarray- 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
-
-