org.modeshape.graph.connector.path
Interface WritablePathWorkspace

All Superinterfaces:
PathWorkspace
All Known Implementing Classes:
AbstractWritablePathWorkspace

public interface WritablePathWorkspace
extends PathWorkspace

Extension of PathWorkspace for repositories that support modification of nodes as well as access to the nodes.


Method Summary
 PathNode copyNode(ExecutionContext context, PathNode original, PathWorkspace originalWorkspace, PathNode newParent, Name desiredName, boolean recursive)
          Copy the subgraph given by the original node and place the new copy under the supplied new parent.
 PathNode createNode(ExecutionContext context, PathNode parentNode, Name name, Map<Name,Property> properties, NodeConflictBehavior conflictBehavior)
          Create a new node with the supplied name, as a child of the supplied parent.
 PathNode createNode(ExecutionContext context, String pathToNewNode, Map<Name,Property> properties, NodeConflictBehavior conflictBehavior)
          Create a node at the supplied path.
 PathNode moveNode(ExecutionContext context, PathNode node, Name desiredNewName, WritablePathWorkspace originalWorkspace, PathNode newParent, PathNode beforeNode)
          Move the supplied node to the new parent within this workspace.
 boolean removeNode(ExecutionContext context, Path nodePath)
          Removes the node at the given path
 PathNode removeProperties(ExecutionContext context, Path nodePath, Iterable<Name> propertyNames)
          Removes the properties with the given names
 PathNode setProperties(ExecutionContext context, Path nodePath, Map<Name,Property> properties)
          Sets the given properties in a single operation, overwriting any previous properties for the same name.
 
Methods inherited from interface org.modeshape.graph.connector.path.PathWorkspace
getLowestExistingPath, getName, getNode, lockNode, query, search, unlockNode
 

Method Detail

createNode

PathNode createNode(ExecutionContext context,
                    String pathToNewNode,
                    Map<Name,Property> properties,
                    NodeConflictBehavior conflictBehavior)
Create a node at the supplied path. The parent of the new node must already exist.

Parameters:
context - the environment; may not be null
pathToNewNode - the path to the new node; may not be null
properties - the properties for the new node
conflictBehavior - the expected behavior if an equivalently-named child already exists at the location
Returns:
the new node (or root if the path specified the root)

createNode

PathNode createNode(ExecutionContext context,
                    PathNode parentNode,
                    Name name,
                    Map<Name,Property> properties,
                    NodeConflictBehavior conflictBehavior)
Create a new node with the supplied name, as a child of the supplied parent.

Parameters:
context - the execution context
parentNode - the parent node; may not be null
name - the name; may not be null
properties - the properties for the new node
conflictBehavior - the expected behavior if an equivalently-named child already exists at the location
Returns:
the new node

moveNode

PathNode moveNode(ExecutionContext context,
                  PathNode node,
                  Name desiredNewName,
                  WritablePathWorkspace originalWorkspace,
                  PathNode newParent,
                  PathNode beforeNode)
Move the supplied node to the new parent within this workspace. This method automatically removes the node from its existing parent, and also correctly adjusts the index to be correct in the new parent.

Parameters:
context -
node - the node to be moved; may not be the workspace root node
desiredNewName - the new name for the node, if it is to be changed; may be null
originalWorkspace - the workspace containing the node to be moved
newParent - the new parent; may not be the workspace root node
beforeNode - the node before which this new node should be placed
Returns:
a new copy of node that reflects the new location

copyNode

PathNode copyNode(ExecutionContext context,
                  PathNode original,
                  PathWorkspace originalWorkspace,
                  PathNode newParent,
                  Name desiredName,
                  boolean recursive)
Copy the subgraph given by the original node and place the new copy under the supplied new parent. Note that internal references between nodes within the original subgraph must be reflected as internal nodes within the new subgraph.

Parameters:
context - the context; may not be null
original - the node to be copied; may not be null
originalWorkspace - the workspace containing the original parent node; may not be null
newParent - the parent where the copy is to be placed; may not be null
desiredName - the desired name for the node; if null, the name will be obtained from the original node
recursive - true if the copy should be recursive
Returns:
the new node, which is the top of the new subgraph

removeNode

boolean removeNode(ExecutionContext context,
                   Path nodePath)
Removes the node at the given path

Parameters:
context - the context; may not be null
nodePath - the path of the node to be removed
Returns:
true if the node existed (and was removed); false otherwise

setProperties

PathNode setProperties(ExecutionContext context,
                       Path nodePath,
                       Map<Name,Property> properties)
Sets the given properties in a single operation, overwriting any previous properties for the same name. This bulk mutator should be used when multiple properties are being set in order to allow underlying implementations to optimize their access to their respective persistent storage mechanism.

Parameters:
context - the context; may not be null
nodePath - the path to the node on which the properties should be set
properties - the properties to set
Returns:
this map node

removeProperties

PathNode removeProperties(ExecutionContext context,
                          Path nodePath,
                          Iterable<Name> propertyNames)
Removes the properties with the given names

Parameters:
context - the context; may not be null
nodePath - the path to the node from which the properties should be removed
propertyNames - the name of the properties to remove
Returns:
this map node


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