uk.org.ogsadai.client.toolkit.activity
Class SimpleActivityOutput

java.lang.Object
  extended by uk.org.ogsadai.client.toolkit.activity.SimpleActivityOutput
All Implemented Interfaces:
ActivityOutput

public class SimpleActivityOutput
extends java.lang.Object
implements ActivityOutput

Simple implementation of an activity output.

Author:
The OGSA-DAI project team

Field Summary
static boolean OPTIONAL
          Flag used to indicate an optional output.
static boolean REQUIRED
          Flag used to indicate a required output.
 
Constructor Summary
SimpleActivityOutput(java.lang.String outputName)
          Constucts an non-optional activity output.
SimpleActivityOutput(java.lang.String outputName, boolean isOptional)
          Constructs an activity output.
 
Method Summary
 DataValueIterator getDataValueIterator()
          Gets an iterator to the data values written to the first output occurrence.
 DataValueIterator getDataValueIterator(int index)
          Gets a DataValueIterator.
 int getNumberOfOutputs()
          Gets the number of output occurrences
 java.lang.String getOutputName()
          Gets the name of the output.
 java.lang.String getPipeName()
          Gets the name of the pipe associated with the first output occurrence.
 java.lang.String getPipeName(int index)
          Gets the pipe name that the occurrence at the specified index is connected to.
 SingleActivityOutput[] getSingleActivityOutputs()
          Gets an array of SingleActivityOutput
 boolean hasData()
          Gets whether data is available for the first output occurrence.
 boolean hasData(int index)
          Indicates whether occurrence at the specified index has more data
 void setDataSourceResource(DataSourceResource dataSourceResource)
          Deprecated.  
 void setDataSourceResource(int index, DataSourceResource dataSourceResource)
          Deprecated.  
 void setDataSourceResourceBlocksSize(int numBlocks)
          Deprecated.  
 void setDataSourceResourceBlocksSize(int index, int numBlocks)
          Deprecated.  
 void setDataValueIterator(DataValueIterator dataValueIterator)
          Sets the data value iterator to use when reading data from this input.
 void setDataValueIterator(int index, DataValueIterator dataValueIterator)
          Sets the data value iterator to use when reading data from this output.
 void setNumberOfOutputs(int count)
          Sets the occurrences of this output.
 java.lang.String toString()
           
 void validateState()
          Validates the state of the output by validating all the occurtences of the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTIONAL

public static boolean OPTIONAL
Flag used to indicate an optional output.


REQUIRED

public static boolean REQUIRED
Flag used to indicate a required output.

Constructor Detail

SimpleActivityOutput

public SimpleActivityOutput(java.lang.String outputName)
Constucts an non-optional activity output. A unique pipe name will be generated automatically.

Parameters:
outputName - output name.

SimpleActivityOutput

public SimpleActivityOutput(java.lang.String outputName,
                            boolean isOptional)
Constructs an activity output. A unique pipe name will be generated automatically.

Parameters:
outputName - output name.
isOptional - true if output is optional, false otherwise.
Method Detail

getOutputName

public java.lang.String getOutputName()
Description copied from interface: ActivityOutput
Gets the name of the output. This is label used to identify the various outputs from an activity. It is only unique within the activity.

Specified by:
getOutputName in interface ActivityOutput
Returns:
activity output name.

getPipeName

public java.lang.String getPipeName()
Description copied from interface: ActivityOutput
Gets the name of the pipe associated with the first output occurrence. This pipe name will be unique to this output instance.

Specified by:
getPipeName in interface ActivityOutput
Returns:
pipe name.

hasData

public boolean hasData()
Description copied from interface: ActivityOutput
Gets whether data is available for the first output occurrence.

Specified by:
hasData in interface ActivityOutput
Returns:
true if data is available, false otherwise.

getDataValueIterator

public DataValueIterator getDataValueIterator()
Description copied from interface: ActivityOutput
Gets an iterator to the data values written to the first output occurrence.

Specified by:
getDataValueIterator in interface ActivityOutput
Returns:
iterator to the data values written to this output.

validateState

public void validateState()
                   throws ActivityIOIllegalStateException
Description copied from interface: ActivityOutput
Validates the state of the output by validating all the occurtences of the output.

Specified by:
validateState in interface ActivityOutput
Throws:
ActivityIOIllegalStateException - if the output is in an illegal state.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNumberOfOutputs

public int getNumberOfOutputs()
Description copied from interface: ActivityOutput
Gets the number of output occurrences

