|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.connector.base.MapWorkspace<NodeType>
NodeType
- the type of node@NotThreadSafe public abstract class MapWorkspace<NodeType extends MapNode>
The Workspace
implementation that represents all nodes as MapNode
objects and stores them keyed by their
UUID.
Subclasses are required to provide thread-safe access and modification of the state within the encapsulated map, since multiple
Transaction
implementations may be committing
changes to the map at the same time.
However, this class does not provide any thread-safety, since the nature of the thread-safety will almost certainly depend on
the actual map implementation. For example, a subclass may use a lock
, or it may use a map implementation
that provides the thread-safety.
Field Summary | |
---|---|
protected String |
name
|
protected UUID |
rootNodeUuid
|
Constructor Summary | |
---|---|
MapWorkspace(String name,
MapWorkspace<NodeType> originalToClone)
Create a new instance of the workspace. |
|
MapWorkspace(String name,
NodeType rootNode)
Create a new instance of the workspace. |
Method Summary | |
---|---|
String |
getName()
Returns the name of the workspace. |
abstract NodeType |
getNode(UUID uuid)
Get the node with the supplied UUID. |
NodeType |
getRootNode()
Get the root node in this workspace. |
UUID |
getRootNodeUuid()
Get the UUID of the root node. |
boolean |
hasNodeCache()
Indicates whether this workspace has a node cache. |
abstract NodeType |
putNode(NodeType node)
Add the node into this workspace's map, overwriting any previous record of the node |
abstract void |
removeAll()
Remove all of the nodes in this workspace, and make sure there is a single root node with no properties and no children. |
abstract NodeType |
removeNode(UUID uuid)
Remove and return the node with the supplied UUID. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final String name
protected final UUID rootNodeUuid
Constructor Detail |
---|
public MapWorkspace(String name, NodeType rootNode)
name
- the workspace name; may not be nullrootNode
- the root node that is expected to already exist in the mappublic MapWorkspace(String name, MapWorkspace<NodeType> originalToClone)
name
- the workspace name; may not be nulloriginalToClone
- the workspace that is to be cloned; may not be nullMethod Detail |
---|
public UUID getRootNodeUuid()
public String getName()
getName
in interface Workspace
Workspace.getName()
public NodeType getRootNode()
public abstract NodeType getNode(UUID uuid)
uuid
- the UUID of the node
public abstract NodeType putNode(NodeType node)
node
- the new node; may not be null
public abstract NodeType removeNode(UUID uuid)
uuid
- the UUID of the node to be removed
public abstract void removeAll()
public String toString()
toString
in class Object
Object.toString()
public boolean hasNodeCache()
NoCachePolicy
.
hasNodeCache
in interface Workspace
Workspace.hasNodeCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |