org.apache.jackrabbit.core.nodetype
Class NodeTypeManagerImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl
All Implemented Interfaces:
NodeTypeManager, JackrabbitNodeTypeManager, NodeTypeRegistryListener, Dumpable

public class NodeTypeManagerImpl
extends Object
implements JackrabbitNodeTypeManager, Dumpable, NodeTypeRegistryListener

A NodeTypeManagerImpl implements a session dependant NodeTypeManager.


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.api.JackrabbitNodeTypeManager
TEXT_X_JCR_CND, TEXT_XML
 
Constructor Summary
NodeTypeManagerImpl(NodeTypeRegistry ntReg, NamespaceRegistryImpl nsReg, NamespaceResolver nsResolver)
          Creates a new NodeTypeManagerImpl instance.
 
Method Summary
 void dump(PrintStream ps)
          Dumps the state of this instance in a human readable format for diagnostic purposes.
 NodeTypeIterator getAllNodeTypes()
          
 NodeTypeIterator getMixinNodeTypes()
          
 NodeDefinitionImpl getNodeDefinition(NodeDefId id)
           
 NodeTypeImpl getNodeType(QName name)
           
 NodeType getNodeType(String nodeTypeName)
          
 NodeTypeRegistry getNodeTypeRegistry()
           
 NodeTypeIterator getPrimaryNodeTypes()
          
 PropertyDefinitionImpl getPropertyDefinition(PropDefId id)
           
 NodeDefinitionImpl getRootNodeDefinition()
           
 boolean hasNodeType(String name)
          Checks if a node type with the given name is registered.
 void nodeTypeRegistered(QName ntName)
          Called when a node type has been registered.
 void nodeTypeReRegistered(QName ntName)
          Called when a node type has been re-registered.
 void nodeTypeUnregistered(QName ntName)
          Called when a node type has been deregistered.
 NodeType[] registerNodeTypes(InputSource in)
          Registers the node types defined in the given XML stream.
 NodeType[] registerNodeTypes(InputStream in, String contentType)
          Registers the node types defined in the given input stream depending on the content type specified for the stream.
 NodeType[] registerNodeTypes(InputStream in, String contentType, boolean reregisterExisting)
          Registers the node types defined in the given input stream depending on the content type specified for the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeTypeManagerImpl

public NodeTypeManagerImpl(NodeTypeRegistry ntReg,
                           NamespaceRegistryImpl nsReg,
                           NamespaceResolver nsResolver)
Creates a new NodeTypeManagerImpl instance.

Parameters:
ntReg - node type registry
nsReg - namespace registry
nsResolver - namespace resolver
Method Detail

getRootNodeDefinition

public NodeDefinitionImpl getRootNodeDefinition()
Returns:
the root node definition

getNodeDefinition

public NodeDefinitionImpl getNodeDefinition(NodeDefId id)
Parameters:
id -
Returns:
the node definition

getPropertyDefinition

public PropertyDefinitionImpl getPropertyDefinition(PropDefId id)
Parameters:
id -
Returns:
the property definition

getNodeType

public NodeTypeImpl getNodeType(QName name)
                         throws NoSuchNodeTypeException
Parameters:
name -
Returns:
Throws:
NoSuchNodeTypeException

getNodeTypeRegistry

public NodeTypeRegistry getNodeTypeRegistry()
Returns:
the node type registry

registerNodeTypes

public NodeType[] registerNodeTypes(InputStream in,
                                    String contentType,
                                    boolean reregisterExisting)
                             throws IOException,
                                    RepositoryException
Registers the node types defined in the given input stream depending on the content type specified for the stream. This will also register any namespaces identified in the input stream if they have not already been registered.

Parameters:
in - node type XML stream
contentType - type of the input stream
reregisterExisting - flag indicating whether node types should be reregistered if they already exist
Returns:
registered node types
Throws:
IOException - if the input stream could not be read or parsed
RepositoryException - if the node types are invalid or another repository error occurs

nodeTypeRegistered

public void nodeTypeRegistered(QName ntName)
Called when a node type has been registered.

Specified by:
nodeTypeRegistered in interface NodeTypeRegistryListener
Parameters:
ntName - name of the node type that has been registered

nodeTypeReRegistered

public void nodeTypeReRegistered(QName ntName)
Called when a node type has been re-registered.

Specified by:
nodeTypeReRegistered in interface NodeTypeRegistryListener
Parameters:
ntName - name of the node type that has been registered

nodeTypeUnregistered

public void nodeTypeUnregistered(QName ntName)
Called when a node type has been deregistered.

Specified by:
nodeTypeUnregistered in interface NodeTypeRegistryListener
Parameters:
ntName - name of the node type that has been unregistered

getAllNodeTypes

public NodeTypeIterator getAllNodeTypes()
                                 throws RepositoryException

Specified by:
getAllNodeTypes in interface NodeTypeManager
Throws:
RepositoryException

getPrimaryNodeTypes

public NodeTypeIterator getPrimaryNodeTypes()
                                     throws RepositoryException

Specified by:
getPrimaryNodeTypes in interface NodeTypeManager
Throws:
RepositoryException

getMixinNodeTypes

public NodeTypeIterator getMixinNodeTypes()
                                   throws RepositoryException

Specified by:
getMixinNodeTypes in interface NodeTypeManager
Throws:
RepositoryException

getNodeType

public NodeType getNodeType(String nodeTypeName)
                     throws NoSuchNodeTypeException

Specified by:
getNodeType in interface NodeTypeManager
Throws:
NoSuchNodeTypeException

registerNodeTypes

public NodeType[] registerNodeTypes(InputSource in)
                             throws SAXException,
                                    RepositoryException
Registers the node types defined in the given XML stream. This is a trivial implementation that just invokes the existing NodeTypeReader and NodeTypeRegistry methods and heuristically creates the returned node type array. It will also register any namespaces defined in the input source that have not already been registered. Registers node types from the given node type XML stream.

Specified by:
registerNodeTypes in interface JackrabbitNodeTypeManager
Parameters:
in - node type XML stream
Returns:
registered node types
Throws:
SAXException - if the XML stream could not be read or parsed
RepositoryException - if the node types are invalid or another repository error occurs

registerNodeTypes

public NodeType[] registerNodeTypes(InputStream in,
                                    String contentType)
                             throws IOException,
                                    RepositoryException
Registers the node types defined in the given input stream depending on the content type specified for the stream. This will also register any namespaces identified in the input stream if they have not already been registered. Registers node types from the given input stream of the given type.

Specified by:
registerNodeTypes in interface JackrabbitNodeTypeManager
Parameters:
in - node type stream
contentType - type of the input stream
Returns:
registered node types
Throws:
IOException - if the input stream could not be read or parsed
RepositoryException - if the node types are invalid or another repository error occurs

hasNodeType

public boolean hasNodeType(String name)
                    throws RepositoryException
Checks if a node type with the given name is registered.

Specified by:
hasNodeType in interface JackrabbitNodeTypeManager
Parameters:
name - node type name
Returns:
true if the named node type is registered false otherwise
Throws:
RepositoryException - if an error occurs

dump

public void dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes.

Specified by:
dump in interface Dumpable
Parameters:
ps - stream to dump state to


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