org.jboss.dna.graph
Class Graph

java.lang.Object
  extended by org.jboss.dna.graph.Graph

@NotThreadSafe
public class Graph
extends Object

A graph representation of the content within a RepositorySource, including mechanisms to interact and manipulate that content. The graph is designed to be an embedded domain specific language, meaning calls to it are designed to read like sentences even though they are really just Java methods. And to be more readable, methods can be chained together.


Nested Class Summary
static interface Graph.AddValue<Next>
          The interface for defining the node on which an addValue(Object) operation applies and what additional values (if any) should be added.
 class Graph.AddValueAction<T>
           
static interface Graph.And<Next>
          A interface that is used to add more locations that are to be copied/moved.
static interface Graph.AsChild<Next>
          A component that defines a new child name for a node.
static interface Graph.AsName<Next>
          A component that defines a new name for a node.
static interface Graph.At<Next>
          The interface for defining the node upon which which a request operates.
static interface Graph.BaseResults<NodeType extends Node>
          A set of nodes returned from a graph, with methods to access the properties and children of the nodes in the result.
 class Graph.Batch
          Interface for creating multiple requests to perform various operations.
static interface Graph.BatchConjunction
           
static interface Graph.Before<Next>
          A component that defines the location before which a node should be copied or moved.
static interface Graph.BlockOfChildren<Next>
          A component used to specify a block of children starting either at a particular index or after a previous sibling.
static interface Graph.Children<Next>
          A component used to supply the details for getting children of another node.
static interface Graph.Clone<Next>
          The interface for defining a branch of nodes to be cloned and the location where the clone is to be placed.
 class Graph.CloneAction<T>
           
 class Graph.CloneTargetAction<T>
           
static interface Graph.Conjunction<Next>
          A interface that can be used to finish the current request and start another.
static interface Graph.Copy<Next>
          The interface for defining additional nodes to be copied and the locations where the copy is to be placed.
static interface Graph.CopyTarget<Next>
           
static interface Graph.Create<Next>
          The interface for defining additional properties on a new node.
static interface Graph.CreateAt<Next>
          The interface for defining additional properties on a new node.
static interface Graph.CreateNode<Next>
          A component that defines a node that is to be created.
static interface Graph.CreateNodeNamed<Next>
          A component that defines a node that is to be created.
static interface Graph.CreateWorkspace
          The interface used to create a new workspace.
static interface Graph.Executable<NodeType extends Node>
          A interface used to execute the accumulated requests.
static interface Graph.FromName<Next>
          A component that defines the name of a property from which a value should be removed.
static interface Graph.FromWorkspace<Next>
          The interface for specifying that a node should come from a workspace other than the current workspace.
static interface Graph.GetNodeConjunction<Next>
           
static interface Graph.ImportInto<Next>
          A component that defines the location into which a node should be copied or moved.
static interface Graph.Into<Next>
          A component that defines the location into which a node should be copied or moved.
static interface Graph.Move<Next>
          The interface for defining additional nodes to be moved and the parent into which the node(s) are to be moved.
static interface Graph.NameWorkspace
          The interface used to specify the name of a new workspace.
static interface Graph.Of<Next>
          The interface for defining the node upon which a request operates.
static interface Graph.On<Next>
          The interface for defining the node upon which a request operates.
static interface Graph.RemoveValue<Next>
          The interface for defining the node on which an removeValue(Object) operation applies and what additional values (if any) should be removed.
 class Graph.RemoveValueAction<T>
           
static interface Graph.SetValues<Next>
          A component used to set the values on a property.
static interface Graph.SetValuesTo<Next>
          A component used to set the values on a property.
static interface Graph.To<Next>
          A component that defines the location to which a node should be copied or moved.
static interface Graph.ToName<Next>
          A component that defines the name of a property to which a value should be added.
static interface Graph.Under<Next>
          The interface for defining the node under which which a request operates.
static interface Graph.WithUuids<Next>
          The interface for specifying how UUID conflicts should be handled.
 
