|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.graph.connector.base.BaseTransaction<NodeType,WorkspaceType>
NodeType - the type of nodeWorkspaceType - the type of workspace@NotThreadSafe public abstract class BaseTransaction<NodeType extends Node,WorkspaceType extends Workspace>

| Field Summary | |
|---|---|
protected ExecutionContext |
context
|
protected NameFactory |
nameFactory
|
protected PathFactory |
pathFactory
|
protected PropertyFactory |
propertyFactory
|
protected Location |
rootLocation
|
protected UUID |
rootNodeUuid
|
protected ValueFactories |
valueFactories
|
| Constructor Summary | |
|---|---|
protected |
BaseTransaction(ExecutionContext context,
Repository<NodeType,WorkspaceType> repository,
UUID rootNodeUuid)
|
| Method Summary | |
|---|---|
void |
commit()
Commit any changes that have been made to the repository. |
ExecutionContext |
getContext()
Get the context in which this operator executes. |
NodeType |
getFirstChild(WorkspaceType workspace,
NodeType parent,
Name childName)
Find in the supplied parent node the first child with the supplied name. |
protected NodeType |
getNode(WorkspaceType workspace,
Path path,
Location location)
|
protected Repository<NodeType,WorkspaceType> |
getRepository()
Obtain the repository object against which this transaction is running. |
Location |
getRootLocation()
|
NodeType |
getRootNode(WorkspaceType workspace)
Get the root node of the repository workspace. |
UUID |
getRootUuid()
|
Set<String> |
getWorkspaceNames()
Get the names of the existing workspaces. |
void |
lockNode(WorkspaceType workspace,
NodeType node,
LockBranchRequest.LockScope lockScope,
long lockTimeoutInMillis)
Attempts to lock the given node with the given timeout. |
Path |
pathFor(WorkspaceType workspace,
NodeType node)
Returns the path for the given node with this workspace if one exists, or a null if no node exists at the given
path. |
protected String |
readable(Object obj)
|
void |
rollback()
Rollback any changes that have been made to this repository. |
void |
unlockNode(WorkspaceType workspace,
NodeType node)
Attempts to unlock the given node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.modeshape.graph.connector.base.Transaction |
|---|
addChild, addChild, cloneNode, copyNode, destroyWorkspace, getChild, getChildren, getChildrenLocations, getNode, getParent, getWorkspace, query, removeAllChildren, removeNode, removeProperty, search, setProperties, verifyNodeExists |
| Field Detail |
|---|
protected final UUID rootNodeUuid
protected final ExecutionContext context
protected final PathFactory pathFactory
protected final NameFactory nameFactory
protected final PropertyFactory propertyFactory
protected final ValueFactories valueFactories
protected final Location rootLocation
| Constructor Detail |
|---|
protected BaseTransaction(ExecutionContext context,
Repository<NodeType,WorkspaceType> repository,
UUID rootNodeUuid)
| Method Detail |
|---|
public Location getRootLocation()
public UUID getRootUuid()
protected String readable(Object obj)
public ExecutionContext getContext()
getContext in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>Transaction.getContext()protected Repository<NodeType,WorkspaceType> getRepository()
public Set<String> getWorkspaceNames()
getWorkspaceNames in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>Transaction.getWorkspaceNames()public NodeType getRootNode(WorkspaceType workspace)
getRootNode in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>workspace - the workspace; may not be null
Transaction.getRootNode(org.modeshape.graph.connector.base.Workspace)
protected NodeType getNode(WorkspaceType workspace,
Path path,
Location location)
public Path pathFor(WorkspaceType workspace,
NodeType node)
null if no node exists at the given
path.
pathFor in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>workspace - the workspace; may not be nullnode - the node for which the path should be retrieved; may not be null
Transaction.pathFor(org.modeshape.graph.connector.base.Workspace,
org.modeshape.graph.connector.base.Node)
public NodeType getFirstChild(WorkspaceType workspace,
NodeType parent,
Name childName)
This method is implemented by iterating through the children, looking for the first child that has a matching name. Obviously this may be implemented more efficiently in certain systems. For example, an implementation might create a path by appending the child name to the supplied parent, and find the node with this path.
getFirstChild in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>workspace - the workspace; may not be nullparent - the parent node; may not be nullchildName - the name of the child; may not be null
Transaction.getFirstChild(org.modeshape.graph.connector.base.Workspace,
org.modeshape.graph.connector.base.Node, org.modeshape.graph.property.Name)
public void lockNode(WorkspaceType workspace,
NodeType node,
LockBranchRequest.LockScope lockScope,
long lockTimeoutInMillis)
throws LockFailedException
LockFailedException will be
thrown.
lockNode in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>workspace - the workspace; may not be nullnode - the node to be locked; may not be nulllockScope - the scope of the lock (i.e., whether descendants of node should be included in the locklockTimeoutInMillis - the maximum lifetime of the lock in milliseconds; zero (0) indicates that the connector default
should be used
LockFailedException - if the implementing connector supports locking but the lock could not be acquired.Transaction.lockNode(org.modeshape.graph.connector.base.Workspace,
org.modeshape.graph.connector.base.Node, org.modeshape.graph.request.LockBranchRequest.LockScope, long)
public void unlockNode(WorkspaceType workspace,
NodeType node)
unlockNode in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>workspace - the workspace; may not be nullnode - the node to be unlocked; may not be nullTransaction.unlockNode(org.modeshape.graph.connector.base.Workspace,
org.modeshape.graph.connector.base.Node)public void commit()
commit in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>Transaction.commit()public void rollback()
rollback in interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>Transaction.rollback()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||