org.modeshape.connector.infinispan
Class InfinispanTransaction

java.lang.Object
  extended by org.modeshape.graph.connector.base.BaseTransaction<NodeType,WorkspaceType>
      extended by org.modeshape.graph.connector.base.MapTransaction<InfinispanNode,InfinispanWorkspace>
          extended by org.modeshape.connector.infinispan.InfinispanTransaction
All Implemented Interfaces:
Transaction<InfinispanNode,InfinispanWorkspace>

@NotThreadSafe
public class InfinispanTransaction
extends MapTransaction<InfinispanNode,InfinispanWorkspace>


Nested Class Summary
 
Nested classes/interfaces inherited from class org.modeshape.graph.connector.base.MapTransaction
MapTransaction.Children, MapTransaction.WorkspaceChanges
 
Field Summary
 
Fields inherited from class org.modeshape.graph.connector.base.BaseTransaction
context, nameFactory, pathFactory, propertyFactory, rootLocation, rootNodeUuid, valueFactories
 
Constructor Summary
protected InfinispanTransaction(ExecutionContext context, InfinispanRepository repository, UUID rootNodeUuid, Lock lock)
           
 
Method Summary
 void commit()
          Commit any changes that have been made to the repository.
protected  InfinispanNode createNode(UUID uuid, Path.Segment name, UUID parentUuid, Iterable<Property> properties)
          Create a new instance of the node, given the supplied UUID.
 boolean destroyWorkspace(InfinispanWorkspace workspace)
          Destroy the workspace with the supplied name.
 InfinispanWorkspace getWorkspace(String name, InfinispanWorkspace originalToClone)
          Creates a new workspace with the given name containing only a root node.
 Set<String> getWorkspaceNames()
          Get the names of the existing workspaces.
 void rollback()
          Rollback any changes that have been made to this repository.
 
Methods inherited from class org.modeshape.graph.connector.base.MapTransaction
addChild, addChild, cloneNode, copyBranch, copyNode, destroyNode, findLatest, findNode, getChangesFor, getChild, getChildren, getChildrenLocations, getNode, getParent, getUuidsUnderNode, print, query, removeAllChildren, removeNode, removeProperty, search, setProperties, verifyNodeExists
 
Methods inherited from class org.modeshape.graph.connector.base.BaseTransaction
getContext, getFirstChild, getNode, getRepository, getRootLocation, getRootNode, getRootUuid, lockNode, pathFor, readable, unlockNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfinispanTransaction

protected InfinispanTransaction(ExecutionContext context,
                                InfinispanRepository repository,
                                UUID rootNodeUuid,
                                Lock lock)
Method Detail

getWorkspaceNames

public Set<String> getWorkspaceNames()
Get the names of the existing workspaces.

Specified by:
getWorkspaceNames in interface Transaction<InfinispanNode,InfinispanWorkspace>
Overrides:
getWorkspaceNames in class BaseTransaction<InfinispanNode,InfinispanWorkspace>
Returns:
the immutable set of workspace names; never null
See Also:
Transaction.getWorkspaceNames()

getWorkspace

public InfinispanWorkspace getWorkspace(String name,
                                        InfinispanWorkspace originalToClone)
Creates a new workspace with the given name containing only a root node. If the workspace already exists, it is left untouched and returned.

Parameters:
name - the name of the workspace; may not be null
originalToClone - the workspace that should be cloned, or null if the new workspace is to only contain a root node
Returns:
the newly created workspace; may not be null
See Also:
Transaction.getWorkspace(java.lang.String, org.modeshape.graph.connector.base.Workspace)

destroyWorkspace

public boolean destroyWorkspace(InfinispanWorkspace workspace)
Destroy the workspace with the supplied name.

Parameters:
workspace - the workspace that is to be destroyed; may not be null
Returns:
true if the workspace was destroyed, or false if the workspace did not exist
See Also:
Transaction.destroyWorkspace(org.modeshape.graph.connector.base.Workspace)

createNode

protected InfinispanNode createNode(UUID uuid,
                                    Path.Segment name,
                                    UUID parentUuid,
                                    Iterable<Property> properties)
Create a new instance of the node, given the supplied UUID. This method should do nothing but instantiate the new node; the caller will add to the appropriate maps.

Overrides:
createNode in class MapTransaction<InfinispanNode,InfinispanWorkspace>
Parameters:
uuid - the desired UUID; never null
name - the name of the new node; may be null if the name is not known
parentUuid - the UUID of the parent node; may be null if this is the root node
properties - the properties; may be null if there are no properties
Returns:
the new node; never null
See Also:
MapTransaction.createNode(java.util.UUID, org.modeshape.graph.property.Path.Segment, java.util.UUID, java.lang.Iterable)

commit

public void commit()
Commit any changes that have been made to the repository. This method may throw runtime exceptions if there are failures committing the changes, but the transaction is still expected to be closed.

Specified by:
commit in interface Transaction<InfinispanNode,InfinispanWorkspace>
Overrides:
commit in class MapTransaction<InfinispanNode,InfinispanWorkspace>
See Also:
Transaction.commit()

rollback

public void rollback()
Rollback any changes that have been made to this repository. This method may throw runtime exceptions if there are failures rolling back the changes, but the transaction is still expected to be closed.

Specified by:
rollback in interface Transaction<InfinispanNode,InfinispanWorkspace>
Overrides:
rollback in class MapTransaction<InfinispanNode,InfinispanWorkspace>
See Also:
Transaction.rollback()


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