Method Summary
 Graph.AddValue<Graph> addValue(Object value)
           
 Graph.Batch batch()
          Begin a batch of requests to perform various operations.
 Graph.Batch batch(BatchRequestBuilder builder)
          Begin a batch of requests to perform various operations, but specify the queue where all accumulated requests should be placed.
 Graph.Clone<Graph> clone(Location from)
          Begin the request to clone a node at the specified location into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(Node from)
          Begin the request to clone the specified node into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(Path from)
          Begin the request to clone a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(Property idProperty)
          Begin the request to clone a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(Property firstIdProperty, Property... additionalIdProperties)
          Begin the request to clone a node with the specified identification properties into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(String fromPath)
          Begin the request to clone a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Clone<Graph> clone(UUID from)
          Begin the request to clone a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(Location from)
          Begin the request to copy a node at the specified location into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(Node from)
          Begin the request to copy the specified node into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(Path from)
          Begin the request to copy a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(Property idProperty)
          Begin the request to copy a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(Property firstIdProperty, Property... additionalIdProperties)
          Begin the request to copy a node with the specified identification properties into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(String fromPath)
          Begin the request to copy a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Copy<Graph> copy(UUID from)
          Begin the request to copy a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...)
 Graph.Create<Graph> create(Path at)
          Begin the request to create a node located at the supplied path.
 Graph.Create<Graph> create(Path at, Iterable<Property> properties)
          Begin the request to create a node located at the supplied path.
 Graph.Create<Graph> create(Path at, Property property)
          Begin the request to create a node located at the supplied path.
 Graph.Create<Graph> create(Path at, Property firstProperty, Property... additionalProperties)
          Begin the request to create a node located at the supplied path.
static Graph create(RepositoryConnection connection, ExecutionContext context)
          Create a graph instance that uses the supplied RepositoryConnection and context.
static Graph create(RepositorySource source, ExecutionContext context)
          Create a graph instance that uses the supplied RepositoryConnection and context.
 Graph.Create<Graph> create(String atPath)
          Begin the request to create a node located at the supplied path.
 Graph.Create<Graph> create(String atPath, Property property)
          Begin the request to create a node located at the supplied path.
 Graph.Create<Graph> create(String atPath, Property firstProperty, Property... additionalProperties)
          Begin the request to create a node located at the supplied path.
