6.7.9 Discovering available Node Types

Discovery of which node types are available in a content repository is done through the NodeTypeManager object, which is acquired via the Workspace. Recall from earlier in the specification:

javax.jcr.
Workspace

NodeTypeManager

getNodeTypeManager()

Returns the NodeTypeManager object through which available node types are discovered. There is one node type registry per repository, therefore the NodeTypeManager is not workspace-specific; it provides introspection methods for the global, repository-wide set of available node types.

A RepositoryException is thrown if an error occurs.


The NodeTypeManager provides the following methods:

javax.jcr.nodetype.
NodeTypeManager

NodeType

getNodeType(String nodeTypeName)

Returns the NodeType specified by nodeTypeName. If no node type by that name is registered, a NoSuchNodeTypeException is thrown.

A RepositoryException is thrown if another error occurs.

NodeType
Iterator

getAllNodeTypes()

Returns all available node types, primary and mixin.

A RepositoryException is thrown if an error occurs.

NodeType
Iterator

getPrimaryNodeTypes()

Returns all available primary node types.

A RepositoryException is thrown if an error occurs.

NodeType
Iterator

getMixinNodeTypes()

Returns all available mixin types. If none are available, an empty iterator is returned.

A RepositoryException is thrown if an error occurs.