uk.org.ogsadai.activity.delivery
Class AbstractDeliverFromAddressActivity

java.lang.Object
  |
  +--uk.org.ogsadai.engine.Activity
        |
        +--uk.org.ogsadai.activity.delivery.AbstractDeliverFromAddressActivity
Direct Known Subclasses:
DeliverFromFileActivity, DeliverFromURLActivity

public abstract class AbstractDeliverFromAddressActivity
extends Activity

This abstract class is subclassed by DeliverFromURLActivity and DeliverFromFileActivity. It contains methods to connect to a java.io.InputStream and pull all the information on that stream into OGSA-DAI, either in one byte array block, or via multiple set sized byte array blocks. The output can then be connected to the input of another activity, such as an SQLBulkLoadRowSetActivity.

Author:
The OGSA-DAI Project Team

Field Summary
protected  boolean mBlockMode
          Size of blocks placed onto the stream
protected  byte[] mBuffer
          Buffer to hold data
protected  java.io.ByteArrayOutputStream mByteBuffer
          ByteArrayOutputStream to hold data
protected  java.lang.String mFromAddress
          String version of address to read data from.
protected  java.io.InputStream mFromInputStream
          Data contained at URL read from this input stream.
protected  BlockWriter mOutput
          The data retrieved from the URL is written to this output.
 
Fields inherited from class uk.org.ogsadai.engine.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
AbstractDeliverFromAddressActivity(org.w3c.dom.Element element)
          Dafault constructor
 
Method Summary
 void initialise()
          This method can be overridden by subclasses to perform any initialisation they require before the process method iterations begin.
 void processBlock()
          Performs an iteration of the processing of an activity.
abstract  void processFirst()
          Implementations of this method MUST create the protected java.io.InputStream object mInputStream for use in the processBlock() method.
protected  void setupBlocking(org.w3c.dom.Element fromElement)
           
protected  void setupOutput(org.w3c.dom.Element toElement)
          Gets the name of the activity output from the toLocal element.
 
Methods inherited from class uk.org.ogsadai.engine.Activity
cleanUp, connectsTo, getActivityConfiguration, getName, getObservableStatus, getProperties, getStatus, hasActivityConfiguration, hasProperties, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mFromAddress

protected java.lang.String mFromAddress
String version of address to read data from.


mFromInputStream

protected java.io.InputStream mFromInputStream
Data contained at URL read from this input stream.


mBlockMode

protected boolean mBlockMode
Size of blocks placed onto the stream


mBuffer

protected byte[] mBuffer
Buffer to hold data


mByteBuffer

protected final java.io.ByteArrayOutputStream mByteBuffer
ByteArrayOutputStream to hold data


mOutput

protected BlockWriter mOutput
The data retrieved from the URL is written to this output.

Constructor Detail

AbstractDeliverFromAddressActivity

public AbstractDeliverFromAddressActivity(org.w3c.dom.Element element)
                                   throws ActivitySystemException,
                                          ActivityUserException
Dafault constructor

Method Detail

setupBlocking

protected void setupBlocking(org.w3c.dom.Element fromElement)
                      throws ActivitySystemException
ActivitySystemException

setupOutput

protected void setupOutput(org.w3c.dom.Element toElement)
Gets the name of the activity output from the toLocal element.

Parameters:
toElement -

initialise

public void initialise()
                throws ActivityUserException
Description copied from class: Activity
This method can be overridden by subclasses to perform any initialisation they require before the process method iterations 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.

Overrides:
initialise in class Activity
Throws:
ActivityUserException - If a user problem prevents the activity from initialising.

processFirst

public abstract void processFirst()
Implementations of this method MUST create the protected java.io.InputStream object mInputStream for use in the processBlock() method.

Overrides:
processFirst in class Activity
See Also:
Activity.processFirst()

processBlock

public void processBlock()
Description copied from class: Activity
Performs an iteration of the processing of an activity. This may involve reading a block of input data and writing a block of output data, or may involve some other kind of processing. When an activity is processed by the OGSA-DAI engine, this method will be invoked repeatedly until the activity either completes or stops due to an error or termination call. An implementation of this method should invoke the setCompleted method to indicate that processing is complete, or the setError method if an error occurs that will prevent the processing from completing.

Specified by:
processBlock in class Activity
See Also:
Activity.processBlock()