org.jboss.dna.graph.session
Class GraphSession.NodeOperations<Payload,PropertyPayload>

java.lang.Object
  extended by org.jboss.dna.graph.session.GraphSession.NodeOperations<Payload,PropertyPayload>
Type Parameters:
Payload - the type of node payload object
PropertyPayload - the type of property payload object
All Implemented Interfaces:
GraphSession.Operations<Payload,PropertyPayload>
Enclosing class:
GraphSession<Payload,PropertyPayload>

@ThreadSafe
public static class GraphSession.NodeOperations<Payload,PropertyPayload>
extends Object
implements GraphSession.Operations<Payload,PropertyPayload>

A default implementation of GraphSession.Operations that provides all the basic functionality required by a graph session. In this implementation, only the materialize(...) method does something.


Constructor Summary
GraphSession.NodeOperations()
           
 
Method Summary
 void materialize(Node persistentNode, GraphSession.Node<Payload,PropertyPayload> node)
          Update the node with the information from the persistent store.
 void postCopy(GraphSession.Node<Payload,PropertyPayload> original, GraphSession.Node<Payload,PropertyPayload> copy)
          Notify that an existing child will be copied with the new copy being placed under the supplied parent.
 void postCreateChild(GraphSession.Node<Payload,PropertyPayload> parent, GraphSession.Node<Payload,PropertyPayload> childChild, Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties)
          Notify that a new child has been added to the supplied parent node.
 void postMove(GraphSession.Node<Payload,PropertyPayload> movedNode, GraphSession.Node<Payload,PropertyPayload> oldParent)
          Notify that an existing child has been moved from the supplied previous parent into its new location.
 void postRemoveChild(GraphSession.Node<Payload,PropertyPayload> parent, GraphSession.Node<Payload,PropertyPayload> oldChild)
          Notify that an existing child has been removed from the supplied parent.
 void postRemoveProperty(GraphSession.Node<Payload,PropertyPayload> node, Name propertyName, GraphSession.PropertyInfo<PropertyPayload> oldProperty)
          
 void postSetProperty(GraphSession.Node<Payload,PropertyPayload> node, Name propertyName, GraphSession.PropertyInfo<PropertyPayload> oldProperty)
          
 void postUpdateLocation(GraphSession.Node<Payload,PropertyPayload> node, Location oldLocation)
          Signal that the node's location has been changed
 void preCopy(GraphSession.Node<Payload,PropertyPayload> original, GraphSession.Node<Payload,PropertyPayload> newParent)
          Notify that an existing child will be copied with the new copy being placed under the supplied parent.
 void preCreateChild(GraphSession.Node<Payload,PropertyPayload> parent, Path.Segment newChild, Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties)
          Notify that a new child with the supplied path segment is about to be created.
 void preMove(GraphSession.Node<Payload,PropertyPayload> nodeToBeMoved, GraphSession.Node<Payload,PropertyPayload> newParent)
          Notify that an existing child will be moved from its current parent and placed under the supplied parent.
 void preRemoveChild(GraphSession.Node<Payload,PropertyPayload> parent, GraphSession.Node<Payload,PropertyPayload> newChild)
          Notify that an existing child will be removed from the supplied parent.
 void preRemoveProperty(GraphSession.Node<Payload,PropertyPayload> node, Name propertyName)
          
 void preSave(GraphSession.Node<Payload,PropertyPayload> node)
          Validate a node for consistency and well-formedness.
 void preSetProperty(GraphSession.Node<Payload,PropertyPayload> node, Name propertyName, GraphSession.PropertyInfo<PropertyPayload> newProperty)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphSession.NodeOperations

public GraphSession.NodeOperations()
Method Detail

materialize

public void materialize(Node persistentNode,
                        GraphSession.Node<Payload,PropertyPayload> node)
Update the node with the information from the persistent store.

Specified by:
materialize in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
persistentNode - the persistent node that should be converted into a node info; never null
node - the session's node representation that is to be updated; never null
See Also:
GraphSession.Operations.materialize(org.jboss.dna.graph.Node, GraphSession.Node)

postUpdateLocation

public void postUpdateLocation(GraphSession.Node<Payload,PropertyPayload> node,
                               Location oldLocation)
Signal that the node's location has been changed

Specified by:
postUpdateLocation in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
node - the node with the new location
oldLocation - the old location of the node
See Also:
GraphSession.Operations.postUpdateLocation(GraphSession.Node, org.jboss.dna.graph.Location)

preSave

public void preSave(GraphSession.Node<Payload,PropertyPayload> node)
             throws ValidationException
Validate a node for consistency and well-formedness.

Specified by:
preSave in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
node - the node to be validated
Throws:
ValidationException - if there is a problem during validation
See Also:
GraphSession.Operations.preSave(GraphSession.Node)

preSetProperty

public void preSetProperty(GraphSession.Node<Payload,PropertyPayload> node,
                           Name propertyName,
                           GraphSession.PropertyInfo<PropertyPayload> newProperty)
                    throws ValidationException

Specified by:
preSetProperty in interface GraphSession.Operations<Payload,PropertyPayload>
Throws:
ValidationException
See Also:
org.jboss.dna.graph.session.GraphSession.Operations#preSetProperty(Node, Name, PropertyInfo)

postSetProperty

public void postSetProperty(GraphSession.Node<Payload,PropertyPayload> node,
                            Name propertyName,
                            GraphSession.PropertyInfo<PropertyPayload> oldProperty)

Specified by:
postSetProperty in interface GraphSession.Operations<Payload,PropertyPayload>
See Also:
org.jboss.dna.graph.session.GraphSession.Operations#postSetProperty(Node, Name, PropertyInfo)

