org.jboss.dna.graph.request
Class RequestBuilder

java.lang.Object
  extended by org.jboss.dna.graph.request.RequestBuilder

public abstract class RequestBuilder
extends Object

A component that can be used to build requests while allowing different strategies for how requests are handled. Subclasses can simply override the process(Request) method to define what happens with each request.


Method Summary
 CloneWorkspaceRequest 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.
 CopyBranchRequest copyBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy, NodeConflictBehavior conflictBehavior)
          Add a request to copy a branch to another.
 CreateNodeRequest 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.
 CreateNodeRequest 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.
 CreateNodeRequest createNode(Location parentLocation, String workspaceName, Name childName, Property[] properties)
          Add a request to create a node with the given properties under the supplied location.
 CreateNodeRequest 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.
 CreateWorkspaceRequest 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.
 DeleteBranchRequest deleteBranch(Location at, String workspaceName)
          Add a request to delete a branch.
 DestroyWorkspaceRequest destroyWorkspace(String workspaceName)
          Add a request to destroy an existing workspace.
 GetWorkspacesRequest getWorkspaces()
          Add a request to obtain the information about the available workspaces.
 MoveBranchRequest moveBranch(Location from, Location into, String workspaceName)
          Create a request to move a branch from one location into another.
 MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, Name newNameForNode)
          Create a request to move a branch from one location into another.
 MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, Name newNameForNode, NodeConflictBehavior conflictBehavior)
          Create a request to move a branch from one location into another.
 MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, NodeConflictBehavior conflictBehavior)
          Create a request to move a branch from one location into another.
 ReadAllChildrenRequest readAllChildren(Location of, String workspaceName)
          Add a request to read the children of a node at the supplied location in the designated workspace.
 ReadAllPropertiesRequest readAllProperties(Location of, String workspaceName)
          Add a request to read the properties and number of children of a node at the supplied location.
 ReadBlockOfChildrenRequest 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.
 ReadBranchRequest readBranch(Location at, String workspaceName)
          Add a request to read the branch at the supplied location, to a maximum depth of 2.
 ReadBranchRequest readBranch(Location at, String workspaceName, int maxDepth)
          Add a request to read the branch (of given depth) at the supplied location.
 ReadNextBlockOfChildrenRequest 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.
 ReadNodeRequest readNode(Location at, String workspaceName)
          Add a request to read the properties and number of children of a node at the supplied location.
 ReadPropertyRequest 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.
 Request removeProperties(Location on, String workspaceName, Name... propertyNames)
          Add a request to remove from the node the properties with the supplied names.
 RemovePropertyRequest removeProperty(Location on, String workspaceName, Name propertyName)
          Add a request to remove the property with the supplied name from the given node.
 RenameNodeRequest renameNode(Location at, String workspaceName, Name newName)
          Add a request to rename the node at the supplied location.
 Request setProperties(Location on, String workspaceName, Property... properties)
          Add a request to update the properties on the node at the supplied location.
 SetPropertyRequest setProperty(Location on, String workspaceName, Property property)
          Add a request to update the property on the node at the supplied location.
 VerifyNodeExistsRequest verifyNodeExists(Location at, String workspaceName)
          Add a request to verify the existance and location of a node at the supplied location.
 VerifyWorkspaceRequest verifyWorkspace(String workspaceName)
          Add a request to verify the existance of the named workspace.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWorkspaces

public GetWorkspacesRequest getWorkspaces()
Add a request to obtain the information about the available workspaces.

Returns:
the request; never null

verifyWorkspace

public VerifyWorkspaceRequest verifyWorkspace(String workspaceName)
Add a request to verify the existance of the named workspace.

Parameters:
workspaceName - the desired name of the workspace, or null if the source's default workspace should be used
Returns:
the request; never null

createWorkspace

public CreateWorkspaceRequest 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.

Parameters:
desiredNameOfNewWorkspace - the desired name of the new workspace
createConflictBehavior - the behavior if a workspace already exists with the same name, or null if the default behavior should be used
Returns:
the request; never null

cloneWorkspace

public CloneWorkspaceRequest 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.

Parameters:
nameOfWorkspaceToBeCloned - the name of the existing workspace that is to be cloned
desiredNameOfTargetWorkspace - the desired name of the target workspace
createConflictBehavior - the behavior if a workspace already exists with the same name
cloneConflictBehavior - the behavior if the workspace to be cloned does not exist
Returns:
the request; never null
Throws:
IllegalArgumentException - if the either workspace name is null

destroyWorkspace

public DestroyWorkspaceRequest destroyWorkspace(String workspaceName)
Add a request to destroy an existing workspace.

