org.modeshape.connector.jbosscache
Class JBossCacheWorkspace

java.lang.Object
  extended by org.modeshape.graph.connector.base.MapWorkspace<JBossCacheNode>
      extended by org.modeshape.connector.jbosscache.JBossCacheWorkspace
All Implemented Interfaces:
Workspace

public class JBossCacheWorkspace
extends MapWorkspace<JBossCacheNode>


Field Summary
 
Fields inherited from class org.modeshape.graph.connector.base.MapWorkspace
name, rootNodeUuid
 
Constructor Summary
JBossCacheWorkspace(String name, org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache, JBossCacheNode rootNode)
          Create a new workspace instance.
JBossCacheWorkspace(String name, org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache, JBossCacheWorkspace originalToClone)
          Create a new workspace instance.
 
Method Summary
protected static org.jboss.cache.Node<UUID,JBossCacheNode> findOrCreateWorkspaceRoot(String workspaceName, org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache, UUID rootNodeUuid)
           
 JBossCacheNode getNode(UUID uuid)
          Get the node with the supplied UUID.
 JBossCacheNode putNode(JBossCacheNode node)
          Add the node into this workspace's map, overwriting any previous record of the node
 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.
 JBossCacheNode removeNode(UUID uuid)
          Remove and return the node with the supplied UUID.
 void shutdown()
          This method shuts down the workspace and makes it no longer usable.
 
Methods inherited from class org.modeshape.graph.connector.base.MapWorkspace
getName, getRootNode, getRootNodeUuid, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JBossCacheWorkspace

public JBossCacheWorkspace(String name,
                           org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache,
                           JBossCacheNode rootNode)
Create a new workspace instance.

Parameters:
name - the name of the workspace
workspaceCache - the Infinispan cache containing the workspace content
rootNode - the root node for the workspace

JBossCacheWorkspace

public JBossCacheWorkspace(String name,
                           org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache,
                           JBossCacheWorkspace originalToClone)
Create a new workspace instance.

Parameters:
name - the name of the workspace
workspaceCache - the Infinispan cache containing the workspace content
originalToClone - the workspace that is to be cloned
Method Detail

findOrCreateWorkspaceRoot

protected static org.jboss.cache.Node<UUID,JBossCacheNode> findOrCreateWorkspaceRoot(String workspaceName,
                                                                                     org.jboss.cache.Cache<UUID,JBossCacheNode> workspaceCache,
                                                                                     UUID rootNodeUuid)

getNode

public JBossCacheNode getNode(UUID uuid)
Get the node with the supplied UUID.

Specified by:
getNode in class MapWorkspace<JBossCacheNode>
Parameters:
uuid - the UUID of the node
Returns:
the node state as known by this workspace, or null if no such node exists in this workspace
See Also:
MapWorkspace.getNode(java.util.UUID)

putNode

public JBossCacheNode putNode(JBossCacheNode node)
Add the node into this workspace's map, overwriting any previous record of the node

Specified by:
putNode in class MapWorkspace<JBossCacheNode>
Parameters:
node - the new node; may not be null
Returns:
the previous node state, or null if the node is new to this workspace
See Also:
MapWorkspace.putNode(org.modeshape.graph.connector.base.MapNode)

removeNode

public JBossCacheNode removeNode(UUID uuid)
Remove and return the node with the supplied UUID. This method will never remove the root node.

Specified by:
removeNode in class MapWorkspace<JBossCacheNode>
Parameters:
uuid - the UUID of the node to be removed
Returns:
the node that was removed, or null if the supplied UUID is the root node's UUID or if this workspace does not contain a node with the supplied UUID
See Also:
MapWorkspace.removeNode(java.util.UUID)

removeAll

public 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.

Specified by:
removeAll in class MapWorkspace<JBossCacheNode>
See Also:
MapWorkspace.removeAll()

shutdown

public void shutdown()
This method shuts down the workspace and makes it no longer usable. This method should also only be called once.



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