|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.activity.ActivityPipelineRequestComponent
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.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement. |
private static DAILogger |
LOG
Logger object for logging in this class. |
private java.util.List |
mActivities
A list of the activities contained in the pipeline. |
private ActivityContext |
mContext
The context of the activities in the pipeline. |
private ObserverActivity[] |
mObserverActivities
Internal activities to observe status of activities driven by external outputs. |
private ResponseBuilder |
mResponseBuilder
Builder used for assembling parts of the response document. |
private ResultActivity[] |
mResultActivities
Internal activities to read data from unconnected internal outputs. |
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. |
private void |
buildResponse()
Assembles the parts of the response document corresponding to each activity's status and result data. |
private void |
checkForErrors()
Checks whether there has been an error while processing the pipeline. |
java.util.List |
children()
Returns a non-mutable list of the children of this RequestComponent . |
boolean |
containsActivity(java.lang.String activityName)
Returns true if the specified activity is
contained in this pipeline. |
private void |
createInternalActivities()
Creates some special internal activities that are needed for processing the activities contained in the pipeline. |
boolean |
generatesResultData()
Indicates whether or not this component will generate any result data. |
private Activity[] |
getAllActivities()
Gets an array of all the activities, internal and external. |
private java.util.List |
getEndPointActivities()
Gets the end-point activities, both internal and external, that will drive the execution of the request. |
private java.util.List |
getExternalOutputActivities()
Returns an array of the activities with external outputs. |
private java.lang.String[] |
getUnconnectedOutputs()
Returns an array of the unconnected outputs from the activites contained in the pipeline. |
void |
initialise(ActivityContext context,
Session session,
ResponseBuilder responseBuilder)
Initialises the component. |
private void |
prepareActivities(ActivityContext activityContext,
Session session)
Prepares the activities for processing. |
void |
process(ActivityContext 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 |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
private final java.util.List mActivities
private ResultActivity[] mResultActivities
private ObserverActivity[] mObserverActivities
private ActivityContext mContext
private ResponseBuilder mResponseBuilder
Constructor Detail |
public ActivityPipelineRequestComponent()
ActivityPipelineRequestComponent
. The activities
contained in the pipeline are added using repeated invocations
of the addActivity
method.
Method Detail |
public void initialise(ActivityContext context, Session session, ResponseBuilder responseBuilder) throws RequestSpecificationException, RequestExecutionException
RequestComponent
generatesResultData
method must operational.
initialise
in interface RequestComponent
context
- The context for the requestsession
- The session for the requestresponseBuilder
- The response builder for assembling the response document
RequestSpecificationException
- If there is an initialisation problem caused by incorrect
information in the request.
RequestExecutionException
- If a problem occurs during initialisation that is not
caused by incorrect information in the request.public void process(ActivityContext context, ResponseBuilder responseBuilder) throws RequestSpecificationException, RequestExecutionException
RequestComponent
terminate
method by another thread. Hence,
when this method returns processing will be either complete or
terminated.
process
in interface RequestComponent
context
- The context for the requestresponseBuilder
- The response builder for assembling the response document
during processing
RequestExecutionException
- If a problem occurs during processing that is not
caused by incorrect information in the request.
RequestSpecificationException
- If there is a processing problem caused by incorrect
information in the request.private java.util.List getEndPointActivities()
Activity
objects.private void prepareActivities(ActivityContext activityContext, Session session) throws RequestSpecificationException, RequestExecutionException
initialise
methods.
activityContext
- Current activity context.session
- The session for the request
RequestSpecificationException
- If any activity contains incorrect parameters provided by
a client.
RequestExecutionException
- If some internal problem arises during execution.private void createInternalActivities() throws RequestExecutionException
ResultActivity
objects which read the result data
generated by the pipeline. Secondly,
ObserverActivity
objects which monitor the
status of any activities which are driven by external outputs
to determine when they are complete.
RequestExecutionException
- If some internal problem arises during execution.private final java.lang.String[] getUnconnectedOutputs()
private final java.util.List getExternalOutputActivities()
Activity
objects.private void checkForErrors()
ERROR
TODO - review and devise better approach.
private void buildResponse()
ResultActivity
objects.
private Activity[] getAllActivities()
public void add(RequestComponent child)
RequestComponent
add
in interface RequestComponent
child
- The child RequestComponent
public java.util.List children()
RequestComponent
RequestComponent
. If this component is a leaf and
not a composite then
java.util.Collections.EMPTY_LIST
should be
returned.
children
in interface RequestComponent
java.util.List
containing any children.public void addActivity(Activity activity)
activity
- The Activity
to add to this pipelinepublic boolean containsActivity(java.lang.String activityName)
true
if the specified activity is
contained in this pipeline.
activityName
- The name of the activity
true
if the activity is contained in the pipeline,
false
otherwisepublic boolean generatesResultData()
RequestComponent
initialise
method has returned. This method is
used by the engine to determine whether to process a request
synchronously or asynchronously.
generatesResultData
in interface RequestComponent
true
if so, false
otherwisepublic void terminate()
RequestComponent
terminate
in interface RequestComponent
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |