org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit
Class NodeTypeManagerImpl

java.lang.Object
  extended by org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl
All Implemented Interfaces:
NodeTypeManager

public class NodeTypeManagerImpl
extends Object
implements NodeTypeManager

This is the NodeTypeManager implementation for Apache Jackrabbit.

Author:
Oliver Kiessler

Constructor Summary
NodeTypeManagerImpl()
          Creates a new instance of NodeTypeManagerImpl.
 
Method Summary
 void createNamespace(javax.jcr.Session session, String namespace, String namespaceUri)
          Creates a new namespace in the repository.
 void createNodeTypeFromClass(javax.jcr.Session session, Class clazz, String jcrNodeType, boolean reflectSuperClasses)
          This method creates a JCR node type from a given Java Bean class by using reflection.
 void createNodeTypes(javax.jcr.Session session, ClassDescriptor[] classDescriptors)
          This method creates JCR node types based on ClassDescriptor objects which are created by a jcr-mapping Mapper implementation.
 void createNodeTypes(javax.jcr.Session session, MappingDescriptor mappingDescriptor)
          This method creates JCR node types based on the MappingDescriptor object which is created by a jcr-mapping Mapper implementation.
 void createNodeTypesFromConfiguration(javax.jcr.Session session, InputStream jcrRepositoryConfigurationFile)
          This method creates JCR node types from a JCR vendor specific configuration file.
 void createNodeTypesFromMappingFiles(javax.jcr.Session session, InputStream[] mappingXmlFiles)
          This method creates JCR node types based on jcr-mapping xml files.
 void createSingleNodeType(javax.jcr.Session session, ClassDescriptor classDescriptor)
          This method creates a single JCR node type identified by its ClassDescriptor read from the jcr mapping file.
 void createSingleNodeTypeFromMappingFile(javax.jcr.Session session, InputStream mappingXmlFile, String jcrNodeType)
          This method creates a single JCR node type identified by its jcrNodeType name defined in a jcr-mapping xml file.
 List getAllPrimaryNodeTypeNames(javax.jcr.Session session)
          Returns a list of all JCR node types.
 Name[] getJcrSuperTypes(String superTypes)
          Creates a QName array from a comma separated list of JCR super types in a given String.
 NamespaceHelper getNamespaceHelper()
          Getter for property namespaceHelper.
 NodeTypeDef getNodeTypeDef(String jcrNodeType, String jcrSuperTypes, String className)
          Creates a NodeTypeDef object.
 List getPrimaryNodeTypeNames(javax.jcr.Session session, String namespace)
          Returns the names of all node types in the repository identified by a given namespace.
 PropDefImpl getPropertyDefinition(String fieldName, PropertyDefDescriptor field, Name declaringNodeType)
          Creates a PropDefImpl object.
 void removeNodeTypesFromConfiguration(javax.jcr.Session session, InputStream jcrRepositoryConfigurationFile)
          This method removes JCR node types from a JCR vendor specific configuration file
 void removeNodeTypesFromMappingFile(javax.jcr.Session session, InputStream[] mappingXmlFile)
          This method removes all JCR node types that are defined in one to many jcr-mapping XML files.
 void removeSingleNodeType(javax.jcr.Session session, Name name)
           
 void removeSingleNodeType(javax.jcr.Session session, String jcrNodeType)
          This method removes a single JCR node type identified by its jcrNodeType name.
 void setNamespaceHelper(NamespaceHelper object)
          Setter for property namespaceHelper.
