|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.ogsadai.activity.ActivityBase
public abstract class ActivityBase
An abstract activity base class that provides access to input and output pipes, activity contracts and simple validation functionality. This functionality is common to most activity implementations, however a concrete activity will not normally extend this class directly. Instead a concrete class will typically extend one of the direct sub-classes of this class.
| Field Summary | |
|---|---|
protected java.util.Set |
mContracts
Set of contracts satisfied by the activity. |
| Constructor Summary | |
|---|---|
ActivityBase()
|
|
| Method Summary | |
|---|---|
void |
addInput(java.lang.String name,
BlockReader input)
Adds an input to the activity. |
void |
addOutput(java.lang.String name,
BlockWriter output)
Adds an output to the activity. |
protected void |
close()
Closes all of the inputs and outputs of the activity. |
protected void |
closeDueToError()
Closes all inputs and outputs of the activity due to an error. |
java.util.Set |
getActivityContracts()
Gets the set of the contracts satisfied by the activity. |
ActivityDescriptor |
getActivityDescriptor()
Gets a description of the activity instance. |
protected BlockReader |
getInput()
Gets the input for an activity that has only one input. |
protected BlockReader |
getInput(java.lang.String name)
Gets the first activity input with the specified name. |
protected java.util.List |
getInputs(java.lang.String name)
Gets the activity inputs with the specified name. |
protected BlockWriter |
getOutput()
Gets the output for an activity that has only one output. |
protected BlockWriter |
getOutput(java.lang.String name)
Gets the first activity output with the specified name. |
protected java.util.List |
getOutputs(java.lang.String name)
Gets the activity outputs with the specified name. |
protected boolean |
hasInput(java.lang.String name)
Checks that an activity input exists with the specified input name. |
protected boolean |
hasOutput(java.lang.String name)
Checks that an activity output exists with the specified output name. |
protected void |
removeInput(java.lang.String name,
BlockReader reader)
Removes the given block reader with the specified name from the activity's inputs. |
void |
setActivityDescriptor(ActivityDescriptor descriptor)
Sets the activity descriptor for the activity instance. |
java.lang.String |
toString()
Returns a string description of the activity. |
protected void |
validateInput(java.lang.String name)
Validates the activity inputs by checking that an input exists with the specified input name. |
protected void |
validateInputs(java.lang.String name,
int number)
Validates the activity inputs by checking that a specified number of inputs exist with the specified input name. |
protected void |
validateOutput(java.lang.String name)
Validates the activity outputs by checking that an output exists with the specified output name. |
protected void |
validateOutputs(java.lang.String name,
int number)
Validates the activity outputs by checking that a specified number of outputs exist with the specified output name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface uk.org.ogsadai.activity.Activity |
|---|
process |
| Field Detail |
|---|
protected final java.util.Set mContracts
| Constructor Detail |
|---|
public ActivityBase()
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Set getActivityContracts()
Activity
getActivityContracts in interface Activitypublic void setActivityDescriptor(ActivityDescriptor descriptor)
Activity
setActivityDescriptor in interface Activitydescriptor - Description of the activity instance.public ActivityDescriptor getActivityDescriptor()
Activity
getActivityDescriptor in interface Activity
public void addInput(java.lang.String name,
BlockReader input)
Activity
addInput in interface Activityname - Name of the activity input.input - Block reader for reading the input data from.
protected void removeInput(java.lang.String name,
BlockReader reader)
name - name of the inputreader - the block reader to remove
public void addOutput(java.lang.String name,
BlockWriter output)
Activity
addOutput in interface Activityname - Name of the activity output.output - Block writer for writing the output data to.protected BlockReader getInput()
protected BlockReader getInput(java.lang.String name)
name - name of input
null if there is no
input with the specified nameprotected java.util.List getInputs(java.lang.String name)
name - name of inputs
protected BlockWriter getOutput()
protected BlockWriter getOutput(java.lang.String name)
name - name of output
null if there is
no output with the specified name.protected java.util.List getOutputs(java.lang.String name)
name - name of outputs
protected void validateInput(java.lang.String name)
throws InvalidActivityInputsException
name - required input name
InvalidActivityInputsException - if an input with the specified name does not exist
protected void validateInputs(java.lang.String name,
int number)
throws InvalidActivityInputsException
name - required input namenumber - number of inputs
InvalidActivityInputsException - if the expected number of inputs with the specified name do
not exist
protected void validateOutput(java.lang.String name)
throws InvalidActivityOutputsException
name - required output name
InvalidActivityOutputsException - if an output with the specified name does not exist
protected void validateOutputs(java.lang.String name,
int number)
throws InvalidActivityOutputsException
name - required output namenumber - number of outputs
InvalidActivityOutputsException - if the expected number of outputs with the specified name do
not existprotected boolean hasInput(java.lang.String name)
name - input name
true if so and false otherwise.protected boolean hasOutput(java.lang.String name)
name - output name
true if so and false otherwise.protected void close()
protected void closeDueToError()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||