|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.request.BatchRequestBuilder
@NotThreadSafe public class BatchRequestBuilder
A component that can be used to build up a list of requests. This implementation does perform some simple optimizations, such as combining adjacent compatible requests.
This builder can be used to add multiple requests. When the enqueued requests are to be processed, calling pop()
will
remove and return the enqueued requests (as a CompositeRequest
if there is more than one enqueued request).
Nested Class Summary | |
---|---|
protected class |
BatchRequestBuilder.NodeChange
|
Constructor Summary | |
---|---|
BatchRequestBuilder()
|
|
BatchRequestBuilder(LinkedList<Request> requests)
|
Method Summary | |
---|---|
protected BatchRequestBuilder |
add(Request request)
|
protected BatchRequestBuilder |
addPending()
|
BatchRequestBuilder |
addValues(String workspaceName,
Location on,
Name property,
List<Object> values)
Add a request to add values to a property on an existing node |
BatchRequestBuilder |
applyFunction(Function function,
Map<String,Serializable> inputs,
Location to,
String workspaceName)
Create a request to run the supplied function at the given location in the named workspace, using the supplied inputs. |
BatchRequestBuilder |
cloneBranch(Location from,
String fromWorkspace,
Location into,
String intoWorkspace,
Name nameForClone,
Path.Segment exactSegmentForClone,
boolean removeExisting)
Add a request to clone a branch to another. |
BatchRequestBuilder |
cloneWorkspace(String nameOfWorkspaceToBeCloned,
String desiredNameOfTargetWorkspace,
CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior,
CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
Add a request to clone an existing workspace to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace. |
BatchRequestBuilder |
copyBranch(Location from,
String fromWorkspace,
Location into,
String intoWorkspace,
Name nameForCopy)
Add a request to copy a branch to another. |
BatchRequestBuilder |
copyBranch(Location from,
String fromWorkspace,
Location into,
String intoWorkspace,
Name nameForCopy,
NodeConflictBehavior conflictBehavior)
Add a request to copy a branch to another. |
BatchRequestBuilder |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Iterator<Property> properties)
Add a request to create a node with the given properties under the supplied location. |
BatchRequestBuilder |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Iterator<Property> properties,
NodeConflictBehavior conflictBehavior)
Add a request to create a node with the given properties under the supplied location. |
BatchRequestBuilder |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Property[] properties)
Add a request to create a node with the given properties under the supplied location. |
BatchRequestBuilder |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Property[] properties,
NodeConflictBehavior conflictBehavior)
Add a request to create a node with the given properties under the supplied location. |
BatchRequestBuilder |
createWorkspace(String desiredNameOfNewWorkspace,
CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior)
Add a request to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace. |
BatchRequestBuilder |
deleteBranch(Location at,
String workspaceName)
Add a request to delete a branch. |
BatchRequestBuilder |
destroyWorkspace(String workspaceName)
Add a request to destroy an existing workspace. |
void |
finishPendingRequest()
Finish any pending request |
BatchRequestBuilder |
getWorkspaces()
Add a request to obtain the information about the available workspaces. |
boolean |
hasRequests()
Determine whether this builder has built any requests. |
BatchRequestBuilder |
lockBranch(String workspaceName,
Location target,
LockBranchRequest.LockScope lockScope,
long lockTimeoutInMillis)
Create a request to lock a branch or node |
BatchRequestBuilder |
moveBranch(Location from,
Location into,
Location before,
String workspaceName,
Name newNameForNode)
Create a request to move a branch from one location into another. |
BatchRequestBuilder |
moveBranch(Location from,
Location into,
String workspaceName)
Create a request to move a branch from one location into another. |
BatchRequestBuilder |
moveBranch(Location from,
Location into,
String workspaceName,
Name newNameForNode)
Create a request to move a branch from one location into another. |
BatchRequestBuilder |
moveBranch(Location from,
Location into,
String workspaceName,
NodeConflictBehavior conflictBehavior)
Create a request to move a branch from one location into another. |
Request |
pop()
Remove and return any requests that have been built by this builder since the last call to this method. |
BatchRequestBuilder |
readAllChildren(Location of,
String workspaceName)
Add a request to read the children of a node at the supplied location in the designated workspace. |
BatchRequestBuilder |
readAllProperties(Location of,
String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location. |
BatchRequestBuilder |
readBlockOfChildren(Location of,
String workspaceName,
int startingIndex,
int count)
Add a request to read a block of the children of a node at the supplied location. |
BatchRequestBuilder |
readBranch(Location at,
String workspaceName)
Add a request to read the branch at the supplied location, to a maximum depth of 2. |
BatchRequestBuilder |
readBranch(Location at,
String workspaceName,
int maxDepth)
Add a request to read the branch (of given depth) at the supplied location. |
BatchRequestBuilder |
readNextBlockOfChildren(Location startingAfter,
String workspaceName,
int count)
Add a request to read those children of a node that are immediately after a supplied sibling node. |
BatchRequestBuilder |
readNode(Location at,
String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location. |
BatchRequestBuilder |
readProperty(Location of,
String workspaceName,
Name propertyName)
Add a request to read the properties and number of children of a node at the supplied location. |
BatchRequestBuilder |
removeProperties(Location on,
String workspaceName,
Name... propertyNames)
Add a request to remove from the node the properties with the supplied names. |
BatchRequestBuilder |
removeProperty(Location on,
String workspaceName,
Name propertyName)
Add a request to remove the property with the supplied name from the given node. |
BatchRequestBuilder |
removeValues(String workspaceName,
Location on,
Name property,
List<Object> values)
Add a request to remove values from a property on an existing node |
BatchRequestBuilder |
renameNode(Location at,
String workspaceName,
Name newName)
Add a request to rename the node at the supplied location. |
BatchRequestBuilder |
setProperties(Location on,
String workspaceName,
Iterable<Property> properties)
Add a request to update the properties on the node at the supplied location. |
BatchRequestBuilder |
setProperties(Location on,
String workspaceName,
Property... properties)
Add a request to update the properties on the node at the supplied location. |
BatchRequestBuilder |
setProperty(Location on,
String workspaceName,
Property property)
Add a request to update the property on the node at the supplied location. |
BatchRequestBuilder |
submit(Request request)
Submit any request to this batch. |
String |
toString()
|
BatchRequestBuilder |
unlockBranch(String workspaceName,
Location target)
Create a request to unlock a branch or node The lock on the node should be removed. |
BatchRequestBuilder |
verifyNodeExists(Location at,
String workspaceName)
Add a request to verify the existance and location of a node at the supplied location. |
BatchRequestBuilder |
verifyWorkspace(String workspaceName)
Add a request to verify the existance of the named workspace. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BatchRequestBuilder()
public BatchRequestBuilder(LinkedList<Request> requests)
Method Detail |
---|
public boolean hasRequests()
pop()
will return a non-null request), or false if there are no requestspublic void finishPendingRequest()
public Request pop()
CompositeRequest
containing them.
CompositeRequest
) representing those requests that this builder has created since the last
call to this method, or null if there are no requests to returnprotected final BatchRequestBuilder add(Request request)
protected final BatchRequestBuilder addPending()
public BatchRequestBuilder getWorkspaces()
public BatchRequestBuilder verifyWorkspace(String workspaceName)
workspaceName
- the desired name of the workspace, or null if the source's default workspace should be used
public BatchRequestBuilder createWorkspace(String desiredNameOfNewWorkspace, CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior)
desiredNameOfNewWorkspace
- the desired name of the new workspacecreateConflictBehavior
- the behavior if a workspace already exists with the same name, or null if the default
behavior should be used
public BatchRequestBuilder cloneWorkspace(String nameOfWorkspaceToBeCloned, String desiredNameOfTargetWorkspace, CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior, CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
nameOfWorkspaceToBeCloned
- the name of the existing workspace that is to be cloneddesiredNameOfTargetWorkspace
- the desired name of the target workspacecreateConflictBehavior
- the behavior if a workspace already exists with the same namecloneConflictBehavior
- the behavior if the workspace to be cloned does not exist
IllegalArgumentException
- if the either workspace name is nullpublic BatchRequestBuilder destroyWorkspace(String workspaceName)
workspaceName
- the name of the workspace that is to be destroyed
IllegalArgumentException
- if the workspace name is nullpublic BatchRequestBuilder verifyNodeExists(Location at, String workspaceName)
at
- the location of the node to be verifiedworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder readNode(Location at, String workspaceName)
at
- the location of the node to be readworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder readAllChildren(Location of, String workspaceName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder readAllProperties(Location of, String workspaceName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder readProperty(Location of, String workspaceName, Name propertyName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspacepropertyName
- the name of the property to read
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder readBranch(Location at, String workspaceName)
at
- the location of the branchworkspaceName
- the name of the workspace containing the branch
IllegalArgumentException
- if the location or workspace name is null or if the maximum depth is not positivepublic BatchRequestBuilder readBranch(Location at, String workspaceName, int maxDepth)
at
- the location of the branchworkspaceName
- the name of the workspace containing the branchmaxDepth
- the maximum depth to read
IllegalArgumentException
- if the location or workspace name is null or if the maximum depth is not positivepublic BatchRequestBuilder readBlockOfChildren(Location of, String workspaceName, int startingIndex, int count)
same-name-sibiling index
, but rather is the index of the child as if the children were in
an array.
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace containing the parentstartingIndex
- the zero-based index of the first child to be included in the blockcount
- the maximum number of children that should be included in the block
IllegalArgumentException
- if the location or workspace name is null, if startingIndex
is negative, or
if count is less than 1.
public BatchRequestBuilder readNextBlockOfChildren(Location startingAfter, String workspaceName, int count)
startingAfter
- the location of the previous sibling that was the last child of the previous block of children readworkspaceName
- the name of the workspace containing the nodecount
- the maximum number of children that should be included in the block
IllegalArgumentException
- if the workspace name or startingAfter
location is null, or if
count is less than 1.
public BatchRequestBuilder createNode(Location parentLocation, String workspaceName, Name childName, Iterator<Property> properties)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new node
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic BatchRequestBuilder createNode(Location parentLocation, String workspaceName, Name childName, Iterator<Property> properties, NodeConflictBehavior conflictBehavior)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new nodeconflictBehavior
- the expected behavior if an equivalently-named child already exists under the into
location
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic BatchRequestBuilder createNode(Location parentLocation, String workspaceName, Name childName, Property[] properties)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new node
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic BatchRequestBuilder createNode(Location parentLocation, String workspaceName, Name childName, Property[] properties, NodeConflictBehavior conflictBehavior)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new nodeconflictBehavior
- the expected behavior if an equivalently-named child already exists under the into
location
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic BatchRequestBuilder setProperty(Location on, String workspaceName, Property property)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeproperty
- the new property on the node
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to updatepublic BatchRequestBuilder setProperties(Location on, String workspaceName, Property... properties)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeproperties
- the new properties on the node
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to updatepublic BatchRequestBuilder setProperties(Location on, String workspaceName, Iterable<Property> properties)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeproperties
- the new properties on the node
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to updatepublic BatchRequestBuilder removeProperty(Location on, String workspaceName, Name propertyName)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodepropertyName
- the name of the property that is to be removed
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to removepublic BatchRequestBuilder removeProperties(Location on, String workspaceName, Name... propertyNames)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodepropertyNames
- the names of the properties that are to be removed
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to removepublic BatchRequestBuilder renameNode(Location at, String workspaceName, Name newName)
at
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodenewName
- the new name for the node
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder copyBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy)
from
- the location of the top node in the existing branch that is to be copiedfromWorkspace
- the name of the workspace where the from
node existsinto
- the location of the existing node into which the copy should be placedintoWorkspace
- the name of the workspace where the into
node is to be copiednameForCopy
- the desired name for the node that results from the copy, or null if the name of the original should be
used
IllegalArgumentException
- if either of the locations or workspace names are nullpublic BatchRequestBuilder copyBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy, NodeConflictBehavior conflictBehavior)
from
- the location of the top node in the existing branch that is to be copiedfromWorkspace
- the name of the workspace where the from
node existsinto
- the location of the existing node into which the copy should be placedintoWorkspace
- the name of the workspace where the into
node is to be copiednameForCopy
- the desired name for the node that results from the copy, or null if the name of the original should be
usedconflictBehavior
- the expected behavior if an equivalently-named child already exists at the into
location, or null if the default node conflict behavior should be used
IllegalArgumentException
- if either of the locations or workspace names are nullpublic BatchRequestBuilder cloneBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForClone, Path.Segment exactSegmentForClone, boolean removeExisting)
from
- the location of the top node in the existing branch that is to be clonedfromWorkspace
- the name of the workspace where the from
node existsinto
- the location of the existing node into which the clone should be placedintoWorkspace
- the name of the workspace where the into
node is to be clonednameForClone
- the desired name for the node that results from the clone, or null if the name of the original should
be usedexactSegmentForClone
- the exact segment
at which the cloned tree should be rooted.removeExisting
- whether any nodes in the intoWorkspace with the same UUIDs as a node in the source branch should be
removed (if true) or a UuidAlreadyExistsException
should be thrown.
IllegalArgumentException
- if any of the parameters are null except for nameForClone
or
exactSegmentForClone
. Exactly one of nameForClone
and exactSegmentForClone
must be null.public BatchRequestBuilder moveBranch(Location from, Location into, String workspaceName)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspace
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder moveBranch(Location from, Location into, String workspaceName, Name newNameForNode)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspacenewNameForNode
- the new name for the node being moved, or null if the name of the original should be used
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder moveBranch(Location from, Location into, Location before, String workspaceName, Name newNameForNode)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedbefore
- the location of the node before which the branch should be moved; may be nullworkspaceName
- the name of the workspacenewNameForNode
- the new name for the node being moved, or null if the name of the original should be used
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder moveBranch(Location from, Location into, String workspaceName, NodeConflictBehavior conflictBehavior)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspaceconflictBehavior
- the expected behavior if an equivalently-named child already exists at the into
location
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder deleteBranch(Location at, String workspaceName)
at
- the location of the top node in the existing branch that is to be deletedworkspaceName
- the name of the workspace containing the parent
IllegalArgumentException
- if the location or workspace name is nullpublic BatchRequestBuilder submit(Request request)
request
- the request to be batched; may not be null
IllegalArgumentException
- if the request is nullpublic BatchRequestBuilder lockBranch(String workspaceName, Location target, LockBranchRequest.LockScope lockScope, long lockTimeoutInMillis)
workspaceName
- the name of the workspace containing the node; may not be nulltarget
- the location of the top node in the existing branch that is to be lockedlockScope
- the LockBranchRequest.lockScope()
scope of the locklockTimeoutInMillis
- the number of milliseconds that the lock should last before the lock times out; zero (0)
indicates that the connector default should be used
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder addValues(String workspaceName, Location on, Name property, List<Object> values)
workspaceName
- the name of the workspace containing the node; may not be nullon
- the location of the node; may not be nullproperty
- the name of the property; may not be nullvalues
- the new values to add; may not be null
public BatchRequestBuilder removeValues(String workspaceName, Location on, Name property, List<Object> values)
workspaceName
- the name of the workspace containing the node; may not be nullon
- the location of the node; may not be nullproperty
- the name of the property; may not be nullvalues
- the new values to remove; may not be null
public BatchRequestBuilder unlockBranch(String workspaceName, Location target)
The lock on the node should be removed. If the lock was deep (i.e., locked the entire branch under the node, then all of the descendants of the node affected by the lock should also be unlocked after this request is processed.
workspaceName
- the name of the workspace containing the node; may not be nulltarget
- the location of the top node in the existing branch that is to be unlocked
IllegalArgumentException
- if any of the parameters are nullpublic BatchRequestBuilder applyFunction(Function function, Map<String,Serializable> inputs, Location to, String workspaceName)
function
- the function to be runinputs
- the input parametersto
- the scope of the functionworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if any of the parameters are nullpublic String toString()
toString
in class Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |