The activity base classes
MatchedIterativeActivity and
MatchedIterativeMultipleInputActivity
classes both require the activity developer to implement the method:
protected abstract ActivityInput[] getIterationInputs();
Similary,
MatchedNestedIterativeActivity
requires implementation of:
protected abstract ActivityInput[] getOuterIterationInputs(); protected abstract NestedActivityInput[] getInnerIterationInputs();
These methods are used to specify the names and types of the
activity's inputs via instances of the
ActivityInput interface. This allows
the activity base classes to check for the existance of inputs and
their types, saving you the need to do it in your activity
code. However, depending upon the instances of
ActivityInput used it will also
determine what class is used to represent the input when the activity
framewok passes the inputs to the activity via the methods:
public void processIteration(Object[] iterationInputs);
for MatchedIterativeActivity and
MatchedIterativeMultipleInputActivity
and
protected abstract void startOuterIteration(Object[] outerData); protected abstract void processInnerIteration(Object[] innerData);
for MatchedNestedIterativeActivity.
For example, in our "hello name" activity example of Chapter 97, How to write a "hello name" activity with one input and output we saw how the activity declared it's input name and type using:
return new ActivityInput[] { new TypedActivityInput("input", String.class)};
This specifies that the activity is called
input, it is expected to be of type
java.lang.String and the actual data
will be provided to the activity as an object of this type.
In this section we list the classes that implement
ActivityInput, how they are used to
declare inputs and how they determine the type of data the activity
actually received by an activity.
uk.org.ogsadai.activity.io.TypedActivityInput
This is used to declare that an input has a given name and is expected to be of a given Java type. For example:
new TypedActivityInput("someName", String.class);
The activity will be passed the data as an object of the declared type.
uk.org.ogsadai.activity.io.TypedOptionalActivityInput
This is also used to declare that an input has a given name and is expected to be of a given Java type. However, it also specifies that the input is optional and a default value is provided to be used if the client does not provide a value. For example:
new TypedActivityInput("someOptionalName", String.class, "Julie");
The activity will be passed the data as an object of the declared type.
uk.org.ogsadai.activity.io.TypedListActivityInput
This is used to declare that an input has a given name and is expected to be an OGSA-DAI list of objects of a given type - that is, a sequence of objects delimited by
uk.org.ogsadai.activity.io.ControlBlock.LIST_BEGIN uk.org.ogsadai.activity.io.ControlBlock.LIST_END
For example:
new TypedListActivityInput("someList", String.class);
The activity will be passed a reference to an object of type:
uk.org.ogsadai.activity.io.ListIterator
This iterator will provide objects which can be cast to the specified
type e.g. String.
uk.org.ogsadai.activity.io.TypedOptionalListActivityInput
This is used to declare that an input has a given name and is expected to be an OGSA-DAI list of objects of a given type - that is, a sequence of objects delimited by
uk.org.ogsadai.activity.io.ControlBlock.LIST_BEGIN uk.org.ogsadai.activity.io.ControlBlock.LIST_END
However, it also specifies that the input is optional and a default value is provided to be used if the client does not provide a value. For example:
new TypesOptionalListActivityInput("someOptionalList", String.class, new ArrayList());
The activity will be passed a reference to an object of type:
uk.org.ogsadai.activity.io.ListIterator
This iterator will provide objects which can be cast to the specified
type e.g. String.
uk.org.ogsadai.activity.io.TableMetaDataListActivityInput
This is used to declare that an input has a given name and is expected
to be an OGSA-DAI list of
uk.org.ogsadai.converters.databaseschema.TableMetaData
objects delimited by
uk.org.ogsadai.activity.io.ControlBlock.LIST_BEGIN uk.org.ogsadai.activity.io.ControlBlock.LIST_END
For example:
new TableMetaDataLiActivityInput("someMetaData");
The activity will be passed a reference to an object of type:
uk.org.ogsadai.activity.io.ListIterator
This iterator will provide objects which can be cast to
TableMetaData.
uk.org.ogsadai.activity.io.TupleListActivityInput
This is used to declare that an input has a given name and is expected to be an OGSA-DAI list of tuples - that is, a sequence of objects delimited by
uk.org.ogsadai.activity.io.ControlBlock.LIST_BEGIN uk.org.ogsadai.activity.io.ControlBlock.LIST_END
For example:
new TupleListActivityInput("someTuples");
The activity will be passed a reference to an object of type:
uk.org.ogsadai.activity.io.TupleListIterator
This iterator will provide an object that can be cast to
uk.org.ogsadai.metadata.MetadataWrapper
which wraps a
uk.org.ogsadai.tuple.TupleMetadata
object and then 0 or more objects that can be cast to
uk.org.ogsadai.tuple.Tuple.
uk.org.ogsadai.activity.io.ReaderActivityInput
This is used to declare that an input has a given name and is expected to be something that is binary or character data. This includes inputs of type:
OGSA-DAI list of byte[] OGSA-DAI list of char[] java.sql.Blob java.sql.Clob
For example:
new ReaderActivityInput("myBinaryData");
For Blob and OGSA-DAI lists of
byte[], the data is converted to
character data using the UTF-8 encoding.
The activity will be passed a reference to an object of type:
java.io.Reader
uk.org.ogsadai.activity.io.InputStreamActivityInput
This is used to declare that an input has a given name and is expected to be something that is binary or character data. This includes inputs of type:
OGSA-DAI list of byte[] OGSA-DAI list of char[] java.sql.Blob java.sql.Clob
For example:
new InputStreamActivityInput("myBinaryData");
For Clob and OGSA-DAI lists of
char[] the data is converted to
binary data using the UTF-8 encoding.
The activity will be passed a reference to an object of type:
java.io.InputStream
uk.org.ogsadai.activity.io.ReaderListActivityInput
This is similar to
ReaderActivityInput but for the
following inputs:
OGSA-DAI list of OGSA-DAI list of byte[] OGSA-DAI list of OGSA-DAI list of char[] OGSA-DAI list of java.sql.Blob OGSA-DAI list of java.sql.Clob
It is declared as follows, for example:
new ReaderListActivityInput("someList");
uk.org.ogsadai.activity.io.InputStreamListActivityInput
This is similar to
InputStreamActivityInput but for the
following inputs:
OGSA-DAI list of OGSA-DAI list of byte[] OGSA-DAI list of OGSA-DAI list of char[] OGSA-DAI list of java.sql.Blob OGSA-DAI list of java.sql.Clob
It is declared as follows, for example:
new InputStreamListActivityInput("someList");
uk.org.ogsadai.activity.io.TypedNestedActivityInput
This is similar to
TypedActivityInput but for use in
declaring nested inputs in
MatchedNestedIterativeActivity.
It is declared as follows, for example:
new TypedNestedActivityInput("someList", String.class);
uk.org.ogsadai.activity.io.InputStreamNestedActivityInput
This is similar to
InputStreamActivityInput but for use in
declaring nested inputs in
MatchedNestedIterativeActivity.
It is declared as follows, for example:
new InputStreamNestedActivityInput("someNestedInput");
uk.org.ogsadai.activity.io.ReaderNestedActivityInput
This is similar to
ReaderActivityInput but for use in
declaring nested inputs in
MatchedNestedIterativeActivity.
It is declared as follows, for example:
new ReaderNestedActivityInput("someNestedInput");
uk.org.ogsadai.activity.io.StringActivityInput
This is similar to TypedActivityInput
but ensures that any input it receives is converted into a
java.lang.String via a
toString() call on the object. It is
declared as follows:
new StringActivityInput("someName");
uk.org.ogsadai.activity.io.StringActivityInputList
This is similar to
TypedActivityInputList but ensures
that any input it receives is converted into a
java.lang.String via a
toString() call on the object. It is
declared as follows:
new StringActivityInputList("someList");
uk.org.ogsadai.activity.io.StringNestedActivityInput
This is similar to
TypedNestedActivityInput but for
declaring nested inputs in
MatchedNestedIterativeActivity.
It ensures that any input it receives is converted into a
java.lang.String via a
toString() call on the object. It is
declared as follows:
new StringNestedActivityInput("someInput");