org.apache.jackrabbit.commons.cnd
Class CndImporter

java.lang.Object
  extended by org.apache.jackrabbit.commons.cnd.CndImporter

public final class CndImporter
extends Object

Utility class for importing compact node type definitions.

See Also:
CompactNodeTypeDefReader, TemplateBuilderFactory

Method Summary
static NodeType[] registerNodeTypes(Reader cnd, Session session)
          Shortcut for registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(), wsp.getNamespaceRegistry(), session.getValueFactory(), false); where wsp is the workspace of the session passed.
static NodeType[] registerNodeTypes(Reader cnd, Session session, boolean reregisterExisting)
          Shortcut for registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(), wsp.getNamespaceRegistry(), session.getValueFactory(), reregisterExisting); where wsp is the workspace of the session passed.
static NodeType[] registerNodeTypes(Reader cnd, String systemId, NodeTypeManager nodeTypeManager, NamespaceRegistry namespaceRegistry, ValueFactory valueFactory, boolean reregisterExisting)
          Registers nodetypes in cnd format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerNodeTypes

public static NodeType[] registerNodeTypes(Reader cnd,
                                           Session session)
                                    throws InvalidNodeTypeDefinitionException,
                                           NodeTypeExistsException,
                                           UnsupportedRepositoryOperationException,
                                           ParseException,
                                           RepositoryException,
                                           IOException
Shortcut for
   registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(),
          wsp.getNamespaceRegistry(), session.getValueFactory(), false);
 
where wsp is the workspace of the session passed.

Parameters:
cnd -
session - the session to use for registering the node types
Returns:
the registered node types
Throws:
InvalidNodeTypeDefinitionException
NodeTypeExistsException
UnsupportedRepositoryOperationException
ParseException
RepositoryException
IOException
See Also:
registerNodeTypes(Reader, String, NodeTypeManager, NamespaceRegistry, ValueFactory, boolean)

registerNodeTypes

public static NodeType[] registerNodeTypes(Reader cnd,
                                           Session session,
                                           boolean reregisterExisting)
                                    throws InvalidNodeTypeDefinitionException,
                                           NodeTypeExistsException,
                                           UnsupportedRepositoryOperationException,
                                           ParseException,
                                           RepositoryException,
                                           IOException
Shortcut for
   registerNodeTypes(cnd, "cnd input stream", wsp.getNodeTypeManager(),
          wsp.getNamespaceRegistry(), session.getValueFactory(), reregisterExisting);
 
where wsp is the workspace of the session passed.

Parameters:
cnd -
session - the session to use for registering the node types
reregisterExisting - true if existing node types should be re-registered with those present in the cnd. false otherwise.
Returns:
the registered node types
Throws:
InvalidNodeTypeDefinitionException
NodeTypeExistsException
UnsupportedRepositoryOperationException
ParseException
RepositoryException
IOException
See Also:
registerNodeTypes(Reader, String, NodeTypeManager, NamespaceRegistry, ValueFactory, boolean)

registerNodeTypes

public static NodeType[] registerNodeTypes(Reader cnd,
                                           String systemId,
                                           NodeTypeManager nodeTypeManager,
                                           NamespaceRegistry namespaceRegistry,
                                           ValueFactory valueFactory,
                                           boolean reregisterExisting)
                                    throws ParseException,
                                           InvalidNodeTypeDefinitionException,
                                           NodeTypeExistsException,
                                           UnsupportedRepositoryOperationException,
                                           RepositoryException,
                                           IOException
Registers nodetypes in cnd format.

Parameters:
cnd - a reader to the cnd. The reader is closed on return.
systemId - a informative id of the given cnd input.
nodeTypeManager - the NodeTypeManager used for creating and registering the NodeTypeTemplates, NodeDefinitionTemplates and PropertyDefinitionTemplates defined in the cnd.
namespaceRegistry - the NamespaceRegistry used for registering namespaces defined in the cnd.
valueFactory - the ValueFactory used to create default value(s).
reregisterExisting - true if existing node types should be re-registered with those present in the cnd. false otherwise.
Returns:
the registered node types
Throws:
ParseException - if the cnd cannot be parsed
InvalidNodeTypeDefinitionException - if a NodeTypeDefinition is invalid.
NodeTypeExistsException - if reregisterExisting is false and a NodeTypeDefinition specifies a node type name that is already registered.
UnsupportedRepositoryOperationException - if the NodeTypeManager does not support node type registration.
IOException - if closing the cnd reader fails
RepositoryException - if another error occurs.


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.