|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.activity.Activity | +--uk.org.ogsadai.activity.misc.DataStoreActivity
The DataStoreActivity
acts as a cache of data from which other
activities can retrieve blocks at their convenience. These activities must
belong to the same request and the cached data does not persist after the
request has completed. There are 2 different modes of
operation:
The
The DataStoreActivity
is particularly useful for
requests containing a database query connected to an asynchronous
delivery activity. Under normal circumstances the database query
will not be evaluated until the consumer of the asynchronous
delivery begins consumption. A DataStoreActivity
can
be connected between the database query and asynchrnonous delivery
activity to ensure that the database query is evaluated
immediately, rather than waiting until the consumer of the asynchronous
delivery begins consumption.
Note that at the moment the actual cache implementation is simply
an ArrayList
accessed through an iterator. For large
amounts of data this is likely to generate an
OutOfMemoryError
. In the future this could be modified
to use some kind of semi-persistent storage.
See the activity user documentation for more details: OGSADAI/doc/interaction/activities/misc/dataStore.html
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement. |
private BlockReader |
mInput
Input from which data may be read before activity processing begins. |
private java.util.Iterator |
mItems
Iterates through the items stored in the cache. |
private BlockWriter |
mOutput
Output to which the data contained in the cache is written. |
private boolean |
mValuesHardcoded
Mode of operation: true for data hardcoded,
false for data read from input. |
Fields inherited from class uk.org.ogsadai.activity.Activity |
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs |
Constructor Summary | |
DataStoreActivity(org.w3c.dom.Element element)
|
Method Summary | |
private void |
constructHardcoded(org.w3c.dom.Element element)
Completes construction for the activity using the hardcoded data mode. |
private void |
constructInputFed(org.w3c.dom.Element element)
Completes construction for the activity using the input-fed mode. |
private java.lang.Object |
getItemObject(org.w3c.dom.Element itemElement)
Adds the contents of an item element to the data store. |
void |
initialise()
This method should be overridden by subclasses to perform any initialisation they require before the process
method invocations begin. |
protected void |
processBlock()
Performs an iteration of the processing of an activity. |
Methods inherited from class uk.org.ogsadai.activity.Activity |
cleanUp, connectsTo, createOutputPipe, getActivityConfiguration, getActivityName, getCause, getName, getObservableStatus, getProperties, getSession, getStatus, hasActivityConfiguration, hasProperties, process, processFirst, setActivityName, setCompleted, setError |
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 boolean mValuesHardcoded
true
for data hardcoded,
false
for data read from input.
private BlockReader mInput
private BlockWriter mOutput
private java.util.Iterator mItems
Constructor Detail |
public DataStoreActivity(org.w3c.dom.Element element) throws ActivitySpecificationException, ActivityCreationException
Method Detail |
private void constructInputFed(org.w3c.dom.Element element)
element
- Activity element from the request containing the activity
settings.private void constructHardcoded(org.w3c.dom.Element element) throws ActivitySpecificationException
element
- Activity element from the request containing the activity
settings.
ActivitySpecificationException
- If the data is not a text node, CDATA section or element,
or if the data is a text node or CDATA section it is an XML
fragment.private java.lang.Object getItemObject(org.w3c.dom.Element itemElement) throws ActivitySpecificationException
itemElement
- Element from the activity element in the request that
contains the hard-coded data.
ActivitySpecificationException
- If the data is not a text node, CDATA section or element,
or if the data is a text node or CDATA section it is an XML
fragment.protected void processBlock()
Activity
setCompleted
method to indicate that
processing is complete, or the setError
method if
an error occurs that will prevent the processing from
completing.
processBlock
in class Activity
public void initialise() throws ActivitySpecificationException, ActivityExecutionException
Activity
process
method invocations begin. This might be used for setting up
convenient fields to reference objects contained in the
context. It shouldn't be used for opening resources.
That should be done in processFirst
.
initialise
in class Activity
ActivityExecutionException
- If some system problem prevents the activity from
initialising.
ActivitySpecificationException
- If a problem with settings provided by a client prevents
the activity from initialising.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |