org.jboss.dna.graph.requests.processor
Class RequestProcessor

java.lang.Object
  extended by org.jboss.dna.graph.requests.processor.RequestProcessor
Direct Known Subclasses:
FederatingCommandExecutor, LoggingRequestProcessor, SingleProjectionCommandExecutor

@Immutable
public abstract class RequestProcessor
extends Object

A component that is used to process and execute Requests. This class is intended to be subclassed and methods overwritten to define the behavior for executing the different kinds of requests. Abstract methods must be overridden, but non-abstract methods all have meaningful default implementations.

Author:
Randall Hauch

Method Summary
 void close()
          Close this processor, allowing it to clean up any open resources.
 ExecutionContext getExecutionContext()
          The execution context that this process is operating within.
 String getSourceName()
          Get the name of the source against which this processor is executing.
 void process(CompositeRequest request)
          Process a request that is composed of multiple other (non-composite) requests.
abstract  void process(CopyBranchRequest request)
          Process a request to copy a branch into another location.
abstract  void process(CreateNodeRequest request)
          Process a request to create a node at a specified location.
abstract  void process(DeleteBranchRequest request)
          Process a request to delete a branch at a specified location.
abstract  void process(MoveBranchRequest request)
          Process a request to move a branch at a specified location into a different location.
abstract  void process(ReadAllChildrenRequest request)
          Process a request to read all of the children of a node.
abstract  void process(ReadAllPropertiesRequest request)
          Process a request to read the properties of a node at the supplied location.
 void process(ReadBlockOfChildrenRequest request)
          Process a request to read a block of the children of a node.
 void process(ReadBranchRequest request)
          Process a request to read a branch or subgraph that's below a node at a specified location.
 void process(ReadNextBlockOfChildrenRequest request)
          Process a request to read the next block of the children of a node, starting after a previously-retrieved child.
 void process(ReadNodeRequest request)
          Process a request to read the properties and children of a node at the supplied location.
 void process(ReadPropertyRequest request)
          Process a request to read a single property of a node at the supplied location.
 void process(RemovePropertiesRequest request)
          Process a request to remove the specified properties from a node.
 void process(RenameNodeRequest request)
          Process a request to rename a node specified location into a different location.
 void process(Request request)
          Process a request by determining the type of request and delegating to the appropriate process method for that type.
abstract  void process(UpdatePropertiesRequest request)
          Process a request to remove the specified properties from a node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSourceName

public String getSourceName()
Get the name of the source against which this processor is executing.

Returns:
the repository source name; never null or empty

getExecutionContext

public ExecutionContext getExecutionContext()
The execution context that this process is operating within.

Returns:
the execution context; never null

process

public void process(Request request)
Process a request by determining the type of request and delegating to the appropriate process method for that type.

This method does nothing if the request is null.

Parameters:
request - the general request

process

public void process(CompositeRequest request)
Process a request that is composed of multiple other (non-composite) requests. If any of the embedded requests has an error after it is processed, the submitted request will be marked with an error.

This method does nothing if the request is null.

Parameters:
request - the composite request

process

public abstract void process(CopyBranchRequest request)
Process a request to copy a branch into another location.

This method does nothing if the request is null.

Parameters:
request - the copy request

process

public abstract void process(CreateNodeRequest request)
Process a request to create a node at a specified location.

This method does nothing if the request is null.

Parameters:
request - the create request

process

public abstract void process(DeleteBranchRequest request)
Process a request to delete a branch at a specified location.

This method does nothing if the request is null.

Parameters:
request - the delete request

process

public abstract void process(MoveBranchRequest request)
Process a request to move a branch at a specified location into a different location.

This method does nothing if the request is null.

Parameters:
request - the move request

process

public abstract void process(ReadAllChildrenRequest request)
Process a request to read all of the children of a node.

This method does nothing if the request is null.

Parameters:
request - the read request

process

public void process(ReadBlockOfChildrenRequest request)
Process a request to read a block of the children of a node. The block is defined by a starting index and a maximum number of children to include in the block.

This method does nothing if the request is null. The default implementation converts the command to a ReadAllChildrenRequest, and then finds the children within the block. Obviously for large numbers of children, this implementation may not be efficient and may need to be overridden.

Parameters:
request - the read request

process

public void process(ReadNextBlockOfChildrenRequest request)
Process a request to read the next block of the children of a node, starting after a previously-retrieved child.

This method does nothing if the request is null. The default implementation converts the command to a ReadAllChildrenRequest, and then finds the children within the block. Obviously for large numbers of children, this implementation may not be efficient and may need to be overridden.

Parameters:
request - the read request

process

public void process(ReadBranchRequest request)
Process a request to read a branch or subgraph that's below a node at a specified location.

This method does nothing if the request is null. The default implementation processes the branch by submitting the equivalent requests to read the nodes and the children. It starts by doing this for the top-level node, then proceeds for each of the children of that node, and so forth.

Parameters:
request - the request to read the branch

process

public abstract void process(ReadAllPropertiesRequest request)
Process a request to read the properties of a node at the supplied location.

This method does nothing if the request is null.

Parameters:
request - the read request

process

public void process(ReadNodeRequest request)
Process a request to read the properties and children of a node at the supplied location.

This method does nothing if the request is null. Unless overridden, this method converts the single request into a ReadAllChildrenRequest and a ReadAllPropertiesRequest.

Parameters:
request - the read request

process

public void process(ReadPropertyRequest request)
Process a request to read a single property of a node at the supplied location.

This method does nothing if the request is null. Unless overridden, this method converts the request that reads the node and simply returns the one property.

Parameters:
request - the read request

process

public void process(RemovePropertiesRequest request)
Process a request to remove the specified properties from a node.

This method does nothing if the request is null. Unless overridden, this method converts this request into a UpdatePropertiesRequest.

Parameters:
request - the request to remove the properties with certain names

process

public abstract void process(UpdatePropertiesRequest request)
Process a request to remove the specified properties from a node.

This method does nothing if the request is null.

Parameters:
request - the remove request

process

public void process(RenameNodeRequest request)
Process a request to rename a node specified location into a different location.

This method does nothing if the request is null. Unless overridden, this method converts the rename into a move. However, this only works if the request has a path for its location. (If not, this method throws an UnsupportedOperationException and must be overriddent.)

Parameters:
request - the rename request

close

public void close()
Close this processor, allowing it to clean up any open resources.



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