Parameters:
workspaceName - the name of the workspace that is to be destroyed
Returns:
the request; never null
Throws:
IllegalArgumentException - if the workspace name is null

verifyNodeExists

public VerifyNodeExistsRequest verifyNodeExists(Location at,
                                                String workspaceName)
Add a request to verify the existance and location of a node at the supplied location.

Parameters:
at - the location of the node to be verified
workspaceName - the name of the workspace containing the node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

readNode

public ReadNodeRequest readNode(Location at,
                                String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location.

Parameters:
at - the location of the node to be read
workspaceName - the name of the workspace containing the node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

readAllChildren

public ReadAllChildrenRequest readAllChildren(Location of,
                                              String workspaceName)
Add a request to read the children of a node at the supplied location in the designated workspace.

Parameters:
of - the location of the node whose children are to be read
workspaceName - the name of the workspace
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

readAllProperties

public ReadAllPropertiesRequest readAllProperties(Location of,
                                                  String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location.

Parameters:
of - the location of the node whose children are to be read
workspaceName - the name of the workspace
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

readProperty

public ReadPropertyRequest 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.

Parameters:
of - the location of the node whose children are to be read
workspaceName - the name of the workspace
propertyName - the name of the property to read
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

readBranch

public ReadBranchRequest readBranch(Location at,
                                    String workspaceName)
Add a request to read the branch at the supplied location, to a maximum depth of 2.

Parameters:
at - the location of the branch
workspaceName - the name of the workspace containing the branch
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if the maximum depth is not positive

readBranch

public ReadBranchRequest readBranch(Location at,
                                    String workspaceName,
                                    int maxDepth)
Add a request to read the branch (of given depth) at the supplied location.

Parameters:
at - the location of the branch
workspaceName - the name of the workspace containing the branch
maxDepth - the maximum depth to read
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if the maximum depth is not positive

readBlockOfChildren

public ReadBlockOfChildrenRequest 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. The block is defined by the starting index of the first child and the number of children to include. Note that this index is not the same-name-sibiling index, but rather is the index of the child as if the children were in an array.

Parameters:
of - the location of the node whose children are to be read
workspaceName - the name of the workspace containing the parent
startingIndex - the zero-based index of the first child to be included in the block
count - the maximum number of children that should be included in the block
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null, if startingIndex is negative, or if count is less than 1.

readNextBlockOfChildren

public ReadNextBlockOfChildrenRequest 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.

Parameters:
startingAfter - the location of the previous sibling that was the last child of the previous block of children read
workspaceName - the name of the workspace containing the node
count - the maximum number of children that should be included in the block
Returns:
the request; never null
Throws:
IllegalArgumentException - if the workspace name or startingAfter location is null, or if count is less than 1.

createNode

public CreateNodeRequest 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.

Parameters:
parentLocation - the location of the existing parent node, under which the new child should be created
workspaceName - the name of the workspace containing the parent
childName - the name of the new child to create under the existing parent
properties - the properties of the new node, which should include any identification properties for the new node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location, workspace name, or child name is null

createNode

public CreateNodeRequest 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.

Parameters:
parentLocation - the location of the existing parent node, under which the new child should be created
workspaceName - the name of the workspace containing the parent
childName - the name of the new child to create under the existing parent
properties - the properties of the new node, which should include any identification properties for the new node
conflictBehavior - the expected behavior if an equivalently-named child already exists under the into location
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location, workspace name, or child name is null

createNode

public CreateNodeRequest createNode(Location parentLocation,
                                    String workspaceName,
                                    Name childName,
                                    Property[] properties)
Add a request to create a node with the given properties under the supplied location.

Parameters:
parentLocation - the location of the existing parent node, under which the new child should be created
workspaceName - the name of the workspace containing the parent
childName - the name of the new child to create under the existing parent
properties - the properties of the new node, which should include any identification properties for the new node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location, workspace name, or child name is null

createNode

public CreateNodeRequest 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.

Parameters:
parentLocation - the location of the existing parent node, under which the new child should be created
workspaceName - the name of the workspace containing the parent
childName - the name of the new child to create under the existing parent
properties - the properties of the new node, which should include any identification properties for the new node
conflictBehavior - the expected behavior if an equivalently-named child already exists under the into location
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location, workspace name, or child name is null

setProperty

public SetPropertyRequest setProperty(Location on,
                                      String workspaceName,
                                      Property property)
Add a request to update the property on the node at the supplied location. This request will create the property if it does not yet exist.

Parameters:
on - the location of the node to be read
workspaceName - the name of the workspace containing the node
property - the new property on the node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if there are no properties to update

setProperties

public Request setProperties(Location on,
                             String workspaceName,
                             Property... properties)
Add a request to update the properties on the node at the supplied location.

Parameters:
on - the location of the node to be read
workspaceName - the name of the workspace containing the node
properties - the new properties on the node
Returns:
the SetPropertyRequest or UpdatePropertiesRequest request, depending upon the number of properties being set; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if there are no properties to update

removeProperty

public RemovePropertyRequest removeProperty(Location on,
                                            String workspaceName,
                                            Name propertyName)
Add a request to remove the property with the supplied name from the given node. Supplying a name for a property that does not exist will not cause an error.

Parameters:
on - the location of the node to be read
workspaceName - the name of the workspace containing the node
propertyName - the name of the property that is to be removed
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if there are no properties to remove

removeProperties

public Request removeProperties(Location on,
                                String workspaceName,
                                Name... propertyNames)
Add a request to remove from the node the properties with the supplied names. Supplying a name for a property that does not exist will not cause an error.

Parameters:
on - the location of the node to be read
workspaceName - the name of the workspace containing the node
propertyNames - the names of the properties that are to be removed
Returns:
the RemovePropertyRequest or UpdatePropertiesRequest request, depending upon the number of properties being removed; never null
Throws:
IllegalArgumentException - if the location or workspace name is null or if there are no properties to remove

renameNode

public RenameNodeRequest renameNode(Location at,
                                    String workspaceName,
                                    Name newName)
Add a request to rename the node at the supplied location.

Parameters:
at - the location of the node to be read
workspaceName - the name of the workspace containing the node
newName - the new name for the node
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null

copyBranch

public CopyBranchRequest copyBranch(Location from,
                                    String fromWorkspace,
                                    Location into,
                                    String intoWorkspace,
                                    Name nameForCopy,
                                    NodeConflictBehavior conflictBehavior)
Add a request to copy a branch to another.

Parameters:
from - the location of the top node in the existing branch that is to be copied
fromWorkspace - the name of the workspace where the from node exists
into - the location of the existing node into which the copy should be placed
intoWorkspace - the name of the workspace where the into node is to be copied
nameForCopy - the desired name for the node that results from the copy, or null if the name of the original should be used
conflictBehavior - the expected behavior if an equivalently-named child already exists at the into location, or null if the default conflict behavior should be used
Returns:
the request; never null
Throws:
IllegalArgumentException - if either of the locations or workspace names are null

moveBranch

public MoveBranchRequest moveBranch(Location from,
                                    Location into,
                                    String workspaceName)
Create a request to move a branch from one location into another.

Parameters:
from - the location of the top node in the existing branch that is to be moved
into - the location of the existing node into which the branch should be moved
workspaceName - the name of the workspace
Returns:
the request; never null
Throws:
IllegalArgumentException - if any of the parameters are null

moveBranch

public MoveBranchRequest moveBranch(Location from,
                                    Location into,
                                    String workspaceName,
                                    Name newNameForNode)
Create a request to move a branch from one location into another.

Parameters:
from - the location of the top node in the existing branch that is to be moved
into - the location of the existing node into which the branch should be moved
workspaceName - the name of the workspace
newNameForNode - the new name for the node being moved, or null if the name of the original should be used
Returns:
the request; never null
Throws:
IllegalArgumentException - if any of the parameters are null

moveBranch

public MoveBranchRequest moveBranch(Location from,
                                    Location into,
                                    String workspaceName,
                                    Name newNameForNode,
                                    NodeConflictBehavior conflictBehavior)
Create a request to move a branch from one location into another.

Parameters:
from - the location of the top node in the existing branch that is to be moved
into - the location of the existing node into which the branch should be moved
workspaceName - the name of the workspace
newNameForNode - the new name for the node being moved, or null if the name of the original should be used
conflictBehavior - the expected behavior if an equivalently-named child already exists at the into location
Returns:
the request; never null
Throws:
IllegalArgumentException - if any of the parameters are null

moveBranch

public MoveBranchRequest moveBranch(Location from,
                                    Location into,
                                    String workspaceName,
                                    NodeConflictBehavior conflictBehavior)
Create a request to move a branch from one location into another.

Parameters:
from - the location of the top node in the existing branch that is to be moved
into - the location of the existing node into which the branch should be moved
workspaceName - the name of the workspace
conflictBehavior - the expected behavior if an equivalently-named child already exists at the into location
Returns:
the request; never null
Throws:
IllegalArgumentException - if any of the parameters are null

deleteBranch

public DeleteBranchRequest deleteBranch(Location at,
                                        String workspaceName)
Add a request to delete a branch.

Parameters:
at - the location of the top node in the existing branch that is to be deleted
workspaceName - the name of the workspace containing the parent
Returns:
the request; never null
Throws:
IllegalArgumentException - if the location or workspace name is null


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