|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.ogsadai.activity.ActivityBase
uk.org.ogsadai.activity.IterativeActivity
public abstract class IterativeActivity
An abstract activity base class that provides a template for a simple
iterative processing algorithm. This is an example of the template design
pattern. The skeleton for the iterative processing algorithm is defined in
the process() method. Several steps of the algorithm are
deferred to concrete sub-classes.
The processing algorithm has the following form:
preprocess();
WHILE more processing to do
processIteration();
END-WHILE
postprocess();
cleanUp();
The methods shown in italics must be implemented by a concrete
sub-class. These comprise the processing stage of the algorithm. The
cleanUp() method may optionally be overridden. If any exceptions
are raised during the processing stage, execution jumps straight to the
cleanUp() method, before the exception is thrown onwards.
| Field Summary |
|---|
| Fields inherited from class uk.org.ogsadai.activity.ActivityBase |
|---|
mContracts |
| Constructor Summary | |
|---|---|
IterativeActivity()
|
|
| Method Summary | |
|---|---|
protected void |
cleanUp()
Cleans up the activity. |
protected void |
iterativeStageComplete()
Invoked by a subclass to indicate that the iterative stage of processing is complete. |
protected abstract void |
postprocess()
Performs any post-processing required after the iterative part of the activity processing has completed. |
protected abstract void |
preprocess()
Performs any pre-processing required before the iterative part of the activity processing commences. |
void |
process()
Processes the activity to completion. |
protected abstract void |
processIteration()
Performs an iteration of the activity processing. |
| Methods inherited from class uk.org.ogsadai.activity.ActivityBase |
|---|
addInput, addOutput, close, closeDueToError, getActivityContracts, getActivityDescriptor, getInput, getInput, getInputs, getOutput, getOutput, getOutputs, hasInput, hasOutput, removeInput, setActivityDescriptor, toString, validateInput, validateInputs, validateOutput, validateOutputs |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IterativeActivity()
| Method Detail |
|---|
public final void process()
throws ActivityUserException,
ActivityProcessingException,
ActivityTerminatedException
Activity
ActivityUserException - If the settings specified by the user prevent processing from
completing.
ActivityProcessingException - If an internal error prevents processing from completing.
ActivityTerminatedException - If activity processing is terminated at an intermediate
stage. This occurs when the thread processing the activity is
interrupted.protected void iterativeStageComplete()
protected abstract void preprocess()
throws ActivityUserException,
ActivityProcessingException,
ActivityTerminatedException
ActivityUserException - if the settings specified by the user prevent processing from
completing
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate
stage
protected abstract void processIteration()
throws ActivityProcessingException,
ActivityTerminatedException,
ActivityUserException
ActivityUserException - if the settings specified by the user prevent processing from
completing
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate
stage
protected abstract void postprocess()
throws ActivityUserException,
ActivityProcessingException,
ActivityTerminatedException
ActivityUserException - if the settings specified by the user prevent processing from
completing
ActivityProcessingException - if an internal error prevents processing from completing
ActivityTerminatedException - if activity processing is terminated at an intermediate stage
protected void cleanUp()
throws java.lang.Exception
super.cleanUp().
This method will be invoked either after the postprocess()
method returns successfully, or after an exception has occurred during
the processing stage. Any further exceptions raised during clean-up will
be logged rather than thrown upwards.
java.lang.Exception - if an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||