static Graph create(String sourceName, RepositoryConnectionFactory connectionFactory, ExecutionContext context)
          Create a graph instance that uses the supplied repository and context.
 Graph.CreateAt<Graph> createAt(Path at)
          Begin the request to create a node located at the supplied path, and return an interface used to either add properties for the new node, or complete/submit the request and return the location, node, or graph.
 Graph.CreateAt<Graph> createAt(String atPath)
          Begin the request to create a node located at the supplied path, and return an interface used to either add properties for the new node, or complete/submit the request and return the location, node, or graph.
 Graph.CreateNode<Graph.Conjunction<Graph>> createUnder(Location parent)
          Begin the request to create a node under the existing parent node at the supplied location.
 Graph.CreateWorkspace createWorkspace()
          Create a new workspace in the source used by this graph.
 Graph.Conjunction<Graph> delete(Location at)
          Request to delete the node at the given location.
 Graph.Conjunction<Graph> delete(Node at)
          Request to delete the specified node.
 Graph.Conjunction<Graph> delete(Path at)
          Request to delete the node at the given path.
 Graph.Conjunction<Graph> delete(Property idProperty)
          Request to delete the node with the given unique identification property.
 Graph.Conjunction<Graph> delete(Property firstIdProperty, Property... additionalIdProperties)
          Request to delete the node with the given identification properties.
 Graph.Conjunction<Graph> delete(String atPath)
          Request to delete the node at the given path.
 Graph.Conjunction<Graph> delete(UUID at)
          Request to delete the node with the given UUID.
 Graph.Children<List<Location>> getChildren()
          Request that the children be read on the node defined via the of(...)
 RepositoryConnectionFactory getConnectionFactory()
          Get the RepositoryConnectionFactory that this graph uses to create repository connections.
 ExecutionContext getContext()
          Get the context of execution within which operations on this graph are performed.
 Workspace getCurrentWorkspace()
          Get the name of the current workspace being used by this graph.
 String getCurrentWorkspaceName()
          Get the name of the current workspace being used by this graph.
 CachePolicy getDefaultCachePolicy()
          Get the default cache policy for this graph.
 Node getNodeAt(Iterable<Property> idProperties)
          Request to read the node with the supplied unique identifier properties.
 Node getNodeAt(Location location)
          Request to read the node at the supplied location.
 Node getNodeAt(Path path)
          Request to read the node at the supplied path.
 Node getNodeAt(Property idProperty)
          Request to read the node with the supplied unique identifier property.
 Node getNodeAt(Property firstIdProperty, Property... additionalIdProperties)
          Request to read the node with the supplied unique identifier properties.
 Node getNodeAt(String path)
          Request to read the node at the supplied path.
 Node getNodeAt(UUID uuid)
          Request to read the node with the supplied UUID.
 Graph.On<Collection<Property>> getProperties()
          Request that the properties be read on the node defined via the on(...)
 Graph.On<Map<Name,Property>> getPropertiesByName()
          Request that the properties be read on the node defined via the on(...)
 Graph.On<Property> getProperty(Name name)
          Request that the property with the given name be read on the node defined via the on(...)
 Graph.On<Property> getProperty(String name)
          Request that the property with the given name be read on the node defined via the on(...)
 String getSourceName()
          The name of the repository that will be used by this graph.
 Graph.At<Subgraph> getSubgraphOfDepth(int depth)
          Request to read a subgraph of the specified depth, rooted at a location that will be specified via at(...)
 Set<String> getWorkspaces()
          Get the set of workspace names that are known to this source and accessible by this context.
 Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(File file)
          Import the content from the XML file at the supplied file, specifying via the returned object where the content is to be imported.
 Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(InputStream stream)
          Import the content from the provided stream of XML data, specifying via the returned object where the content is to be imported.
 Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(String pathToFile)
          Import the content from the XML file at the supplied file location, specifying via the returned object where the content is to be imported.
 Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(URI uri)
          Import the content from the XML file at the supplied URI, specifying via the returned object where the content is to be imported.
 Graph.Move<Graph.Conjunction<Graph>> move(Location from)
          Begin the request to move a node at the specified location into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(Node from)
          Begin the request to move the specified node into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(Path from)
          Begin the request to move a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(Property idProperty)
          Begin the request to move a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(Property firstIdProperty, Property... additionalIdProperties)
          Begin the request to move a node with the specified identification properties into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(String fromPath)
          Begin the request to move a node located at the supplied path into a parent node at a different location, which is specified via the into(...)
 Graph.Move<Graph.Conjunction<Graph>> move(UUID from)
          Begin the request to move a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...)
 Graph.On<Graph.Conjunction<Graph>> remove(Name... propertyNames)
          Remove properties from the node at the given location.
 Graph.On<Graph.Conjunction<Graph>> remove(String... propertyNames)
          Remove properties from the node at the given location.
 Graph.RemoveValue<Graph> removeValue(Object value)
           
 Node resolve(Reference reference)
          Request to read the node given by the supplied reference value.
 Graph.SetValues<Graph.Conjunction<Graph>> set(Name propertyName)
          Set a property on a node, starting with the name.
 Graph.On<Graph.Conjunction<Graph>> set(Property... properties)
          Set the properties on a node.
 Graph.SetValues<Graph.Conjunction<Graph>> set(String propertyName)
          Set a property on a node, starting with the name.
 Workspace useWorkspace(String workspaceName)
          Switch this graph to use another existing workspace in the same source.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Graph create(String sourceName,
                           RepositoryConnectionFactory connectionFactory,
                           ExecutionContext context)
Create a graph instance that uses the supplied repository and context.

Parameters:
sourceName - the name of the source that should be used
connectionFactory - the factory of repository connections
context - the context in which all executions should be performed
Returns:
the new graph
Throws:
IllegalArgumentException - if the source or context parameters are null
RepositorySourceException - if a source with the supplied name does not exist

create

public static Graph create(RepositoryConnection connection,
                           ExecutionContext context)
Create a graph instance that uses the supplied RepositoryConnection and context.

Parameters:
connection - the connection that should be used
context - the context in which all executions should be performed
Returns:
the new graph
Throws:
IllegalArgumentException - if the connection or context parameters are null

create

public static Graph create(RepositorySource source,
                           ExecutionContext context)
Create a graph instance that uses the supplied RepositoryConnection and context.

Parameters:
source - the source that should be used
context - the context in which all executions should be performed
Returns:
the new graph
Throws:
IllegalArgumentException - if the connection or context parameters are null

