Class ReadOnlyNodeTypeManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager
-
- All Implemented Interfaces:
javax.jcr.nodetype.NodeTypeManager
,org.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
,org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
- Direct Known Subclasses:
ReadWriteNodeTypeManager
public abstract class ReadOnlyNodeTypeManager extends Object implements javax.jcr.nodetype.NodeTypeManager, org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider, org.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
Base implementation of aNodeTypeManager
with support for reading node types from theTree
returned bygetTypes()
. Methods related to node type modifications throwUnsupportedRepositoryOperationException
.
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyNodeTypeManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.jcr.nodetype.NodeDefinitionTemplate
createNodeDefinitionTemplate()
javax.jcr.nodetype.NodeTypeTemplate
createNodeTypeTemplate()
javax.jcr.nodetype.NodeTypeTemplate
createNodeTypeTemplate(javax.jcr.nodetype.NodeTypeDefinition ntd)
javax.jcr.nodetype.PropertyDefinitionTemplate
createPropertyDefinitionTemplate()
javax.jcr.nodetype.NodeTypeIterator
getAllNodeTypes()
@NotNull javax.jcr.nodetype.NodeDefinition
getDefinition(@NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull String nodeName)
@NotNull javax.jcr.nodetype.PropertyDefinition
getDefinition(@NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull org.apache.jackrabbit.oak.api.PropertyState property, boolean exactTypeMatch)
@NotNull javax.jcr.nodetype.NodeDefinition
getDefinition(@NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull org.apache.jackrabbit.oak.api.Tree targetNode)
@NotNull org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType
getEffectiveNodeType(@NotNull javax.jcr.Node node)
Returns all the node types of the given node, in a breadth-first traversal order of the type hierarchy.@NotNull org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType
getEffectiveNodeType(@NotNull org.apache.jackrabbit.oak.api.Tree tree)
static @NotNull ReadOnlyNodeTypeManager
getInstance(org.apache.jackrabbit.oak.api.Root root, org.apache.jackrabbit.oak.namepath.NamePathMapper namePathMapper)
Return a new instance ofReadOnlyNodeTypeManager
that reads node type information from the tree atNodeTypeConstants.NODE_TYPES_PATH
.javax.jcr.nodetype.NodeTypeIterator
getMixinNodeTypes()
protected @NotNull org.apache.jackrabbit.oak.namepath.NamePathMapper
getNamePathMapper()
Returns aNameMapper
to be used by this node type manager.javax.jcr.nodetype.NodeType
getNodeType(String name)
protected @NotNull String
getOakName(String jcrName)
Returns the internal name for the specified JCR name.javax.jcr.nodetype.NodeTypeIterator
getPrimaryNodeTypes()
@NotNull javax.jcr.nodetype.NodeDefinition
getRootDefinition()
protected abstract @NotNull org.apache.jackrabbit.oak.api.Tree
getTypes()
Returns theTree
instance where the node types are stored.protected @Nullable javax.jcr.ValueFactory
getValueFactory()
The value factory to be used byPropertyDefinition.getDefaultValues()
.boolean
hasNodeType(String name)
boolean
isNodeType(@NotNull String typeName, @NotNull String superName)
boolean
isNodeType(@NotNull org.apache.jackrabbit.oak.api.Tree tree, @NotNull String oakNtName)
boolean
isNodeType(@Nullable String primaryTypeName, @NotNull Iterable<String> mixinTypes, @NotNull String nodeTypeName)
javax.jcr.nodetype.NodeType
registerNodeType(javax.jcr.nodetype.NodeTypeDefinition ntd, boolean allowUpdate)
This implementation always throws aUnsupportedRepositoryOperationException
.javax.jcr.nodetype.NodeTypeIterator
registerNodeTypes(javax.jcr.nodetype.NodeTypeDefinition[] ntds, boolean allowUpdate)
This implementation always throws aUnsupportedRepositoryOperationException
.void
unregisterNodeType(String name)
This implementation always throws aUnsupportedRepositoryOperationException
.void
unregisterNodeTypes(String[] names)
This implementation always throws aUnsupportedRepositoryOperationException
.
-
-
-
Method Detail
-
getOakName
@NotNull protected final @NotNull String getOakName(String jcrName) throws javax.jcr.RepositoryException
Returns the internal name for the specified JCR name.- Parameters:
jcrName
- JCR node type name.- Returns:
- the internal representation of the given JCR name.
- Throws:
javax.jcr.RepositoryException
- If there is no valid internal representation of the specified JCR name.
-
getTypes
@NotNull protected abstract @NotNull org.apache.jackrabbit.oak.api.Tree getTypes()
Returns theTree
instance where the node types are stored. This method never returnsnull
and may return aTree
that does not exist (seeTree.exists()
when there are no types stored.- Returns:
Tree
instance where the node types are stored.
-
getValueFactory
@Nullable protected @Nullable javax.jcr.ValueFactory getValueFactory()
The value factory to be used byPropertyDefinition.getDefaultValues()
. Ifnull
the former returnsnull
.- Returns:
ValueFactory
instance ornull
.
-
getNamePathMapper
@NotNull protected @NotNull org.apache.jackrabbit.oak.namepath.NamePathMapper getNamePathMapper()
Returns aNameMapper
to be used by this node type manager. This implementation returns theNamePathMapper.DEFAULT
instance. A subclass may override this method and provide a different implementation.- Returns:
NameMapper
instance.
-
getInstance
@NotNull public static @NotNull ReadOnlyNodeTypeManager getInstance(org.apache.jackrabbit.oak.api.Root root, org.apache.jackrabbit.oak.namepath.NamePathMapper namePathMapper)
Return a new instance ofReadOnlyNodeTypeManager
that reads node type information from the tree atNodeTypeConstants.NODE_TYPES_PATH
.- Parameters:
root
- The root to read node types from.namePathMapper
- TheNamePathMapper
to use.- Returns:
- a new instance of
ReadOnlyNodeTypeManager
.
-
hasNodeType
public boolean hasNodeType(String name) throws javax.jcr.RepositoryException
- Specified by:
hasNodeType
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
getNodeType
public javax.jcr.nodetype.NodeType getNodeType(String name) throws javax.jcr.RepositoryException
- Specified by:
getNodeType
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
getAllNodeTypes
public javax.jcr.nodetype.NodeTypeIterator getAllNodeTypes() throws javax.jcr.RepositoryException
- Specified by:
getAllNodeTypes
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
getPrimaryNodeTypes
public javax.jcr.nodetype.NodeTypeIterator getPrimaryNodeTypes() throws javax.jcr.RepositoryException
- Specified by:
getPrimaryNodeTypes
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
getMixinNodeTypes
public javax.jcr.nodetype.NodeTypeIterator getMixinNodeTypes() throws javax.jcr.RepositoryException
- Specified by:
getMixinNodeTypes
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
createNodeTypeTemplate
public javax.jcr.nodetype.NodeTypeTemplate createNodeTypeTemplate() throws javax.jcr.RepositoryException
- Specified by:
createNodeTypeTemplate
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
createNodeTypeTemplate
public javax.jcr.nodetype.NodeTypeTemplate createNodeTypeTemplate(javax.jcr.nodetype.NodeTypeDefinition ntd) throws javax.jcr.RepositoryException
- Specified by:
createNodeTypeTemplate
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
createNodeDefinitionTemplate
public javax.jcr.nodetype.NodeDefinitionTemplate createNodeDefinitionTemplate() throws javax.jcr.RepositoryException
- Specified by:
createNodeDefinitionTemplate
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
createPropertyDefinitionTemplate
public javax.jcr.nodetype.PropertyDefinitionTemplate createPropertyDefinitionTemplate() throws javax.jcr.RepositoryException
- Specified by:
createPropertyDefinitionTemplate
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
registerNodeType
public javax.jcr.nodetype.NodeType registerNodeType(javax.jcr.nodetype.NodeTypeDefinition ntd, boolean allowUpdate) throws javax.jcr.RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
registerNodeType
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
registerNodeTypes
public javax.jcr.nodetype.NodeTypeIterator registerNodeTypes(javax.jcr.nodetype.NodeTypeDefinition[] ntds, boolean allowUpdate) throws javax.jcr.RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
registerNodeTypes
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
unregisterNodeType
public void unregisterNodeType(String name) throws javax.jcr.RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
unregisterNodeType
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
unregisterNodeTypes
public void unregisterNodeTypes(String[] names) throws javax.jcr.RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
unregisterNodeTypes
in interfacejavax.jcr.nodetype.NodeTypeManager
- Throws:
javax.jcr.RepositoryException
-
isNodeType
public boolean isNodeType(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree, @NotNull @NotNull String oakNtName)
- Specified by:
isNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
-
isNodeType
public boolean isNodeType(@Nullable @Nullable String primaryTypeName, @NotNull @NotNull Iterable<String> mixinTypes, @NotNull @NotNull String nodeTypeName)
- Specified by:
isNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
-
isNodeType
public boolean isNodeType(@NotNull @NotNull String typeName, @NotNull @NotNull String superName)
- Specified by:
isNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
-
getEffectiveNodeType
@NotNull public @NotNull org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType getEffectiveNodeType(@NotNull @NotNull javax.jcr.Node node) throws javax.jcr.RepositoryException
Returns all the node types of the given node, in a breadth-first traversal order of the type hierarchy.- Specified by:
getEffectiveNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
- Parameters:
node
- node instance- Returns:
- all types of the given node
- Throws:
javax.jcr.RepositoryException
- if the type information can not be accessed
-
getEffectiveNodeType
@NotNull public @NotNull org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType getEffectiveNodeType(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree) throws javax.jcr.RepositoryException
- Specified by:
getEffectiveNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
- Throws:
javax.jcr.RepositoryException
-
getRootDefinition
@NotNull public @NotNull javax.jcr.nodetype.NodeDefinition getRootDefinition() throws javax.jcr.RepositoryException
- Specified by:
getRootDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
javax.jcr.RepositoryException
-
getDefinition
@NotNull public @NotNull javax.jcr.nodetype.NodeDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull String nodeName) throws javax.jcr.RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
javax.jcr.RepositoryException
-
getDefinition
@NotNull public @NotNull javax.jcr.nodetype.NodeDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull org.apache.jackrabbit.oak.api.Tree targetNode) throws javax.jcr.RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
javax.jcr.RepositoryException
-
getDefinition
@NotNull public @NotNull javax.jcr.nodetype.PropertyDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull org.apache.jackrabbit.oak.api.PropertyState property, boolean exactTypeMatch) throws javax.jcr.RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
javax.jcr.RepositoryException
-
-