Class ReadWriteNodeTypeManager
java.lang.Object
org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager
org.apache.jackrabbit.oak.plugins.nodetype.write.ReadWriteNodeTypeManager
- All Implemented Interfaces:
NodeTypeManager,DefinitionProvider,EffectiveNodeTypeProvider
ReadWriteNodeTypeManager extends the ReadOnlyNodeTypeManager
with support for operations that modify node types.
registerNodeType(NodeTypeDefinition, boolean)registerNodeTypes(NodeTypeDefinition[], boolean)unregisterNodeType(String)unregisterNodeTypes(String[])- plus related template factory methods
refresh() callback
to e.g. inform an associated session that it should refresh to make the
changes visible.
Subclass responsibility is to provide an implementation of
ReadOnlyNodeTypeManager.getTypes() for read only access to the tree where node types are
stored in content and getWriteRoot() for write access to the
repository in order to modify node types stored in content. A subclass may
also want to override the default implementation of
ReadOnlyNodeTypeManager for the following methods:
ReadOnlyNodeTypeManager.getValueFactory()ReadOnlyNodeTypeManager.getNamePathMapper()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an emptyNodeDefinitionTemplatewhich can then be used to create a child node definition and attached to aNodeTypeTemplate.Returns an emptyNodeTypeTemplatewhich can then be used to define a node type and passed toNodeTypeManager.registerNodeType.Returns aNodeTypeTemplatefrom the given definition, which can then be used to define a node type and passed toNodeTypeManager.registerNodeType.Returns an emptyPropertyDefinitionTemplatewhich can then be used to create a property definition and attached to aNodeTypeTemplate.registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate) Registers a new node type or updates an existing node type using the specified definition and returns the resultingNodeTypeobject.final NodeTypeIteratorregisterNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate) Registers or updates the specified array ofNodeTypeDefinitionobjects.voidunregisterNodeType(String name) Unregisters the specified node type.voidunregisterNodeTypes(String[] names) Unregisters the specified set of node types.Methods inherited from class org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager
getAllNodeTypes, getDefinition, getDefinition, getDefinition, getEffectiveNodeType, getEffectiveNodeType, getInstance, getMixinNodeTypes, getNodeType, getPrimaryNodeTypes, getRootDefinition, hasNodeType, isNodeType, isNodeType, isNodeTypeMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
isNodeType, isNodeType
-
Constructor Details
-
ReadWriteNodeTypeManager
public ReadWriteNodeTypeManager()
-
-
Method Details
-
createNodeTypeTemplate
Returns an emptyNodeTypeTemplatewhich can then be used to define a node type and passed toNodeTypeManager.registerNodeType.- Specified by:
createNodeTypeTemplatein interfaceNodeTypeManager- Overrides:
createNodeTypeTemplatein classReadOnlyNodeTypeManager- Returns:
- A new empty
NodeTypeTemplate. - Since:
- JCR 2.0
-
createNodeTypeTemplate
public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd) throws ConstraintViolationException Returns aNodeTypeTemplatefrom the given definition, which can then be used to define a node type and passed toNodeTypeManager.registerNodeType.- Specified by:
createNodeTypeTemplatein interfaceNodeTypeManager- Overrides:
createNodeTypeTemplatein classReadOnlyNodeTypeManager- Parameters:
ntd- aNodeTypeDefinition.- Returns:
- A new
NodeTypeTemplate. - Throws:
ConstraintViolationException- Since:
- JCR 2.0
-
createNodeDefinitionTemplate
Returns an emptyNodeDefinitionTemplatewhich can then be used to create a child node definition and attached to aNodeTypeTemplate.- Specified by:
createNodeDefinitionTemplatein interfaceNodeTypeManager- Overrides:
createNodeDefinitionTemplatein classReadOnlyNodeTypeManager- Returns:
- A new
NodeDefinitionTemplate. - Since:
- JCR 2.0
-
createPropertyDefinitionTemplate
Returns an emptyPropertyDefinitionTemplatewhich can then be used to create a property definition and attached to aNodeTypeTemplate.- Specified by:
createPropertyDefinitionTemplatein interfaceNodeTypeManager- Overrides:
createPropertyDefinitionTemplatein classReadOnlyNodeTypeManager- Returns:
- A new
PropertyDefinitionTemplate. - Since:
- JCR 2.0
-
registerNodeType
public NodeType registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate) throws 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.- Specified by:
registerNodeTypein interfaceNodeTypeManager- Overrides:
registerNodeTypein classReadOnlyNodeTypeManager- Parameters:
ntd- anNodeTypeDefinition.allowUpdate- a boolean- Returns:
- the registered node type
- Throws:
NodeTypeExistsException- ifallowUpdateisfalseand theNodeTypeDefinitionspecifies a node type name that is already registered.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
registerNodeTypes
public final NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate) throws 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.
- Specified by:
registerNodeTypesin interfaceNodeTypeManager- Overrides:
registerNodeTypesin classReadOnlyNodeTypeManager- Parameters:
ntds- a collection ofNodeTypeDefinitionsallowUpdate- a boolean- Returns:
- the registered node types.
- Throws:
NodeTypeExistsException- ifallowUpdateisfalseand aNodeTypeDefinitionwithin theCollectionspecifies a node type name that is already registered.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
unregisterNodeType
Unregisters the specified node type.- Specified by:
unregisterNodeTypein interfaceNodeTypeManager- Overrides:
unregisterNodeTypein classReadOnlyNodeTypeManager- Parameters:
name- aString.- Throws:
NoSuchNodeTypeException- if no registered node type exists with the specified name.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
unregisterNodeTypes
Unregisters the specified set of node types. Used to unregister a set of node types with mutual dependencies.- Specified by:
unregisterNodeTypesin interfaceNodeTypeManager- Overrides:
unregisterNodeTypesin classReadOnlyNodeTypeManager- Parameters:
names- aStringarray- Throws:
NoSuchNodeTypeException- if one of the names listed is not a registered node type.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-