getConnectionFactory

public RepositoryConnectionFactory getConnectionFactory()
Get the RepositoryConnectionFactory that this graph uses to create repository connections.

Returns:
the factory repository connections used by this graph; never null

getSourceName

public String getSourceName()
The name of the repository that will be used by this graph. This name is passed to the connection factory when this graph needs to obtain a repository connection.

Returns:
the name of the source

getContext

public ExecutionContext getContext()
Get the context of execution within which operations on this graph are performed.

Returns:
the execution context; never null

getDefaultCachePolicy

public CachePolicy getDefaultCachePolicy()
Get the default cache policy for this graph. May be null if such a policy has not been defined for thie source.

Returns:
the default cache policy, or null if no such policy has been defined for the source
Throws:
RepositorySourceException - if no repository source with the name could be found

getCurrentWorkspaceName

public String getCurrentWorkspaceName()
Get the name of the current workspace being used by this graph. If the graph has not yet been instructed to use or create a workspace, this method will assume that the source's default workspace is to be used and will obtain from the source the name of that default workspace.

Returns:
the name of the current workspace; never null
See Also:
getCurrentWorkspace()

getCurrentWorkspace

public Workspace getCurrentWorkspace()
Get the name of the current workspace being used by this graph. If the graph has not yet been instructed to use or create a workspace, this method will assume that the source's default workspace is to be used and will obtain from the source the name of that default workspace. If the source does not have a default workspace, this method will fail with an InvalidWorkspaceException.

Returns:
the name of the current workspace; never null
Throws:
InvalidWorkspaceException - if there is no current workspace
See Also:
getCurrentWorkspaceName()

getWorkspaces

public Set<String> getWorkspaces()
Get the set of workspace names that are known to this source and accessible by this context.

Returns:
the set of workspace names; never null

useWorkspace

public Workspace useWorkspace(String workspaceName)
Switch this graph to use another existing workspace in the same source.

Parameters:
workspaceName - the name of the existing workspace that this graph should begin using, or null if the graph should use the "default" workspace in the source (if there is one)
Returns:
the workspace; never null
Throws:
InvalidWorkspaceException - if the workspace with the supplied name does not exist, or if null is supplied as the workspace name but the source does not have a default workspace

createWorkspace

public Graph.CreateWorkspace createWorkspace()
Create a new workspace in the source used by this graph. This graph's workspace will be set as soon as the new workspace is created, and all subsequent operations will use the new workspace (until it is changed again by using another workspace or creating another.

Returns:
the interface used to complete the request to create a new workspace; never null

move

public Graph.Move<Graph.Conjunction<Graph>> move(Node from)
Begin the request to move the specified node into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
from - the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(Location from)
Begin the request to move a node at the specified location into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
from - the location of the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(String fromPath)
Begin the request to move a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
fromPath - the path to the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(Path from)
Begin the request to move a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
from - the path to the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(UUID from)
Begin the request to move a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
from - the UUID of the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(Property idProperty)
Begin the request to move a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object. The identification property should uniquely identify a single node.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
idProperty - the unique identification property of the node that is to be moved.
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

move

public Graph.Move<Graph.Conjunction<Graph>> move(Property firstIdProperty,
                                                 Property... additionalIdProperties)
Begin the request to move a node with the specified identification properties into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Move object. The identification properties should uniquely identify a single node.

Like all other methods on the Graph, the move request will be performed immediately when the into(...) method is called.

Parameters:
firstIdProperty - the first identification property of the node that is to be moved
additionalIdProperties - the remaining identification properties of the node that is to be moved
Returns:
the object that can be used to specify addition nodes to be moved or the location of the node where the node is to be moved

clone

public Graph.Clone<Graph> clone(Location from)
Begin the request to clone a node at the specified location into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
from - the location of the node that is to be cloned.
Returns:
the object that can be used to specify the location of the node where the node is to be cloned

clone

public Graph.Clone<Graph> clone(Node from)
Begin the request to clone the specified node into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
from - the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

clone

public Graph.Clone<Graph> clone(String fromPath)
Begin the request to clone a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
fromPath - the path to the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

clone

public Graph.Clone<Graph> clone(Path from)
Begin the request to clone a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
from - the path to the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

clone

