org.apache.jackrabbit.ocm.nodemanagement
Interface NodeTypeManager

All Known Implementing Classes:
NodeTypeManagerImpl, NodeTypeManagerImpl

public interface NodeTypeManager

This interface defines the API for JCR Node Type Management implementations. It does not contain any JCR vendor specific methods. Classes that implement this interface are used to create custom node types in a JCR repository. Each JCR repository has its own way of doing this as it is not defined by the JSR-170 spec. The default implementation of jcr-nodemanagement is Jackrabbit. In order to create JCR custom node types you need to provide an established session to a JCR repository. The user that is logged into has to have the necessary permissions to create nodes (user has to have "superuser" rights). The JCR Node Type Management tools are an extension to the jcr-mapping tools. NodeTypeManager implementations depend on the jcr-mapping xml file and the object model defined by jcr-mapping.

Author:
Oliver Kiessler

Method Summary
 void createNamespace(Session session, String namespace, String namespaceUri)
          Creates a new namespace in the repository.
 void createNodeTypeFromClass(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(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(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(Session session, InputStream jcrRepositoryConfigurationFile)
          This method creates JCR node types from a JCR vendor specific configuration file.
 void createNodeTypesFromMappingFiles(Session session, InputStream[] mappingXmlFiles)
          This method creates JCR node types based on jcr-mapping xml files.
 void createSingleNodeType(Session session, ClassDescriptor classDescriptor)
          This method creates a single JCR node type identified by its ClassDescriptor read from the jcr mapping file.
 void createSingleNodeTypeFromMappingFile(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(Session session)
          Returns a list of all JCR node types.
 List getPrimaryNodeTypeNames(Session session, String namespace)
          Returns the names of all node types in the repository identified by a given namespace.
 void removeNodeTypesFromConfiguration(Session session, InputStream jcrRepositoryConfigurationFile)
          This method removes JCR node types from a JCR vendor specific configuration file
 void removeNodeTypesFromMappingFile(Session session, InputStream[] mappingXmlFiles)
          This method removes all JCR node types that are defined in one to many jcr-mapping XML files.
 void removeSingleNodeType(Session session, String jcrNodeType)
          This method removes a single JCR node type identified by its jcrNodeType name.
 

Method Detail

createNamespace

void createNamespace(Session session,
                     String namespace,
                     String namespaceUri)
                     throws NamespaceCreationException
Creates a new namespace in the repository.

Parameters:
namespace - Namespace
namespaceUri - Full namespace URI
Throws:
NamespaceCreationException

createNodeTypes

void createNodeTypes(Session session,
                     MappingDescriptor mappingDescriptor)
                     throws NodeTypeCreationException
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.

Parameters:
session - Repository session
mappingDescriptor - Mapping descriptor object created by jcr-mapping
Throws:
NodeTypeCreationException - NodeTypeCreationException

createNodeTypes

void createNodeTypes(Session session,
                     ClassDescriptor[] classDescriptors)
                     throws NodeTypeCreationException
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.

Parameters:
session - Repository session
classDescriptors - Array of ClassDescriptor objects created by jcr-mapping
Throws:
NodeTypeCreationException - NodeTypeCreationException

createNodeTypesFromMappingFiles

void createNodeTypesFromMappingFiles(Session session,
                                     InputStream[] mappingXmlFiles)
                                     throws NodeTypeCreationException
This method creates JCR node types based on jcr-mapping xml files.

Parameters:
session - Repository session
mappingXmlFiles - InputStreams to jcr-mapping xml files
Throws:
NodeTypeCreationException - NodeTypeCreationException

createSingleNodeType

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

Parameters:
session - Repository session
classDescriptor - ClassDescriptor object created by jcr-mapping
jcrNodeType - Name of the class that needs to be created identified by its jcrNodeType name
Throws:
NodeTypeCreationException - NodeTypeCreationException

createSingleNodeTypeFromMappingFile

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

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

createNodeTypeFromClass

void createNodeTypeFromClass(Session session,
                             Class clazz,
                             String jcrNodeType,
                             boolean reflectSuperClasses)
                             throws NodeTypeCreationException
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.

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

createNodeTypesFromConfiguration

void createNodeTypesFromConfiguration(Session session,
                                      InputStream jcrRepositoryConfigurationFile)
                                      throws OperationNotSupportedException,
                                             NodeTypeCreationException
This method creates JCR node types from a JCR vendor specific configuration file.

Parameters:
session - Repository session
jcrRepositoryXmlConfigurationFile - InputStream to file
Throws:
OperationNotSupportedException - OperationNotSupportedException
NodeTypeCreationException - NodeTypeCreationException

removeNodeTypesFromMappingFile

void removeNodeTypesFromMappingFile(Session session,
                                    InputStream[] mappingXmlFiles)
                                    throws NodeTypeRemovalException
This method removes all JCR node types that are defined in one to many jcr-mapping XML files.

Parameters:
session - Repository session
mappingXmlFiles - InputStreams to jcr-mapping xml file
Throws:
NodeTypeRemovalException - NodeTypeRemovalException

removeNodeTypesFromConfiguration

void removeNodeTypesFromConfiguration(Session session,
                                      InputStream jcrRepositoryConfigurationFile)
                                      throws NodeTypeRemovalException
This method removes JCR node types from a JCR vendor specific configuration file

Parameters:
session - Repository session
jcrRepositoryConfigurationFile - the file that contains the node type definition
Throws:
NodeTypeRemovalException

removeSingleNodeType

void removeSingleNodeType(Session session,
                          String jcrNodeType)
                          throws NodeTypeRemovalException
This method removes a single JCR node type identified by its jcrNodeType name.

Parameters:
session - Repository session
jcrNodeType -
Throws:
NodeTypeRemovalException - NodeTypeRemovalException

getPrimaryNodeTypeNames

List getPrimaryNodeTypeNames(Session session,
                             String namespace)
Returns the names of all node types in the repository identified by a given namespace.

Parameters:
namespace - Name of nodetypes to return
Returns:
list of matching JCR node types

getAllPrimaryNodeTypeNames

List getAllPrimaryNodeTypeNames(Session session)
Returns a list of all JCR node types.

Returns:
list of all JCR node types


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