protected  String showPropertyDefinition(javax.jcr.nodetype.PropertyDefinition propDef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeTypeManagerImpl

public NodeTypeManagerImpl()
Creates a new instance of NodeTypeManagerImpl.

Method Detail

createNamespace

public void createNamespace(javax.jcr.Session session,
                            String namespace,
                            String namespaceUri)
                     throws NamespaceCreationException
Description copied from interface: NodeTypeManager
Creates a new namespace in the repository.

Specified by:
createNamespace in interface NodeTypeManager
namespace - Namespace
namespaceUri - Full namespace URI
Throws:
NamespaceCreationException
See Also:
NodeTypeManager.createNamespace(javax.jcr.Session, java.lang.String, java.lang.String)

createNodeTypes

public void createNodeTypes(javax.jcr.Session session,
                            MappingDescriptor mappingDescriptor)
                     throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates JCR node types based on the MappingDescriptor object which is created by a jcr-mapping Mapper implementation. A Mapper reads one to many jcr mapping XML File.

Specified by:
createNodeTypes in interface NodeTypeManager
Parameters:
session - Repository session
mappingDescriptor - Mapping descriptor object created by jcr-mapping
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createNodeTypes(javax.jcr.Session, org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor)

createNodeTypes

public void createNodeTypes(javax.jcr.Session session,
                            ClassDescriptor[] classDescriptors)
                     throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates JCR node types based on ClassDescriptor objects which are created by a jcr-mapping Mapper implementation. A Mapper reads one to many jcr mapping XML File.

Specified by:
createNodeTypes in interface NodeTypeManager
Parameters:
session - Repository session
classDescriptors - Array of ClassDescriptor objects created by jcr-mapping
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createNodeTypes(javax.jcr.Session, org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor)

createNodeTypesFromMappingFiles

public void createNodeTypesFromMappingFiles(javax.jcr.Session session,
                                            InputStream[] mappingXmlFiles)
                                     throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates JCR node types based on jcr-mapping xml files.

Specified by:
createNodeTypesFromMappingFiles in interface NodeTypeManager
Parameters:
session - Repository session
mappingXmlFiles - InputStreams to jcr-mapping xml files
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createNodeTypesFromMappingFiles(javax.jcr.Session, java.io.InputStream[])

createSingleNodeType

public void createSingleNodeType(javax.jcr.Session session,
                                 ClassDescriptor classDescriptor)
                          throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates a single JCR node type identified by its ClassDescriptor read from the jcr mapping file.

Specified by:
createSingleNodeType in interface NodeTypeManager
Parameters:
session - Repository session
classDescriptor - ClassDescriptor object created by jcr-mapping
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createSingleNodeType(javax.jcr.Session, org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor)

getNodeTypeDef

public NodeTypeDef getNodeTypeDef(String jcrNodeType,
                                  String jcrSuperTypes,
                                  String className)
Creates a NodeTypeDef object.

Parameters:
jcrNodeType - Name of JCR node type
jcrSuperTypes - JCR node super types
Returns:
type

getPropertyDefinition

public PropDefImpl getPropertyDefinition(String fieldName,
                                         PropertyDefDescriptor field,
                                         Name declaringNodeType)
Creates a PropDefImpl object.

Parameters:
fieldName - The name of the field
field - property definition descriptor
declaringNodeType - Node Type QName where the property belongs to
Returns:
property

showPropertyDefinition

protected String showPropertyDefinition(javax.jcr.nodetype.PropertyDefinition propDef)
Parameters:
propDef -
Returns:

getJcrSuperTypes

public Name[] getJcrSuperTypes(String superTypes)
Creates a QName array from a comma separated list of JCR super types in a given String.

Parameters:
superTypes - JCR super types
Returns:
qNameSuperTypes

createSingleNodeTypeFromMappingFile

public void createSingleNodeTypeFromMappingFile(javax.jcr.Session session,
                                                InputStream mappingXmlFile,
                                                String jcrNodeType)
                                         throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates a single JCR node type identified by its jcrNodeType name defined in a jcr-mapping xml file.

Specified by:
createSingleNodeTypeFromMappingFile in interface NodeTypeManager
Parameters:
session - Repository session
mappingXmlFile - InputStream to a jcr-mapping xml file
jcrNodeType - Name of the class that needs to be created identified by its jcrNodeType name
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createSingleNodeTypeFromMappingFile(javax.jcr.Session, java.io.InputStream, java.lang.String)

createNodeTypeFromClass

public void createNodeTypeFromClass(javax.jcr.Session session,
                                    Class clazz,
                                    String jcrNodeType,
                                    boolean reflectSuperClasses)
                             throws NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates a JCR node type from a given Java Bean class by using reflection. It creates required JCR property definitions from primitive Java class properties using the same property name. Non-primitive class properties are skipped.

Specified by:
createNodeTypeFromClass in interface NodeTypeManager
Parameters:
session - Repository session
clazz - Java class
jcrNodeType - Name of JCR node type (including namespace)
reflectSuperClasses - If true, all base classes are also reflected
Throws:
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createNodeTypeFromClass(javax.jcr.Session, java.lang.Class, java.lang.String, boolean)

createNodeTypesFromConfiguration

public void createNodeTypesFromConfiguration(javax.jcr.Session session,
                                             InputStream jcrRepositoryConfigurationFile)
                                      throws OperationNotSupportedException,
                                             NodeTypeCreationException
Description copied from interface: NodeTypeManager
This method creates JCR node types from a JCR vendor specific configuration file.

Specified by:
createNodeTypesFromConfiguration in interface NodeTypeManager
Parameters:
session - Repository session
Throws:
OperationNotSupportedException - OperationNotSupportedException
NodeTypeCreationException - NodeTypeCreationException
See Also:
NodeTypeManager.createNodeTypesFromConfiguration(javax.jcr.Session, java.io.InputStream)

removeNodeTypesFromConfiguration

public void removeNodeTypesFromConfiguration(javax.jcr.Session session,
                                             InputStream jcrRepositoryConfigurationFile)
                                      throws NodeTypeRemovalException
Description copied from interface: NodeTypeManager
This method removes JCR node types from a JCR vendor specific configuration file

Specified by:
removeNodeTypesFromConfiguration in interface NodeTypeManager
Parameters:
session - Repository session
jcrRepositoryConfigurationFile - the file that contains the node type definition
Throws:
NodeTypeRemovalException
See Also:
org.apache.jackrabbit.ocm.nodemanagement.NodeTypeManager#removeNodeTypes

removeNodeTypesFromMappingFile

public void removeNodeTypesFromMappingFile(javax.jcr.Session session,
                                           InputStream[] mappingXmlFile)
                                    throws NodeTypeRemovalException
Description copied from interface: NodeTypeManager
This method removes all JCR node types that are defined in one to many jcr-mapping XML files.

Specified by:
removeNodeTypesFromMappingFile in interface NodeTypeManager
Parameters:
session - Repository session
mappingXmlFile - InputStreams to jcr-mapping xml file
Throws:
NodeTypeRemovalException - NodeTypeRemovalException
See Also:
NodeTypeManager.createSingleNodeTypeFromMappingFile(javax.jcr.Session, java.io.InputStream, java.lang.String)

removeSingleNodeType

public void removeSingleNodeType(javax.jcr.Session session,
                                 Name name)
                          throws NodeTypeRemovalException
Throws:
NodeTypeRemovalException

removeSingleNodeType

public void removeSingleNodeType(javax.jcr.Session session,
                                 String jcrNodeType)
                          throws NodeTypeRemovalException
Description copied from interface: NodeTypeManager
This method removes a single JCR node type identified by its jcrNodeType name.

Specified by:
removeSingleNodeType in interface NodeTypeManager
Parameters:
session - Repository session
Throws:
NodeTypeRemovalException - NodeTypeRemovalException
See Also:
NodeTypeManager.removeSingleNodeType(javax.jcr.Session, java.lang.String)

getPrimaryNodeTypeNames

public List getPrimaryNodeTypeNames(javax.jcr.Session session,
                                    String namespace)
Description copied from interface: NodeTypeManager
Returns the names of all node types in the repository identified by a given namespace.

Specified by:
getPrimaryNodeTypeNames in interface NodeTypeManager
namespace - Name of nodetypes to return
Returns:
list of matching JCR node types
See Also:
NodeTypeManager.getPrimaryNodeTypeNames(javax.jcr.Session, java.lang.String)

getAllPrimaryNodeTypeNames

public List getAllPrimaryNodeTypeNames(javax.jcr.Session session)
Description copied from interface: NodeTypeManager
Returns a list of all JCR node types.

Specified by:
getAllPrimaryNodeTypeNames in interface NodeTypeManager
Returns:
list of all JCR node types
See Also:
NodeTypeManager.getAllPrimaryNodeTypeNames(javax.jcr.Session)

getNamespaceHelper

public NamespaceHelper getNamespaceHelper()
Getter for property namespaceHelper.

Returns:
namespaceHelper

setNamespaceHelper

public void setNamespaceHelper(NamespaceHelper object)
Setter for property namespaceHelper.

Parameters:
object - namespaceHelper


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.