org.modeshape.connector.disk
Class DiskTransaction

java.lang.Object
  extended by org.modeshape.graph.connector.base.BaseTransaction<NodeType,WorkspaceType>
      extended by org.modeshape.graph.connector.base.MapTransaction<DiskNode,DiskWorkspace>
          extended by org.modeshape.connector.disk.DiskTransaction
All Implemented Interfaces:
Transaction<DiskNode,DiskWorkspace>

@NotThreadSafe
public class DiskTransaction
extends MapTransaction<DiskNode,DiskWorkspace>


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 DiskTransaction(ExecutionContext context, DiskRepository repository, UUID rootNodeUuid, org.modeshape.connector.disk.DiskRepository.DiskLock lock)
           
 
Method Summary
 void commit()
          Commit any changes that have been made to the repository.
protected  DiskNode createNode(UUID uuid, Path.Segment name, UUID parentUuid, Iterable<Property> properties)
          Create a new instance of the node, given the supplied UUID.
 boolean destroyWorkspace(DiskWorkspace workspace)
          Destroy the workspace with the supplied name.
 DiskWorkspace getWorkspace(String name, DiskWorkspace 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

DiskTransaction

protected DiskTransaction(ExecutionContext context,
                          DiskRepository repository,
                          UUID rootNodeUuid,
                          org.modeshape.connector.disk.DiskRepository.DiskLock lock)
Method Detail

getWorkspaceNames

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

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

getWorkspace

public DiskWorkspace getWorkspace(String name,
                                  DiskWorkspace 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(DiskWorkspace 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 DiskNode 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<DiskNode,DiskWorkspace>
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<DiskNode,DiskWorkspace>
Overrides:
commit in class MapTransaction<DiskNode,DiskWorkspace>
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<DiskNode,DiskWorkspace>
Overrides:
rollback in class MapTransaction<DiskNode,DiskWorkspace>
See Also:
Transaction.rollback()


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