Class ReadOnlyNodeTypeManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager
-
- All Implemented Interfaces:
NodeTypeManager
,org.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
,org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
- Direct Known Subclasses:
ReadWriteNodeTypeManager
public abstract class ReadOnlyNodeTypeManager extends java.lang.Object implements 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 NodeDefinitionTemplate
createNodeDefinitionTemplate()
NodeTypeTemplate
createNodeTypeTemplate()
NodeTypeTemplate
createNodeTypeTemplate(NodeTypeDefinition ntd)
PropertyDefinitionTemplate
createPropertyDefinitionTemplate()
NodeTypeIterator
getAllNodeTypes()
@NotNull NodeDefinition
getDefinition(@NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull java.lang.String nodeName)
@NotNull PropertyDefinition
getDefinition(@NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull org.apache.jackrabbit.oak.api.PropertyState property, boolean exactTypeMatch)
@NotNull 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 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
.NodeTypeIterator
getMixinNodeTypes()
protected @NotNull org.apache.jackrabbit.oak.namepath.NamePathMapper
getNamePathMapper()
Returns aNameMapper
to be used by this node type manager.NodeType
getNodeType(java.lang.String name)
protected @NotNull java.lang.String
getOakName(java.lang.String jcrName)
Returns the internal name for the specified JCR name.NodeTypeIterator
getPrimaryNodeTypes()
@NotNull NodeDefinition
getRootDefinition()
protected abstract @NotNull org.apache.jackrabbit.oak.api.Tree
getTypes()
Returns theTree
instance where the node types are stored.protected @Nullable ValueFactory
getValueFactory()
The value factory to be used byPropertyDefinition.getDefaultValues()
.boolean
hasNodeType(java.lang.String name)
boolean
isNodeType(@NotNull java.lang.String typeName, @NotNull java.lang.String superName)
boolean
isNodeType(@NotNull org.apache.jackrabbit.oak.api.Tree tree, @NotNull java.lang.String oakNtName)
boolean
isNodeType(@Nullable java.lang.String primaryTypeName, @NotNull java.lang.Iterable<java.lang.String> mixinTypes, @NotNull java.lang.String nodeTypeName)
NodeType
registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate)
This implementation always throws aUnsupportedRepositoryOperationException
.NodeTypeIterator
registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate)
This implementation always throws aUnsupportedRepositoryOperationException
.void
unregisterNodeType(java.lang.String name)
This implementation always throws aUnsupportedRepositoryOperationException
.void
unregisterNodeTypes(java.lang.String[] names)
This implementation always throws aUnsupportedRepositoryOperationException
.
-
-
-
Method Detail
-
getOakName
@NotNull protected final @NotNull java.lang.String getOakName(java.lang.String jcrName) throws 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:
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 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(java.lang.String name) throws RepositoryException
- Specified by:
hasNodeType
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
getNodeType
public NodeType getNodeType(java.lang.String name) throws RepositoryException
- Specified by:
getNodeType
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
getAllNodeTypes
public NodeTypeIterator getAllNodeTypes() throws RepositoryException
- Specified by:
getAllNodeTypes
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
getPrimaryNodeTypes
public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException
- Specified by:
getPrimaryNodeTypes
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
getMixinNodeTypes
public NodeTypeIterator getMixinNodeTypes() throws RepositoryException
- Specified by:
getMixinNodeTypes
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
createNodeTypeTemplate
public NodeTypeTemplate createNodeTypeTemplate() throws RepositoryException
- Specified by:
createNodeTypeTemplate
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
createNodeTypeTemplate
public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd) throws RepositoryException
- Specified by:
createNodeTypeTemplate
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
createNodeDefinitionTemplate
public NodeDefinitionTemplate createNodeDefinitionTemplate() throws RepositoryException
- Specified by:
createNodeDefinitionTemplate
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
createPropertyDefinitionTemplate
public PropertyDefinitionTemplate createPropertyDefinitionTemplate() throws RepositoryException
- Specified by:
createPropertyDefinitionTemplate
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
registerNodeType
public NodeType registerNodeType(NodeTypeDefinition ntd, boolean allowUpdate) throws RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
registerNodeType
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
registerNodeTypes
public NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate) throws RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
registerNodeTypes
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
unregisterNodeType
public void unregisterNodeType(java.lang.String name) throws RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
unregisterNodeType
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
unregisterNodeTypes
public void unregisterNodeTypes(java.lang.String[] names) throws RepositoryException
This implementation always throws aUnsupportedRepositoryOperationException
.- Specified by:
unregisterNodeTypes
in interfaceNodeTypeManager
- Throws:
RepositoryException
-
isNodeType
public boolean isNodeType(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree tree, @NotNull @NotNull java.lang.String oakNtName)
- Specified by:
isNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
-
isNodeType
public boolean isNodeType(@Nullable @Nullable java.lang.String primaryTypeName, @NotNull @NotNull java.lang.Iterable<java.lang.String> mixinTypes, @NotNull @NotNull java.lang.String nodeTypeName)
- Specified by:
isNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
-
isNodeType
public boolean isNodeType(@NotNull @NotNull java.lang.String typeName, @NotNull @NotNull java.lang.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 Node node) throws 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:
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 RepositoryException
- Specified by:
getEffectiveNodeType
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider
- Throws:
RepositoryException
-
getRootDefinition
@NotNull public @NotNull NodeDefinition getRootDefinition() throws RepositoryException
- Specified by:
getRootDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
RepositoryException
-
getDefinition
@NotNull public @NotNull NodeDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull java.lang.String nodeName) throws RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
RepositoryException
-
getDefinition
@NotNull public @NotNull NodeDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull org.apache.jackrabbit.oak.api.Tree targetNode) throws RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
RepositoryException
-
getDefinition
@NotNull public @NotNull PropertyDefinition getDefinition(@NotNull @NotNull org.apache.jackrabbit.oak.api.Tree parent, @NotNull @NotNull org.apache.jackrabbit.oak.api.PropertyState property, boolean exactTypeMatch) throws RepositoryException
- Specified by:
getDefinition
in interfaceorg.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider
- Throws:
RepositoryException
-
-