public Graph.Clone<Graph> clone(UUID from)
Begin the request to clone a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
from - the UUID of the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

clone

public Graph.Clone<Graph> clone(Property idProperty)
Begin the request to clone a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object. The identification property should uniquely identify a single node.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
idProperty - the unique identification property of the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

clone

public Graph.Clone<Graph> clone(Property firstIdProperty,
                                Property... additionalIdProperties)
Begin the request to clone a node with the specified identification properties into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Clone object. The identification properties should uniquely identify a single node.

Like all other methods on the Graph, the clone request will be performed immediately when the UUID behavior is specified.

The clone operation differs from the copy operation in that it must replicate nodes from one workspace to another (the copy operations supports replicating nodes within a workspace as well as across workspaces) and that it preserves UUIDs (the copy operation always generates new UUIDs).

Parameters:
firstIdProperty - the first identification property of the node that is to be copied
additionalIdProperties - the remaining identification properties of the node that is to be copied
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(Node from)
Begin the request to copy the specified node into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
from - the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(Location from)
Begin the request to copy a node at the specified location into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
from - the location of the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(String fromPath)
Begin the request to copy a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
fromPath - the path to the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(Path from)
Begin the request to copy a node located at the supplied path into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
from - the path to the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(UUID from)
Begin the request to copy a node with the specified unique identifier into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
from - the UUID of the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(Property idProperty)
Begin the request to copy a node with the specified unique identification property into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object. The identification property should uniquely identify a single node.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
idProperty - the unique identification property of the node that is to be copied.
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

copy

public Graph.Copy<Graph> copy(Property firstIdProperty,
                              Property... additionalIdProperties)
Begin the request to copy a node with the specified identification properties into a parent node at a different location, which is specified via the into(...) method on the returned Graph.Copy object. The identification properties should uniquely identify a single node.

Like all other methods on the Graph, the copy request will be performed immediately when the into(...) method is called.

Parameters:
firstIdProperty - the first identification property of the node that is to be copied
additionalIdProperties - the remaining identification properties of the node that is to be copied
Returns:
the object that can be used to specify addition nodes to be copied or the location of the node where the node is to be copied

delete

public Graph.Conjunction<Graph> delete(Node at)
Request to delete the specified node. This request is submitted to the repository immediately.

Parameters:
at - the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(Location at)
Request to delete the node at the given location. This request is submitted to the repository immediately.

Parameters:
at - the location of the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(String atPath)
Request to delete the node at the given path. This request is submitted to the repository immediately.

Parameters:
atPath - the path of the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(Path at)
Request to delete the node at the given path. This request is submitted to the repository immediately.

Parameters:
at - the path of the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(UUID at)
Request to delete the node with the given UUID. This request is submitted to the repository immediately.

Parameters:
at - the UUID of the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(Property idProperty)
Request to delete the node with the given unique identification property. This request is submitted to the repository immediately.

Parameters:
idProperty - the unique identifying property of the node that is to be deleted
Returns:
an object that may be used to start another request

delete

public Graph.Conjunction<Graph> delete(Property firstIdProperty,
                                       Property... additionalIdProperties)
Request to delete the node with the given identification properties. The identification properties should uniquely identify a single node. This request is submitted to the repository immediately.

Parameters:
firstIdProperty - the first identification property of the node that is to be copied
additionalIdProperties - the remaining identification properties of the node that is to be copied
Returns:
an object that may be used to start another request

createAt

public Graph.CreateAt<Graph> createAt(String atPath)
Begin the request to create a node located at the supplied path, and return an interface used to either add properties for the new node, or complete/submit the request and return the location, node, or graph.

If you have the Location of the parent (for the new node) from a previous request, it is better and more efficient to use createUnder(Location). However, this method work just as well if all you have is the Path to the parent or new node.

Parameters:
atPath - the path to the node that is to be created.
Returns:
an object that may be used to start another request

createAt

public Graph.CreateAt<Graph> createAt(Path at)
Begin the request to create a node located at the supplied path, and return an interface used to either add properties for the new node, or complete/submit the request and return the location, node, or graph.

If you have the Location of the parent (for the new node) from a previous request, it is better and more efficient to use createUnder(Location). However, this method work just as well if all you have is the Path to the parent or new node.

