org.apache.jackrabbit.core.xml
Class SessionImporter

java.lang.Object
  extended by org.apache.jackrabbit.core.xml.SessionImporter
All Implemented Interfaces:
Importer

public class SessionImporter
extends Object
implements Importer

SessionImporter ...


Constructor Summary
SessionImporter(NodeImpl importTargetNode, SessionImpl session, int uuidBehavior)
          Creates a new SessionImporter instance.
SessionImporter(NodeImpl importTargetNode, SessionImpl session, int uuidBehavior, ImportConfig config)
          Creates a new SessionImporter instance.
 
Method Summary
protected  void checkPermission(NodeImpl parent, Name nodeName)
          make sure the editing session is allowed create nodes with a specified node type (and ev. mixins),
NOTE: this check is not executed in a single place as the parent may change in case of IMPORT_UUID_COLLISION_REPLACE_EXISTING.
protected  NodeImpl createNode(NodeImpl parent, Name nodeName, Name nodeTypeName, Name[] mixinNames, NodeId id)
           
protected  void createProperty(NodeImpl node, PropInfo pInfo, QPropertyDefinition def)
           
 void end()
          Called once at the end of the content import.
 void endNode(NodeInfo nodeInfo)
          Called to end the import of a node.
protected  NodeImpl resolveUUIDConflict(NodeImpl parent, NodeImpl conflicting, NodeInfo nodeInfo)
           
 void start()
          Called once at the beginning of the content import.
 void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos)
          Called to start the import of a node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionImporter

public SessionImporter(NodeImpl importTargetNode,
                       SessionImpl session,
                       int uuidBehavior)
Creates a new SessionImporter instance.

Parameters:
importTargetNode - the target node
session - session
uuidBehavior - any of the constants declared by ImportUUIDBehavior

SessionImporter

public SessionImporter(NodeImpl importTargetNode,
                       SessionImpl session,
                       int uuidBehavior,
                       ImportConfig config)
Creates a new SessionImporter instance.

Parameters:
importTargetNode - the target node
session - session
uuidBehavior - the desired uuid behavior as defined by ImportUUIDBehavior.
config -
Method Detail

checkPermission

protected void checkPermission(NodeImpl parent,
                               Name nodeName)
                        throws RepositoryException
make sure the editing session is allowed create nodes with a specified node type (and ev. mixins),
NOTE: this check is not executed in a single place as the parent may change in case of IMPORT_UUID_COLLISION_REPLACE_EXISTING.

Parameters:
parent - parent node
nodeName - the name
Throws:
RepositoryException - if an error occurs

createNode

protected NodeImpl createNode(NodeImpl parent,
                              Name nodeName,
                              Name nodeTypeName,
                              Name[] mixinNames,
                              NodeId id)
                       throws RepositoryException
Throws:
RepositoryException

createProperty

protected void createProperty(NodeImpl node,
                              PropInfo pInfo,
                              QPropertyDefinition def)
                       throws RepositoryException
Throws:
RepositoryException

resolveUUIDConflict

protected NodeImpl resolveUUIDConflict(NodeImpl parent,
                                       NodeImpl conflicting,
                                       NodeInfo nodeInfo)
                                throws RepositoryException
Throws:
RepositoryException

start

public void start()
           throws RepositoryException
Called once at the beginning of the content import.

Specified by:
start in interface Importer
Throws:
RepositoryException - on a repository error

startNode

public void startNode(NodeInfo nodeInfo,
                      List<PropInfo> propInfos)
               throws RepositoryException
Called to start the import of a node. Information about the imported node and all it's properties are passed as arguments. Possible child nodes are imported recursively using this same method until a Importer.endNode(NodeInfo) call is made with the same node information.

Specified by:
startNode in interface Importer
Parameters:
nodeInfo - information about the node being imported
propInfos - information abouth the properties being imported (list of PropInfo instances)
Throws:
RepositoryException - on a repository error

endNode

public void endNode(NodeInfo nodeInfo)
             throws RepositoryException
Called to end the import of a node. This method is called after a Importer.startNode(NodeInfo, List) call with the stame node information and after all the possible child nodes have been imported with respective startNode/endNode calls.

Just like XML elements, the startNode/endNode calls are guaranteed to be properly nested and complete.

Specified by:
endNode in interface Importer
Parameters:
nodeInfo - information about the node being imported
Throws:
RepositoryException - on a repository error

end

public void end()
         throws RepositoryException
Called once at the end of the content import.

Specified by:
end in interface Importer
Throws:
RepositoryException - on a repository error


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