ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr.cache.document
Class SessionNode.DeepCopy

java.lang.Object
  extended by org.modeshape.jcr.cache.document.SessionNode.DeepCopy
Direct Known Subclasses:
SessionNode.DeepClone
Enclosing class:
SessionNode

protected class SessionNode.DeepCopy
extends Object


Field Summary
protected  Map<NodeKey,NodeKey> linkedPlaceholdersToOriginal
           
protected  PropertyFactory propertyFactory
           
protected  SessionCache sourceCache
           
protected  CachedNode sourceNode
           
protected  Map<NodeKey,NodeKey> sourceToTargetKeys
           
protected  Path startingPathInSource
           
protected  WritableSessionCache targetCache
           
protected  SessionNode targetNode
           
protected  String targetWorkspaceKey
           
 
Constructor Summary
protected SessionNode.DeepCopy(SessionNode targetNode, WritableSessionCache cache, CachedNode sourceNode, SessionCache sourceCache)
           
 
Method Summary
protected  void copyProperties(MutableCachedNode targetNode, CachedNode sourceNode)
           
protected  NodeKey createTargetKeyFor(NodeKey sourceKey, NodeKey parentKeyInTarget)
           
protected  void doPhase1(MutableCachedNode targetNode, CachedNode sourceNode)
          Perform a copy of the source tree to create a similar tree in the target session.
protected  void doPhase2()
          This leaves any linked placeholders that failed in the map.
 void execute()
           
protected  String getOperationName()
           
 Map<NodeKey,NodeKey> getSourceToTargetKeys()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

targetCache

protected final WritableSessionCache targetCache

targetNode

protected final SessionNode targetNode

sourceCache

protected final SessionCache sourceCache

sourceNode

protected final CachedNode sourceNode

startingPathInSource

protected final Path startingPathInSource

propertyFactory

protected final PropertyFactory propertyFactory

targetWorkspaceKey

protected final String targetWorkspaceKey

linkedPlaceholdersToOriginal

protected final Map<NodeKey,NodeKey> linkedPlaceholdersToOriginal

sourceToTargetKeys

protected final Map<NodeKey,NodeKey> sourceToTargetKeys
Constructor Detail

SessionNode.DeepCopy

protected SessionNode.DeepCopy(SessionNode targetNode,
                               WritableSessionCache cache,
                               CachedNode sourceNode,
                               SessionCache sourceCache)
Method Detail

getSourceToTargetKeys

public Map<NodeKey,NodeKey> getSourceToTargetKeys()

execute

public void execute()

doPhase1

protected void doPhase1(MutableCachedNode targetNode,
                        CachedNode sourceNode)
Perform a copy of the source tree to create a similar tree in the target session. Note that copying linked nodes varies depending upon where the linked nodes are relative to the source tree.
  1. If the linked nodes and the original node are all in the source tree being copied, then the result of the copy will contain a copy of the original and links to the new copy.
  2. If the original node is not within the source tree being copied, then the result of the copy will contain links to the original node.
The result of phase 1 will have either created the links correctly or will have add placeholders in the target tree representing where the linked children should exist. Such placeholders will be handled in phase 2.

Parameters:
targetNode - the (empty) target node that should be made to look like the supplied source node; may not be null
sourceNode - the original node that should be copied; may not be null

createTargetKeyFor

protected NodeKey createTargetKeyFor(NodeKey sourceKey,
                                     NodeKey parentKeyInTarget)

doPhase2

protected void doPhase2()
This leaves any linked placeholders that failed in the map.


copyProperties

protected void copyProperties(MutableCachedNode targetNode,
                              CachedNode sourceNode)

toString

public String toString()
Overrides:
toString in class Object

getOperationName

protected String getOperationName()

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.