Parameters:
at - the path to the node that is to be created.
Returns:
an object that may be used to start another request

create

public Graph.Create<Graph> create(String atPath)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
atPath - the path to the node that is to be created.
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public Graph.Create<Graph> create(String atPath,
                                  Property property)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
atPath - the path to the node that is to be created.
property - a property for the new node
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public Graph.Create<Graph> create(String atPath,
                                  Property firstProperty,
                                  Property... additionalProperties)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
atPath - the path to the node that is to be created.
firstProperty - a property for the new node
additionalProperties - additional properties for the new node
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public final Graph.Create<Graph> create(Path at)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
at - the path to the node that is to be created.
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public Graph.Create<Graph> create(Path at,
                                  Iterable<Property> properties)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
at - the path to the node that is to be created.
properties - the iterator over the properties for the new node
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public Graph.Create<Graph> create(Path at,
                                  Property property)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
at - the path to the node that is to be created.
property - a property for the new node
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

create

public Graph.Create<Graph> create(Path at,
                                  Property firstProperty,
                                  Property... additionalProperties)
Begin the request to create a node located at the supplied path.

Like all other methods on the Graph, the request will be performed when the no-argument Graph.Conjunction.and() method is called.

Parameters:
at - the path to the node that is to be created.
firstProperty - a property for the new node
additionalProperties - additional properties for the new node
Returns:
the object that can be used to specify addition properties for the new node to be copied or the location of the node where the node is to be created

createUnder

public Graph.CreateNode<Graph.Conjunction<Graph>> createUnder(Location parent)
Begin the request to create a node under the existing parent node at the supplied location. Use this method if you are creating a node when you have the Location of a parent from a previous request.

Like all other methods on the Graph, the copy request will be performed immediately when the node(...) method is called on the returned object

Parameters:
parent - the location of the parent
Returns:
the object used to start creating a node

addValue

public Graph.AddValue<Graph> addValue(Object value)

removeValue

public Graph.RemoveValue<Graph> removeValue(Object value)

set

public Graph.On<Graph.Conjunction<Graph>> set(Property... properties)
Set the properties on a node.

Parameters:
properties - the properties to set
Returns:
the remove request object that should be used to specify the node on which the properties are to be set.

set

public Graph.SetValues<Graph.Conjunction<Graph>> set(String propertyName)
Set a property on a node, starting with the name. The interface returned from this method should be used to specify the value(s) and the location of the node onto which the property should be set.

Parameters:
propertyName - the property name
Returns:
the interface used to specify the values

set

public Graph.SetValues<Graph.Conjunction<Graph>> set(Name propertyName)
Set a property on a node, starting with the name. The interface returned from this method should be used to specify the value(s) and the location of the node onto which the property should be set.

Parameters:
propertyName - the property name
Returns:
the interface used to specify the values

remove

public Graph.On<Graph.Conjunction<Graph>> remove(Name... propertyNames)
Remove properties from the node at the given location.

Parameters:
propertyNames - the names of the properties to be removed
Returns:
the remove request object that should be used to specify the node from which the properties are to be removed.

remove

public Graph.On<Graph.Conjunction<Graph>> remove(String... propertyNames)
Remove properties from the node at the given location.

Parameters:
propertyNames - the names of the properties to be removed
Returns:
the remove request object that should be used to specify the node from which the properties are to be removed.

getProperties

public Graph.On<Collection<Property>> getProperties()
Request that the properties be read on the node defined via the on(...) method on the returned Graph.On object. Once the location is specified, the collection of properties are read and then returned.

Returns:
the object that is used to specified the node whose properties are to be read, and which will return the properties

getPropertiesByName

public Graph.On<Map<Name,Property>> getPropertiesByName()
Request that the properties be read on the node defined via the on(...) method on the returned Graph.On object. Once the location is specified, the map of properties are read and then returned.

Returns:
the object that is used to specified the node whose properties are to be read, and which will return the properties as a map keyed by their name

getChildren

public Graph.Children<List<Location>> getChildren()
Request that the children be read on the node defined via the of(...) method on the returned Graph.Of object. The returned object is used to supply the remaining information, including either the location of the parent, or that a subset of the children should be retrieved in a block.

Returns:
the object that is used to specify the remaining inputs for the request, and which will return the children

getProperty