Specified by:
getNumberOfOutputs in interface ActivityOutput
Returns:
the number of output occurrences

getSingleActivityOutputs

public SingleActivityOutput[] getSingleActivityOutputs()
Description copied from interface: ActivityOutput
Gets an array of SingleActivityOutput

Specified by:
getSingleActivityOutputs in interface ActivityOutput
Returns:
an array of SingleActivityOutput

getDataValueIterator

public DataValueIterator getDataValueIterator(int index)
                                       throws ActivityOutputUnreadableException,
                                              java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: ActivityOutput
Gets a DataValueIterator. It can be iterated to get DataValue objects

Specified by:
getDataValueIterator in interface ActivityOutput
Parameters:
index - the index of the output occurrence
Returns:
a DataValueIterator
Throws:
ActivityOutputUnreadableException - if the activity output cannot be read because the final request status has yet to be received data from server.
java.lang.ArrayIndexOutOfBoundsException - if index is out of bounds

hasData

public boolean hasData(int index)
                throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: ActivityOutput
Indicates whether occurrence at the specified index has more data

Specified by:
hasData in interface ActivityOutput
Parameters:
index - the index of the output occurrence
Returns:
true if there are more data, false otherwise
Throws:
java.lang.ArrayIndexOutOfBoundsException

getPipeName

public java.lang.String getPipeName(int index)
                             throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: ActivityOutput
Gets the pipe name that the occurrence at the specified index is connected to.

Specified by:
getPipeName in interface ActivityOutput
Parameters:
index - the index of the output occurrence
Returns:
the pipe name
Throws:
java.lang.ArrayIndexOutOfBoundsException

setNumberOfOutputs

public void setNumberOfOutputs(int count)
Description copied from interface: ActivityOutput
Sets the occurrences of this output.

Specified by:
setNumberOfOutputs in interface ActivityOutput
Parameters:
count - the count of output occurrences

setDataSourceResource

public void setDataSourceResource(int index,
                                  DataSourceResource dataSourceResource)
Deprecated. 

Description copied from interface: ActivityOutput
Sets a data source resource through which result data of the specified output occurrence can be read.

Specified by:
setDataSourceResource in interface ActivityOutput
Parameters:
index - the index of the output occurrence
dataSourceResource - data source resource.

setDataSourceResourceBlocksSize

public void setDataSourceResourceBlocksSize(int index,
                                            int numBlocks)
Deprecated. 

Description copied from interface: ActivityOutput
Sets the maximum number of blocks to retrieve from a data source connected to the first output occurrence resource via each call to the resource.

Specified by:
setDataSourceResourceBlocksSize in interface ActivityOutput
Parameters:
index - index of the output occurrence
numBlocks - maximum number of blocks to receive each call.

setDataSourceResource

public void setDataSourceResource(DataSourceResource dataSourceResource)
Deprecated. 

Description copied from interface: ActivityOutput
Sets a data source resource through which result data of the first output occurrence can be read.

Specified by:
setDataSourceResource in interface ActivityOutput
Parameters:
dataSourceResource - data source resource.

setDataSourceResourceBlocksSize

public void setDataSourceResourceBlocksSize(int numBlocks)
Deprecated. 

Description copied from interface: ActivityOutput
Sets the maximum number of blocks to retrieve from a data source connected to the first output occurrence resource via each call to the resource.

Specified by:
setDataSourceResourceBlocksSize in interface ActivityOutput
Parameters:
numBlocks - maximum number of blocks to receive each call.

setDataValueIterator

public void setDataValueIterator(DataValueIterator dataValueIterator)
Description copied from interface: ActivityOutput
Sets the data value iterator to use when reading data from this input. This method can be used when the workflow sent to OGSA-DAI has connected this output to a data source resource using the WriteToDataSource activity. In such cases the given data value iterator will be an iterator that gives access to the data from the data source resource.

Specified by:
setDataValueIterator in interface ActivityOutput
Parameters:
dataValueIterator - data value iterator that gives access to the data the output produced.

setDataValueIterator

public void setDataValueIterator(int index,
                                 DataValueIterator dataValueIterator)
Description copied from interface: ActivityOutput
Sets the data value iterator to use when reading data from this output. This method can be used when the workflow sent to OGSA-DAI has connected this output to a data source resource using the WriteToDataSource activity. In such cases the given data value iterator will be an iterator that gives access to the data from the data source resource.

Specified by:
setDataValueIterator in interface ActivityOutput
Parameters:
index - the index of the output occurrence
dataValueIterator - data value iterator that gives access to the data the output produced.