preRemoveProperty

public void preRemoveProperty(GraphSession.Node<Payload,PropertyPayload> node,
                              Name propertyName)
                       throws ValidationException

Specified by:
preRemoveProperty in interface GraphSession.Operations<Payload,PropertyPayload>
Throws:
ValidationException
See Also:
org.jboss.dna.graph.session.GraphSession.Operations#preRemoveProperty(Node, Name)

postRemoveProperty

public void postRemoveProperty(GraphSession.Node<Payload,PropertyPayload> node,
                               Name propertyName,
                               GraphSession.PropertyInfo<PropertyPayload> oldProperty)

Specified by:
postRemoveProperty in interface GraphSession.Operations<Payload,PropertyPayload>
See Also:
org.jboss.dna.graph.session.GraphSession.Operations#postRemoveProperty(Node, Name, PropertyInfo)

preCreateChild

public void preCreateChild(GraphSession.Node<Payload,PropertyPayload> parent,
                           Path.Segment newChild,
                           Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties)
                    throws ValidationException
Notify that a new child with the supplied path segment is about to be created. When this method is called, the child has not yet been added to the parent node.

Specified by:
preCreateChild in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
parent - the parent node; never null
newChild - the path segment for the new child; never null
properties - the initial properties for the new child, which can be manipulated directly; never null
Throws:
ValidationException - if the parent may not have a child with the supplied name and the creation of the new node should be aborted
See Also:
GraphSession.Operations.preCreateChild(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.property.Path.Segment, java.util.Map)

postCreateChild

public void postCreateChild(GraphSession.Node<Payload,PropertyPayload> parent,
                            GraphSession.Node<Payload,PropertyPayload> childChild,
                            Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties)
                     throws ValidationException
Notify that a new child has been added to the supplied parent node. The child may have an initial set of properties specified at creation time, although none of the PropertyInfo objects will have a payload.

Specified by:
postCreateChild in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
parent - the parent node; never null
childChild - the child that was just added to the parent node; never null
properties - the properties of the child, which can be manipulated directly; never null
Throws:
ValidationException - if the parent and child are not valid and the creation of the new node should be aborted
See Also:
GraphSession.Operations.postCreateChild(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node, java.util.Map)

preCopy

public void preCopy(GraphSession.Node<Payload,PropertyPayload> original,
                    GraphSession.Node<Payload,PropertyPayload> newParent)
             throws ValidationException
Notify that an existing child will be copied with the new copy being placed under the supplied parent. When this method is called, the copy has not yet been performed.

Specified by:
preCopy in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
original - the existing node that is to be copied; never null
newParent - the parent node where the copy is to be placed; never null
Throws:
ValidationException - if the copy is not valid
See Also:
GraphSession.Operations.preCopy(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)

postCopy

public void postCopy(GraphSession.Node<Payload,PropertyPayload> original,
                     GraphSession.Node<Payload,PropertyPayload> copy)
              throws ValidationException
Notify that an existing child will be copied with the new copy being placed under the supplied parent. When this method is called, the copy has been performed, but the new copy will not be loaded nor will be capable of being loaded.

Specified by:
postCopy in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
original - the original node that was copied; never null
copy - the new copy that was made; never null
Throws:
ValidationException
See Also:
GraphSession.Operations.postCopy(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)

preMove

public void preMove(GraphSession.Node<Payload,PropertyPayload> nodeToBeMoved,
                    GraphSession.Node<Payload,PropertyPayload> newParent)
             throws ValidationException
Notify that an existing child will be moved from its current parent and placed under the supplied parent. When this method is called, the child node has not yet been moved.

Specified by:
preMove in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
nodeToBeMoved - the existing node that is to be moved from its current parent to the supplied parent; never null
newParent - the new parent node; never null
Throws:
ValidationException - if the child should not be moved
See Also:
GraphSession.Operations.preMove(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)

postMove

public void postMove(GraphSession.Node<Payload,PropertyPayload> movedNode,
                     GraphSession.Node<Payload,PropertyPayload> oldParent)
Notify that an existing child has been moved from the supplied previous parent into its new location. When this method is called, the child node has been moved and any same-name-siblings that were after the child in the old parent have had their SNS indexes adjusted.

Specified by:
postMove in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
movedNode - the existing node that is was moved; never null
oldParent - the old parent node; never null
See Also:
GraphSession.Operations.postMove(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)

preRemoveChild

public void preRemoveChild(GraphSession.Node<Payload,PropertyPayload> parent,
                           GraphSession.Node<Payload,PropertyPayload> newChild)
                    throws ValidationException
Notify that an existing child will be removed from the supplied parent. When this method is called, the child node has not yet been removed.

Specified by:
preRemoveChild in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
parent - the parent node; never null
newChild - the child that is to be removed from the parent node; never null
Throws:
ValidationException - if the child should not be removed from the parent node
See Also:
GraphSession.Operations.preRemoveChild(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)

postRemoveChild

public void postRemoveChild(GraphSession.Node<Payload,PropertyPayload> parent,
                            GraphSession.Node<Payload,PropertyPayload> oldChild)
Notify that an existing child has been removed from the supplied parent. When this method is called, the child node has been removed and any same-name-siblings following the child have had their SNS indexes adjusted. Additionally, the removed child no longer has a parent and is considered stale.

Specified by:
postRemoveChild in interface GraphSession.Operations<Payload,PropertyPayload>
Parameters:
parent - the parent node; never null
oldChild - the child that is to be removed from the parent node; never null
See Also:
GraphSession.Operations.postRemoveChild(org.jboss.dna.graph.session.GraphSession.Node, org.jboss.dna.graph.session.GraphSession.Node)


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