public Graph.On<Property> getProperty(String name)
Request that the property with the given name be read on the node defined via the on(...) method on the returned Graph.On object. Once the location is specified, the property is read and then returned.

Parameters:
name - the name of the property that is to be read
Returns:
the object that is used to specified the node whose property is to be read, and which will return the property

getProperty

public Graph.On<Property> getProperty(Name name)
Request that the property with the given name be read on the node defined via the on(...) method on the returned Graph.On object. Once the location is specified, the property is read and then returned.

Parameters:
name - the name of the property that is to be read
Returns:
the object that is used to specified the node whose property is to be read, and which will return the property

getNodeAt

public Node getNodeAt(UUID uuid)
Request to read the node with the supplied UUID.

Parameters:
uuid - the UUID of the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(Location location)
Request to read the node at the supplied location.

Parameters:
location - the location of the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(String path)
Request to read the node at the supplied path.

Parameters:
path - the path of the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(Path path)
Request to read the node at the supplied path.

Parameters:
path - the path of the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(Property idProperty)
Request to read the node with the supplied unique identifier property.

Parameters:
idProperty - the identification property that is unique to the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(Property firstIdProperty,
                      Property... additionalIdProperties)
Request to read the node with the supplied unique identifier properties.

Parameters:
firstIdProperty - the first of the identification properties that uniquely identify the node that is to be read
additionalIdProperties - the remaining identification properties that uniquely identify the node that is to be read
Returns:
the node that is read from the repository

getNodeAt

public Node getNodeAt(Iterable<Property> idProperties)
Request to read the node with the supplied unique identifier properties.

Parameters:
idProperties - the identification properties that uniquely identify the node that is to be read
Returns:
the node that is read from the repository

resolve

public Node resolve(Reference reference)
Request to read the node given by the supplied reference value.

Parameters:
reference - the reference property value that is to be resolved into a node
Returns:
the node that is read from the repository
Throws:
ValueFormatException - if the supplied reference could not be converted to an identifier property value

getSubgraphOfDepth

public Graph.At<Subgraph> getSubgraphOfDepth(int depth)
Request to read a subgraph of the specified depth, rooted at a location that will be specified via at(...) in the resulting Graph.CreateAt object. All properties and children of every node in the subgraph will be read and returned in the Subgraph object returned from the at(...) methods.

Parameters:
depth - the maximum depth of the subgraph that should be read
Returns:
the component that should be used to specify the location of the node that is the top of the subgraph, and which will return the Subgraph containing the results

importXmlFrom

public Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(InputStream stream)
Import the content from the provided stream of XML data, specifying via the returned object where the content is to be imported.

Parameters:
stream - the open stream of XML data that the importer can read the content that is to be imported
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the stream or destination path are null

importXmlFrom

public Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(URI uri)
Import the content from the XML file at the supplied URI, specifying via the returned object where the content is to be imported.

Parameters:
uri - the URI where the importer can read the content that is to be imported
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

importXmlFrom

public Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(String pathToFile)
Import the content from the XML file at the supplied file location, specifying via the returned object where the content is to be imported.

Parameters:
pathToFile - the path to the XML file that should be imported.
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

importXmlFrom

public Graph.ImportInto<Graph.Conjunction<Graph>> importXmlFrom(File file)
Import the content from the XML file at the supplied file, specifying via the returned object where the content is to be imported.

Parameters:
file - the XML file that should be imported.
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

batch

public Graph.Batch batch()
Begin a batch of requests to perform various operations. Use this approach when multiple operations are to be built and then executed with one submission to the underlying repository source. The results are not available until the Graph.Batch.execute() method is invoked.

Returns:
the batch object used to build and accumulate multiple requests and to submit them all for processing at once.
See Also:
Graph.Batch.execute(), Results

batch

public Graph.Batch batch(BatchRequestBuilder builder)
Begin a batch of requests to perform various operations, but specify the queue where all accumulated requests should be placed. Use this approach when multiple operations are to be built and then executed with one submission to the underlying repository source. The results are not available until the Graph.Batch.execute() method is invoked.

Parameters:
builder - the request builder that should be used; may not be null
Returns:
the batch object used to build and accumulate multiple requests and to submit them all for processing at once.
See Also:
Graph.Batch.execute(), Results


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