|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.graph.connector.map.AbstractMapWorkspace
public abstract class AbstractMapWorkspace
A default implementation of MapWorkspace
that only requires the user to implement some simple, map-like operations.
Method Summary | |
---|---|
MapNode |
cloneNode(ExecutionContext context,
MapNode original,
MapWorkspace newWorkspace,
MapNode newParent,
Name desiredName,
Path.Segment desiredSegment,
boolean removeExisting,
Set<Location> removedExistingNodes)
This should clone the subgraph given by the original node and place the cloned copy under the supplied new parent. |
MapNode |
copyNode(ExecutionContext context,
MapNode original,
MapWorkspace newWorkspace,
MapNode newParent,
Name desiredName,
boolean recursive)
This should copy the subgraph given by the original node and place the new copy under the supplied new parent. |
MapNode |
createNode(ExecutionContext context,
MapNode parentNode,
Name name,
UUID uuid)
Create a new node with the supplied name, as a child of the supplied parent. |
MapNode |
createNode(ExecutionContext context,
String pathToNewNode)
Create a node at the supplied path. |
boolean |
equals(Object obj)
|
Path |
getLowestExistingPath(Path path)
Find the lowest existing node along the path. |
String |
getName()
Returns the name of the workspace. |
MapNode |
getNode(ExecutionContext context,
String path)
Find a node with the given path. |
MapNode |
getNode(Path path)
Find a node with the given path. |
abstract MapNode |
getNode(UUID nodeUuid)
Gets the node with the given UUID from the backing map, if one exists |
MapNode |
getRoot()
Returns the root node in the workspace. |
Set<UUID> |
getUuidsUnderNode(MapNode node)
Returns all of the UUIDs in the branch rooted at node . |
void |
moveNode(ExecutionContext context,
MapNode node,
Name desiredNewName,
MapWorkspace newWorkspace,
MapNode newParent,
MapNode beforeNode)
Move the supplied node to the new parent. |
Path |
pathFor(PathFactory pathFactory,
MapNode node)
Returns the absolute path to the given node |
void |
removeNode(ExecutionContext context,
MapNode node)
Removes the given node and its children, correcting the SNS and child indices for its parent. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public abstract MapNode getNode(UUID nodeUuid)
getNode
in interface MapWorkspace
nodeUuid
- the UUID of the node to be retrieved; may not be null
public String getName()
MapWorkspace
getName
in interface MapWorkspace
public MapNode getRoot()
map node
where node.getParent() == null
and
node.getUuid() == repository.getRootNodeUuid()
.
getRoot
in interface MapWorkspace
MapWorkspace.getRoot()
public MapNode getNode(ExecutionContext context, String path)
context
- the execution context to use to convert path
to a Path
; may not be nullpath
- the path to the node; may not be null
public MapNode getNode(Path path)
getNode
in interface MapWorkspace
path
- the path to the node; may not be null
public Path pathFor(PathFactory pathFactory, MapNode node)
pathFor
in interface MapWorkspace
pathFactory
- the path factory to use to create the path from the list of names of all of the nodes on the path from
the root node to the given nodenode
- the node for which the path should be returned
public Path getLowestExistingPath(Path path)
getLowestExistingPath
in interface MapWorkspace
path
- the path to the node; may not be null
public void removeNode(ExecutionContext context, MapNode node)
removeNode
in interface MapWorkspace
context
- the current execution contextnode
- the node to be removedpublic MapNode createNode(ExecutionContext context, String pathToNewNode)
createNode
in interface MapWorkspace
context
- the environment; may not be nullpathToNewNode
- the path to the new node; may not be null
public MapNode createNode(ExecutionContext context, MapNode parentNode, Name name, UUID uuid)
createNode
in interface MapWorkspace
context
- the execution contextparentNode
- the parent node; may not be nullname
- the name; may not be nulluuid
- the UUID of the node, or null if the UUID is to be generated
public void moveNode(ExecutionContext context, MapNode node, Name desiredNewName, MapWorkspace newWorkspace, MapNode newParent, MapNode beforeNode)
index
to be correct in the new parent.
moveNode
in interface MapWorkspace
context
- node
- the node to be moved; may not be the root
desiredNewName
- the new name for the node, if it is to be changed; may be nullnewWorkspace
- the workspace containing the new parent nodenewParent
- the new parent; may not be the root
beforeNode
- the node before which this new node should be placedpublic MapNode copyNode(ExecutionContext context, MapNode original, MapWorkspace newWorkspace, MapNode newParent, Name desiredName, boolean recursive)
copyNode
in interface MapWorkspace
context
- the context; may not be nulloriginal
- the node to be copied; may not be nullnewWorkspace
- the workspace containing the new parent node; may not be nullnewParent
- the parent where the copy is to be placed; may not be nulldesiredName
- the desired name for the node; if null, the name will be obtained from the original noderecursive
- true if the copy should be recursive
public MapNode cloneNode(ExecutionContext context, MapNode original, MapWorkspace newWorkspace, MapNode newParent, Name desiredName, Path.Segment desiredSegment, boolean removeExisting, Set<Location> removedExistingNodes) throws UuidAlreadyExistsException
cloneNode
in interface MapWorkspace
context
- the context; may not be nulloriginal
- the node to be cloned; may not be nullnewWorkspace
- the workspace containing the new parent node; may not be nullnewParent
- the parent where the clone is to be placed; may not be nulldesiredName
- the desired name for the node; if null, the name will be calculated from desiredSegment
; Exactly
one of desiredSegment
and desiredName
must be non-nulldesiredSegment
- the exact segment at which the clone should be rooted; if null, the name will be inferred from
desiredName
; Exactly one of desiredSegment
and desiredName
must be non-nullremoveExisting
- true if existing nodes in the new workspace with the same UUIDs as nodes in the branch rooted at
original
should be removed; if false, a UuidAlreadyExistsException will be thrown if a UUID conflict is
detectedremovedExistingNodes
- the set into which should be placed all of the existing nodes that were removed as a result of
this clone operation, or null if these nodes need not be collected
UuidAlreadyExistsException
- if removeExisting
is true and and a UUID in the source tree already exists in
the new workspaceMapWorkspace#cloneNode(ExecutionContext, MapNode, MapWorkspace, MapNode, Name, Segment, boolean, Set)
public Set<UUID> getUuidsUnderNode(MapNode node)
node
. The UUID of node
will be included in the set
of returned UUIDs.
node
- the root of the branch
node
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |