org.modeshape.graph.session
Class GraphSession.LoadNodesVisitor

java.lang.Object
  extended by org.modeshape.graph.session.GraphSession.NodeVisitor<Payload,PropertyPayload>
      extended by org.modeshape.graph.session.GraphSession.LoadNodesVisitor
Direct Known Subclasses:
GraphSession.LoadAllChildrenVisitor
Enclosing class:
GraphSession<Payload,PropertyPayload>

@NotThreadSafe
protected abstract class GraphSession.LoadNodesVisitor
extends GraphSession.NodeVisitor<Payload,PropertyPayload>

An abstract base class for visitors that need to load nodes using a single batch for all read operations. To use, simply subclass and supply a #visit(Node) implementation that calls #load(Node) for each node that is to be loaded. When the visitor is finished, all of these nodes will be read from the store and loaded. The #finishNodeAfterLoading(Node) is called after each node is loaded, allowing the subclass to perform an operation on the newly-loaded nodes.


Constructor Summary
protected GraphSession.LoadNodesVisitor()
           
 
Method Summary
 void finish()
          Method that should be called after all visiting has been done successfully (with no exceptions), including when no nodes were visited.
protected  void finishNodeAfterLoading(GraphSession.Node<Payload,PropertyPayload> node)
          Method that is called on each node loaded by this visitor.
protected  void load(GraphSession.Node<Payload,PropertyPayload> node)
          Method that signals that the supplied node should be loaded (if it is not already loaded).
 
Methods inherited from class org.modeshape.graph.session.GraphSession.NodeVisitor
visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphSession.LoadNodesVisitor

protected GraphSession.LoadNodesVisitor()
Method Detail

load

protected void load(GraphSession.Node<Payload,PropertyPayload> node)
Method that signals that the supplied node should be loaded (if it is not already loaded). This method should be called from within the #visit(Node) method of the subclass.

Parameters:
node - the node that should be loaded (if it is not already)

finish

public void finish()
Method that should be called after all visiting has been done successfully (with no exceptions), including when no nodes were visited.

Overrides:
finish in class GraphSession.NodeVisitor<Payload,PropertyPayload>
See Also:
GraphSession.NodeVisitor.finish()

finishNodeAfterLoading

protected void finishNodeAfterLoading(GraphSession.Node<Payload,PropertyPayload> node)
Method that is called on each node loaded by this visitor. This method does nothing by default.

Parameters:
node - the just-loaded node; never null


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