|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
NodeType
- the type of nodeWorkspaceType
- the type of workspace@NotThreadSafe public interface Transaction<NodeType extends Node,WorkspaceType extends Workspace>
A transaction in which all read and write operations against a repository are performed. The actual transaction instance is
obtained by calling Repository.startTransaction(ExecutionContext,boolean)
.
Note that implementations are not required to be thread-safe, since they (and their corresponding Connection
) are
expected to be used by a single thread.
Method Summary | |
---|---|
NodeType |
addChild(WorkspaceType workspace,
NodeType parent,
Name name,
int index,
UUID uuid,
Iterable<Property> properties)
Creates a new child node under the supplied parent, where the new child will have the specified name, properties, and (optionally) UUID. |
Location |
addChild(WorkspaceType workspace,
NodeType parent,
NodeType newChild,
NodeType beforeOtherChild,
Name desiredName)
Inserts the specified child at the specified position in the list of children. |
NodeType |
cloneNode(WorkspaceType originalWorkspace,
NodeType original,
WorkspaceType newWorkspace,
NodeType newParent,
Name desiredName,
Path.Segment desiredSegment,
boolean removeExisting,
Set<Location> removedExistingNodes)
This should clone the subgraph given by the original node and place the cloned copy under the supplied new parent. |
void |
commit()
Commit any changes that have been made to the repository. |
NodeType |
copyNode(WorkspaceType originalWorkspace,
NodeType original,
WorkspaceType newWorkspace,
NodeType newParent,
Name desiredName,
boolean recursive)
This should copy the subgraph given by the original node and place the new copy under the supplied new parent. |
boolean |
destroyWorkspace(WorkspaceType workspace)
Destroy the workspace with the supplied name. |
NodeType |
getChild(WorkspaceType workspace,
NodeType parent,
Path.Segment childSegment)
Find in the supplied parent node the child with the supplied name and same-name-sibling index. |
List<NodeType> |
getChildren(WorkspaceType workspace,
NodeType node)
Get the children for the supplied node. |
List<Location> |
getChildrenLocations(WorkspaceType workspace,
NodeType node)
Get the locations for all children of the supplied node. |
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. |
NodeType |
getNode(WorkspaceType workspace,
Location location)
Find the node with the supplied unique identifier. |
NodeType |
getParent(WorkspaceType workspace,
NodeType node)
Returns the parent of the supplied node. |
NodeType |
getRootNode(WorkspaceType workspace)
Get the root node of the repository workspace. |
WorkspaceType |
getWorkspace(String name,
WorkspaceType 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 |
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. |
QueryResults |
query(WorkspaceType workspace,
AccessQueryRequest accessQuery)
Perform a query of this workspace. |
void |
removeAllChildren(WorkspaceType workspace,
NodeType node)
Removes all of the children for this node in a single operation. |
Location |
removeNode(WorkspaceType workspace,
NodeType node)
Removes the given node from the repository. |
NodeType |
removeProperty(WorkspaceType workspace,
NodeType node,
Name propertyName)
Removes the property with the given name |
void |
rollback()
Rollback any changes that have been made to this repository. |
QueryResults |
search(WorkspaceType workspace,
FullTextSearchRequest search)
Perform a full-text search of this workspace. |
NodeType |
setProperties(WorkspaceType workspace,
NodeType node,
Iterable<Property> propertiesToSet,
Iterable<Name> propertiesToRemove,
boolean removeAllExisting)
Sets the given properties in a single operation, overwriting any previous properties for the same name. |
void |
unlockNode(WorkspaceType workspace,
NodeType node)
Attempts to unlock the given node. |
Location |
verifyNodeExists(WorkspaceType workspace,
Location location)
Verify that the supplied node exists. |
Method Detail |
---|
ExecutionContext getContext()
Set<String> getWorkspaceNames()
WorkspaceType getWorkspace(String name, WorkspaceType originalToClone) throws InvalidWorkspaceException
name
- the name of the workspace; may not be nulloriginalToClone
- the workspace that should be cloned, or null if the new workspace is to only contain a root node
InvalidWorkspaceException
- if the workspace could not be createdboolean destroyWorkspace(WorkspaceType workspace) throws InvalidWorkspaceException
workspace
- the workspace that is to be destroyed; may not be null
InvalidWorkspaceException
- if the workspace could not be destroyedNodeType getRootNode(WorkspaceType workspace)
workspace
- the workspace; may not be null
Location verifyNodeExists(WorkspaceType workspace, Location location)
workspace
- the workspace; may not be nulllocation
- of the node; may not be null
PathNotFoundException
- if the node at the given location does not existNodeType getNode(WorkspaceType workspace, Location location)
workspace
- the workspace; may not be nulllocation
- of the node; may not be null
PathNotFoundException
- if the node at the given location could not be foundPath pathFor(WorkspaceType workspace, NodeType node)
null
if no node exists at the given
path.
workspace
- the workspace; may not be nullnode
- the node for which the path should be retrieved; may not be null
NodeType getParent(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the child node; may not be null
NodeType getChild(WorkspaceType workspace, NodeType parent, Path.Segment childSegment)
workspace
- the workspace; may not be nullparent
- the parent node; may not be nullchildSegment
- the segment of the child; may not be null
NodeType getFirstChild(WorkspaceType workspace, NodeType parent, Name childName)
workspace
- the workspace; may not be nullparent
- the parent node; may not be nullchildName
- the name of the child; may not be null
List<NodeType> getChildren(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the node whose children are to be returned; may not be null
List<Location> getChildrenLocations(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the node whose children are to be returned; may not be null
void removeAllChildren(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the node whose children are to be removed; may not be nullNodeType addChild(WorkspaceType workspace, NodeType parent, Name name, int index, UUID uuid, Iterable<Property> properties)
workspace
- the workspace; may not be nullparent
- the parent node; may not be nullname
- the name; may not be nullindex
- index at which the specified child is to be inserted, or -1 if the child is to be appendeduuid
- the UUID of the node, or null if the UUID is to be generatedproperties
- the properties for the new node; may be null if there are no other properties
Location addChild(WorkspaceType workspace, NodeType parent, NodeType newChild, NodeType beforeOtherChild, Name desiredName)
This method can also be used to rename an existing child by 'moving' the child node to the existing parent and a new desired name. However, if no 'beforeOtherChild' is supplied, then the node being renamed will also be moved to the end of the children.
workspace
- the workspace; may not be nullparent
- the parent node; may not be nullnewChild
- the node that is to be added as a child of the parent; may not be nullbeforeOtherChild
- the existing child before which the child is to be added; may be null if the child is to be added
at the enddesiredName
- the desired name for the node; may be null if the new child node's name is to be kept
Location removeNode(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the node to be removed; may not be null
NodeType setProperties(WorkspaceType workspace, NodeType node, Iterable<Property> propertiesToSet, Iterable<Name> propertiesToRemove, boolean removeAllExisting)
workspace
- the workspace; may not be nullnode
- the node; may not be nullpropertiesToSet
- the properties to set; may be null or empty if there are no properties being added or setpropertiesToRemove
- the names of the properties that are to be removed; may be null or empty if no properties are
being removedremoveAllExisting
- true if all existing, non-identification properties should be removed, or false otherwise
NodeType removeProperty(WorkspaceType workspace, NodeType node, Name propertyName)
workspace
- the workspace; may not be nullnode
- the node; may not be nullpropertyName
- the name of the property to remove; may not be null
NodeType cloneNode(WorkspaceType originalWorkspace, NodeType original, WorkspaceType newWorkspace, NodeType newParent, Name desiredName, Path.Segment desiredSegment, boolean removeExisting, Set<Location> removedExistingNodes) throws UuidAlreadyExistsException
originalWorkspace
- the workspace containing the original node that is being cloned; may not be nulloriginal
- the node to be cloned; may not be nullnewWorkspace
- the workspace containing the new parent node; may not be nullnewParent
- the parent where the clone is to be placed; may not be nulldesiredName
- the desired name for the node; if null, the name will be calculated from desiredSegment
; Exactly
one of desiredSegment
and desiredName
must be non-nulldesiredSegment
- the exact segment at which the clone should be rooted; if null, the name will be inferred from
desiredName
; Exactly one of desiredSegment
and desiredName
must be non-nullremoveExisting
- true if existing nodes in the new workspace with the same UUIDs as nodes in the branch rooted at
original
should be removed; if false, a UuidAlreadyExistsException will be thrown if a UUID conflict is
detectedremovedExistingNodes
- the set into which should be placed all of the existing nodes that were removed as a result of
this clone operation, or null if these nodes need not be collected
UuidAlreadyExistsException
- if removeExisting
is true and and a UUID in the source tree already exists in
the new workspaceNodeType copyNode(WorkspaceType originalWorkspace, NodeType original, WorkspaceType newWorkspace, NodeType newParent, Name desiredName, boolean recursive)
originalWorkspace
- the workspace containing the original node that is being cloned; may not be nulloriginal
- the node to be copied; may not be nullnewWorkspace
- the workspace containing the new parent node; may not be nullnewParent
- the parent where the copy is to be placed; may not be nulldesiredName
- the desired name for the node; if null, the name will be obtained from the original noderecursive
- true if the copy should be recursive
QueryResults query(WorkspaceType workspace, AccessQueryRequest accessQuery)
workspace
- the workspace to be searched; may not be nullaccessQuery
- the access query; may not be null
QueryResults search(WorkspaceType workspace, FullTextSearchRequest search)
workspace
- the workspace to be searched; may not be nullsearch
- the full-text search; may not be null
void lockNode(WorkspaceType workspace, NodeType node, LockBranchRequest.LockScope lockScope, long lockTimeoutInMillis) throws LockFailedException
LockFailedException
will be
thrown.
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.void unlockNode(WorkspaceType workspace, NodeType node)
workspace
- the workspace; may not be nullnode
- the node to be unlocked; may not be nullvoid commit()
rollback()
void rollback()
commit()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |