org.apache.jackrabbit.jcr2spi.nodetype
Class NodeTypeRegistryImpl

java.lang.Object
  extended by org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl
All Implemented Interfaces:
EffectiveNodeTypeProvider, NodeTypeRegistry

public class NodeTypeRegistryImpl
extends Object
implements NodeTypeRegistry, EffectiveNodeTypeProvider

A NodeTypeRegistry ...


Method Summary
 void addListener(NodeTypeRegistryListener listener)
          Add a NodeTypeRegistryListener
static NodeTypeRegistryImpl create(NodeTypeStorage storage, NamespaceRegistry nsRegistry)
          Create a new NodeTypeRegistry
 void dispose()
          Clears all caches.
 EffectiveNodeType getEffectiveNodeType(Name ntName)
          Build the EffectiveNodeType from the given NodeType name.
 EffectiveNodeType getEffectiveNodeType(Name[] ntNames)
          Build the EffectiveNodeType from the given array of NodeType names.
 EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map<Name,QNodeTypeDefinition> ntdMap)
           
 EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd, Map<Name,QNodeTypeDefinition> ntdMap)
          Builds an effective node type representation from the given node type definition.
 QNodeTypeDefinition getNodeTypeDefinition(Name nodeTypeName)
          Returns the node type definition of the node type with the given name.
 Name[] getRegisteredNodeTypes()
          Returns the names of all registered node types.
 boolean isRegistered(Name nodeTypeName)
           
 void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs, boolean allowUpdate)
          Registers the specified node type definitions.
 void removeListener(NodeTypeRegistryListener listener)
          Remove a NodeTypeRegistryListener
 String toString()
          Returns the the state of this instance in a human readable format.
 void unregisterNodeTypes(Collection<Name> nodeTypeNames)
          Unregisters a collection of node types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static NodeTypeRegistryImpl create(NodeTypeStorage storage,
                                          NamespaceRegistry nsRegistry)
Create a new NodeTypeRegistry

Parameters:
storage -
nsRegistry -
Returns:
NodeTypeRegistry object

dispose

public void dispose()
Clears all caches.


addListener

public void addListener(NodeTypeRegistryListener listener)
Description copied from interface: NodeTypeRegistry
Add a NodeTypeRegistryListener

Specified by:
addListener in interface NodeTypeRegistry
Parameters:
listener - the new listener to be informed on (un)registration of node types
See Also:
NodeTypeRegistry.addListener(NodeTypeRegistryListener)

removeListener

public void removeListener(NodeTypeRegistryListener listener)
Description copied from interface: NodeTypeRegistry
Remove a NodeTypeRegistryListener

Specified by:
removeListener in interface NodeTypeRegistry
Parameters:
listener - an existing listener
See Also:
NodeTypeRegistry.removeListener(NodeTypeRegistryListener)

getRegisteredNodeTypes

public Name[] getRegisteredNodeTypes()
                              throws RepositoryException
Description copied from interface: NodeTypeRegistry
Returns the names of all registered node types. That includes primary and mixin node types.

Specified by:
getRegisteredNodeTypes in interface NodeTypeRegistry
Returns:
the names of all registered node types.
Throws:
RepositoryException
See Also:
NodeTypeRegistry.getRegisteredNodeTypes()

isRegistered

public boolean isRegistered(Name nodeTypeName)
Specified by:
isRegistered in interface NodeTypeRegistry
Returns:
See Also:
NodeTypeRegistry.isRegistered(Name)

registerNodeTypes

public void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs,
                              boolean allowUpdate)
                       throws NodeTypeExistsException,
                              InvalidNodeTypeDefinitionException,
                              RepositoryException
Description copied from interface: NodeTypeRegistry
Registers the specified node type definitions. If allowUpdate is true existing node types will be updated, otherwise an NodeTypeExistsException is thrown.

Specified by:
registerNodeTypes in interface NodeTypeRegistry
Throws:
NodeTypeExistsException
InvalidNodeTypeDefinitionException
RepositoryException
See Also:
NodeTypeRegistry.registerNodeTypes(Collection, boolean)

unregisterNodeTypes

public void unregisterNodeTypes(Collection<Name> nodeTypeNames)
                         throws NoSuchNodeTypeException,
                                RepositoryException
Description copied from interface: NodeTypeRegistry
Unregisters a collection of node types.

Specified by:
unregisterNodeTypes in interface NodeTypeRegistry
Parameters:
nodeTypeNames - a collection of Name objects denoting the node types to be unregistered
Throws:
NoSuchNodeTypeException - if any of the specified names does not denote a registered node type.
RepositoryException - if another error occurs
See Also:
NodeTypeRegistry.unregisterNodeTypes(Collection)

getNodeTypeDefinition

public QNodeTypeDefinition getNodeTypeDefinition(Name nodeTypeName)
                                          throws NoSuchNodeTypeException
Description copied from interface: NodeTypeRegistry
Returns the node type definition of the node type with the given name.

Specified by:
getNodeTypeDefinition in interface NodeTypeRegistry
Parameters:
nodeTypeName - name of node type whose definition should be returned.
Returns:
the node type definition of the node type with the given name.
Throws:
NoSuchNodeTypeException - if a node type with the given name does not exist
See Also:
NodeTypeRegistry.getNodeTypeDefinition(Name)

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType(Name ntName)
                                       throws NoSuchNodeTypeException
Description copied from interface: EffectiveNodeTypeProvider
Build the EffectiveNodeType from the given NodeType name.

Specified by:
getEffectiveNodeType in interface EffectiveNodeTypeProvider
Returns:
Throws:
NoSuchNodeTypeException
See Also:
EffectiveNodeTypeProvider.getEffectiveNodeType(Name)

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType(Name[] ntNames)
                                       throws ConstraintViolationException,
                                              NoSuchNodeTypeException
Description copied from interface: EffectiveNodeTypeProvider
Build the EffectiveNodeType from the given array of NodeType names.

Specified by:
getEffectiveNodeType in interface EffectiveNodeTypeProvider
Returns:
Throws:
ConstraintViolationException
NoSuchNodeTypeException
See Also:
EffectiveNodeTypeProvider.getEffectiveNodeType(Name[])

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType(Name[] ntNames,
                                              Map<Name,QNodeTypeDefinition> ntdMap)
                                       throws ConstraintViolationException,
                                              NoSuchNodeTypeException
Specified by:
getEffectiveNodeType in interface EffectiveNodeTypeProvider
Returns:
Throws:
ConstraintViolationException
NoSuchNodeTypeException
See Also:
EffectiveNodeTypeProvider#getEffectiveNodeType(Name[], Map)

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd,
                                              Map<Name,QNodeTypeDefinition> ntdMap)
                                       throws ConstraintViolationException,
                                              NoSuchNodeTypeException
Description copied from interface: EffectiveNodeTypeProvider
Builds an effective node type representation from the given node type definition. Whereas all referenced node types must exist (i.e. must be present in the specified map), the definition itself is not required to be registered.

Specified by:
getEffectiveNodeType in interface EffectiveNodeTypeProvider
Returns:
Throws:
ConstraintViolationException
NoSuchNodeTypeException
See Also:
EffectiveNodeTypeProvider#getEffectiveNodeType(QNodeTypeDefinition, Map)

toString

public String toString()
Returns the the state of this instance in a human readable format.

Overrides:
toString in class Object


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.