uk.org.ogsadai.engine
Class ActivityPipelineRequestComponent

java.lang.Object
  |
  +--uk.org.ogsadai.engine.ActivityPipelineRequestComponent
All Implemented Interfaces:
RequestComponent

public class ActivityPipelineRequestComponent
extends java.lang.Object
implements RequestComponent

A RequestComponent that consists of an activity or a pipeline of connected activities. In the case of a pipeline of activities, the activities will be processed simultaneously, with data streaming from one end of the pipeline to the other when the process method is invoked.

Author:
The OGSA-DAI Project Team

Constructor Summary
ActivityPipelineRequestComponent()
          Constructs an ActivityPipelineRequestComponent.
 
Method Summary
 void add(RequestComponent child)
          Adds a child to a composite component.
 void addActivity(Activity activity)
          Adds the specified activity to this activity pipeline.
 java.util.List children()
          Since this is a leaf RequestComponent this method returns an empty java.util.Iterator.
 boolean containsActivity(java.lang.String activityName)
          Returns true if the specified activity is contained in this pipeline.
 boolean generatesResultData()
          Indicates whether or not this component will generate any result data.
 void initialise(EngineConfiguration config, RequestContext context, ResponseBuilder responseBuilder)
          Initialises the component.
 void process(EngineConfiguration config, RequestContext context, ResponseBuilder responseBuilder)
          Processes the component.
 void terminate()
          Terminates the processing of the request component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityPipelineRequestComponent

public ActivityPipelineRequestComponent()
Constructs an ActivityPipelineRequestComponent. The activities contained in the pipeline are added using repeated invocations of the addActivity method.

Method Detail

initialise

public void initialise(EngineConfiguration config,
                       RequestContext context,
                       ResponseBuilder responseBuilder)
                throws RequestSystemException,
                       RequestUserException
Description copied from interface: RequestComponent
Initialises the component. After this method has been returned the generatesResultData method must operational.

Specified by:
initialise in interface RequestComponent
Parameters:
config - the configuration object for the engine that will process this request component
context - the context for the request
responseBuilder - the response builder for assembling the response document
Throws:
RequestUserException - if there is a user problem during initialisation.
RequestSystemException - if there is a system problem during initialisation.

process

public void process(EngineConfiguration config,
                    RequestContext context,
                    ResponseBuilder responseBuilder)
             throws RequestSystemException,
                    RequestUserException
Description copied from interface: RequestComponent
Processes the component. If this is a composite component, then any child components will be processed recursively. Wherever possible an implementation should be coded in such a way that the processing can be terminated prematurely by an invocation of the terminate method by another thread. Hence, when this method returns processing will be either complete or terminated.

Specified by:
process in interface RequestComponent
Parameters:
config - the configuration object for the engine that is processing this request component
context - the context for the request
responseBuilder - the response builder for assembling the response document during processing
Throws:
RequestSystemException - if there is a system problem initialising or processing the request.
RequestUserException - if there is a user problem initialising or processing the request.

add

public void add(RequestComponent child)
Description copied from interface: RequestComponent
Adds a child to a composite component. Note that an empty implementation of this method should be provided for any leaf components.

Specified by:
add in interface RequestComponent
Parameters:
child - the child RequestComponent

children

public java.util.List children()
Since this is a leaf RequestComponent this method returns an empty java.util.Iterator.

Specified by:
children in interface RequestComponent
Returns:
a java.util.List containing any children
See Also:
RequestComponent.children()

addActivity

public void addActivity(Activity activity)
Adds the specified activity to this activity pipeline.

Parameters:
activity - the Activity to add to this pipeline

containsActivity

public boolean containsActivity(java.lang.String activityName)
Returns true if the specified activity is contained in this pipeline.

Parameters:
activityName - the name of the activity
Returns:
true if the activity is contained in the pipeline, false otherwise

generatesResultData

public boolean generatesResultData()
Description copied from interface: RequestComponent
Indicates whether or not this component will generate any result data. This can only be invoked after the initialise method has returned. This method is used by the Engine to determine whether to process a request synchronously or asynchronously.

Specified by:
generatesResultData in interface RequestComponent
Returns:
true if so, false otherwise

terminate

public void terminate()
Description copied from interface: RequestComponent
Terminates the processing of the request component. When this method returns, any threads and other resources associated with the processing of this request must be finished with.

Specified by:
terminate in interface RequestComponent