|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.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.
Constructor Summary | |
---|---|
protected |
AbstractMapWorkspace(MapRepository repository,
String name)
|
Method Summary | |
---|---|
protected abstract void |
addNodeToMap(MapNode node)
Adds the given node to the backing map, replacing any node already in the backing map with the same UUID. |
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. |
protected MapNode |
copyNode(ExecutionContext context,
MapNode original,
MapWorkspace newWorkspace,
MapNode newParent,
Name desiredName,
boolean recursive,
Map<UUID,UUID> oldToNewUuids)
This should copy the subgraph given by the original node and place the new copy under the supplied new parent. |
protected void |
correctSameNameSiblingIndexes(ExecutionContext context,
MapNode parentNode,
Name name)
Corrects the SNS indices for all children of the node with the given name |
protected MapNode |
createMapNode(UUID uuid)
Creates an empty node with the given UUID. |
MapNode |
createNode(ExecutionContext context,
MapNode parentNode,
Name name,
UUID uuid,
Iterable<Property> properties)
Create a new node with the supplied name, as a child of the supplied parent. |
MapNode |
createNode(ExecutionContext context,
String pathToNewNode,
Iterable<Property> properties)
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 |
protected MapRepository |
getRepository()
Get the repository that owns this workspace. |
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 . |
int |
hashCode()
|
protected void |
initialize()
|
void |
moveNode(ExecutionContext context,
MapNode node,
Name desiredNewName,
MapWorkspace newWorkspace,
MapNode newParent,
MapNode beforeNode)
Move the supplied node to the new parent. |
protected void |
moveNodeToWorkspace(MapNode node,
AbstractMapWorkspace newWorkspace)
Moves the branch rooted at the given node to the new workspace, removing it from this workspace. |
Path |
pathFor(PathFactory pathFactory,
MapNode node)
Returns the absolute path to the given node |
QueryResults |
query(ExecutionContext context,
AccessQueryRequest accessQuery)
Perform a query of this workspace. |
protected abstract void |
removeAllNodesFromMap()
Removes all of the nodes from the backing map |
boolean |
removeNode(ExecutionContext context,
MapNode node)
Removes the given node and its children, correcting the SNS and child indices for its parent. |
protected abstract MapNode |
removeNodeFromMap(UUID nodeUuid)
Removes the node with the given UUID from the backing map, returning the node if it exists |
protected void |
removeUuidReference(MapNode node)
Recursively removes the given node and its children from the backing map |
QueryResults |
search(ExecutionContext context,
String fullTextSearchExpression)
Perform a full-text search of this workspace. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.modeshape.graph.connector.map.MapWorkspace |
---|
lockNode, unlockNode |
Constructor Detail |
---|
protected AbstractMapWorkspace(MapRepository repository, String name)
Method Detail |
---|
protected void initialize()
protected MapRepository getRepository()
protected abstract void addNodeToMap(MapNode node)
node
- the node to add to the map; may not be nullprotected abstract MapNode removeNodeFromMap(UUID nodeUuid)
nodeUuid
- the UUID of the node to replace; may not be null
protected abstract void removeAllNodesFromMap()
public abstract MapNode getNode(UUID nodeUuid)
getNode
in interface MapWorkspace
nodeUuid
- the UUID of the node to be retrieved; may not be null
protected MapNode createMapNode(UUID uuid)
node
with the given UUID.
This method does not add the new map node to the map. That must be done with a separate call to
addNodeToMap(MapNode)
.
uuid
- the UUID that identifies the new node; 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 boolean removeNode(ExecutionContext context, MapNode node)
removeNode
in interface MapWorkspace
context
- the current execution context; may not be nullnode
- the node to be removed; may not be null
protected void removeUuidReference(MapNode node)
node
- the root of the branch to be removedpublic MapNode createNode(ExecutionContext context, String pathToNewNode, Iterable<Property> properties)
createNode
in interface MapWorkspace
context
- the environment; may not be nullpathToNewNode
- the path to the new node; may not be nullproperties
- the properties for the new node
public MapNode createNode(ExecutionContext context, MapNode parentNode, Name name, UUID uuid, Iterable<Property> properties)
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 generatedproperties
- the properties for the new node
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 placedprotected void moveNodeToWorkspace(MapNode node, AbstractMapWorkspace newWorkspace)
node
- the root node of the branch to be movednewWorkspace
- the workspace to which the branch should be movedpublic 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
protected MapNode copyNode(ExecutionContext context, MapNode original, MapWorkspace newWorkspace, MapNode newParent, Name desiredName, boolean recursive, Map<UUID,UUID> oldToNewUuids)
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 recursiveoldToNewUuids
- the map of UUIDs of nodes in the new subgraph keyed by the UUIDs of nodes in the original; may be null
if the UUIDs are to be maintained
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 QueryResults query(ExecutionContext context, AccessQueryRequest accessQuery)
query
in interface MapWorkspace
context
- the context in which the query is to be executed; may not be nullaccessQuery
- the access query; may not be null
MapWorkspace.query(org.modeshape.graph.ExecutionContext,
org.modeshape.graph.request.AccessQueryRequest)
public QueryResults search(ExecutionContext context, String fullTextSearchExpression)
search
in interface MapWorkspace
context
- the context in which the query is to be executed; may not be nullfullTextSearchExpression
- the full-text search expression; may not be null
MapWorkspace.search(org.modeshape.graph.ExecutionContext, java.lang.String)
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
protected void correctSameNameSiblingIndexes(ExecutionContext context, MapNode parentNode, Name name)
context
- the execution contextparentNode
- the parent nodename
- the name of the child nodes for which the SNS indices should be recalculatedpublic boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class 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 |