uk.org.ogsadai.activity.transform
Class BlockAggregatorActivity

java.lang.Object
  |
  +--uk.org.ogsadai.engine.Activity
        |
        +--uk.org.ogsadai.activity.transform.BlockAggregatorActivity

public class BlockAggregatorActivity
extends Activity

This activity aggregates blocks together using overloaded processBlocks(Type) methods. Currently has methods for both String and Node types, but only String types are enabled. The method for aggregating Node's is currently untested.


Field Summary
 
Fields inherited from class uk.org.ogsadai.engine.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
BlockAggregatorActivity(org.w3c.dom.Element element)
          Retrieves the blocksize and input/output pipe names.
 
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()
          This method reads in a block then hands it off to a processBlocks(Type) method to pull in the remaining blocks in the particular aggregation.
protected  java.lang.Object processBlocks(org.w3c.dom.Node node)
          Aggregates DOM Nodes.
protected  java.lang.Object processBlocks(java.lang.String string)
          Aggregates Strings
 
Methods inherited from class uk.org.ogsadai.engine.Activity
cleanUp, connectsTo, getActivityConfiguration, getName, getObservableStatus, getProperties, getStatus, hasActivityConfiguration, hasProperties, processFirst, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockAggregatorActivity

public BlockAggregatorActivity(org.w3c.dom.Element element)
                        throws ActivitySystemException,
                               ActivityUserException
Retrieves the blocksize and input/output pipe names.

Parameters:
element - - the Element the Activity is based upon
Throws:
ActivitySystemException - if the size attribute is not a valid representation of an integer.
ActivityUserException
Method Detail

processBlock

public void processBlock()
This method reads in a block then hands it off to a processBlocks(Type) method to pull in the remaining blocks in the particular aggregation.

Specified by:
processBlock in class Activity

processBlocks

protected java.lang.Object processBlocks(java.lang.String string)
                                  throws ActivityUserException,
                                         CommonSystemException
Aggregates Strings

Parameters:
string -
Returns:
the aggregated strings
Throws:
java.lang.Exception
ActivityUserException
CommonSystemException

processBlocks

protected java.lang.Object processBlocks(org.w3c.dom.Node node)
                                  throws java.lang.Exception
Aggregates DOM Nodes. This can handle Elements, Nodes and DocumentFragments

Parameters:
node -
Returns:
the nodes aggregated into a DocumentFragment node
Throws:
java.lang.Exception

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.