org.modeshape.graph.io
Class GraphBatchDestination

java.lang.Object
  extended by org.modeshape.graph.io.GraphBatchDestination
All Implemented Interfaces:
Destination

@NotThreadSafe
public class GraphBatchDestination
extends Object
implements Destination

A Destination that makes the changes to a graph via a Graph.Batch.


Field Summary
protected  Graph.Batch batch
           
protected  boolean ignoreSubmit
           
 
Constructor Summary
GraphBatchDestination(Graph.Batch batch)
          Create a new instance that will use the specified batch.
GraphBatchDestination(Graph.Batch batch, boolean ignoreSubmit)
          Create a new instance that will use the specified batch.
 
Method Summary
 void create(Path path, List<Property> properties)
          Create a node at the supplied path and with the supplied attributes.
 void create(Path path, Property firstProperty, Property... additionalProperties)
          Create a node at the supplied path and with the supplied attributes.
protected  NodeConflictBehavior createBehaviorFor(Path path)
          Override this method in a subclass to control the NodeConflictBehavior that should be used when creating the node at the supplied path.
 ExecutionContext getExecutionContext()
          Obtain the execution context of the destination.
 boolean isSubmitIgnored()
          Return whether this instance is ignoring calls to submit().
 void setProperties(Path path, Property... properties)
          Sets the given properties on the node at the supplied path.
 void submit()
          Signal to this destination that any enqueued create requests should be submitted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

batch

protected final Graph.Batch batch

ignoreSubmit

protected final boolean ignoreSubmit
Constructor Detail

GraphBatchDestination

public GraphBatchDestination(Graph.Batch batch)
Create a new instance that will use the specified batch. When submit() is called, the batch will be executed.

Parameters:
batch - the batch
Throws:
IllegalArgumentException - if the batch is null

GraphBatchDestination

public GraphBatchDestination(Graph.Batch batch,
                             boolean ignoreSubmit)
Create a new instance that will use the specified batch. If ignoreSubmit is true, then submit() does nothing (and the batch must be executed}; otherwise, submit() immediately calls the executed.

Parameters:
batch - the batch
ignoreSubmit - true if the submit() method should be ignored, or false otherwise
Throws:
IllegalArgumentException - if the batch is null
Method Detail

isSubmitIgnored

public boolean isSubmitIgnored()
Return whether this instance is ignoring calls to submit().

Returns:
ignoreSubmit

getExecutionContext

public ExecutionContext getExecutionContext()
Obtain the execution context of the destination.

Specified by:
getExecutionContext in interface Destination
Returns:
the destination's execution context
See Also:
Destination.getExecutionContext()

create

public void create(Path path,
                   List<Property> properties)
Create a node at the supplied path and with the supplied attributes. The path will be absolute.

Specified by:
create in interface Destination
Parameters:
path - the absolute path of the node
properties - the properties for the node; never null, but may be empty if there are no properties
See Also:
Destination.create(org.modeshape.graph.property.Path, java.util.List)

create

public void create(Path path,
                   Property firstProperty,
                   Property... additionalProperties)
Create a node at the supplied path and with the supplied attributes. The path will be absolute.

Specified by:
create in interface Destination
Parameters:
path - the absolute path of the node
firstProperty - the first property
additionalProperties - the remaining properties for the node
See Also:
Destination.create(org.modeshape.graph.property.Path, org.modeshape.graph.property.Property, org.modeshape.graph.property.Property[])

setProperties

public void setProperties(Path path,
                          Property... properties)
Sets the given properties on the node at the supplied path. The path will be absolute.

Specified by:
setProperties in interface Destination
Parameters:
path - the absolute path of the node
properties - the remaining properties for the node
See Also:
Destination.setProperties(org.modeshape.graph.property.Path, org.modeshape.graph.property.Property[])

submit

public void submit()
Signal to this destination that any enqueued create requests should be submitted. Usually this happens at the end of the document parsing, but an implementer must allow for it to be called multiple times and anytime during parsing.

Specified by:
submit in interface Destination
See Also:
Destination.submit()

createBehaviorFor

protected NodeConflictBehavior createBehaviorFor(Path path)
Override this method in a subclass to control the NodeConflictBehavior that should be used when creating the node at the supplied path. By default, this method returns null.

Parameters:
path - the path of the new node
Returns:
the conflict behavior, or null if NodeConflictBehavior.UPDATE should be used


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