uk.org.ogsadai.client.toolkit.activity.sql
Class CSV

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.sql.CSV

public class CSV
extends Activity

This activity converts the output of SQL activities that produce java.sql.ResultSet objects into CSV format.

The activity has one input - the ResultSet - and one output - the CSV format.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  CSVConfigurator mConfigurator
          CSV file format configurator
private  int mResultSetType
          Type of ResultSets generated using this class
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
CSV(ActivityOutput input)
          Convert the ResultSet from the given activity output into CSV.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity's only output - the XML WebRowSet.
 java.sql.ResultSet getResultSet()
          Get the WebRowSet XML output from this activity and convert it into a ResultSet of type specified by getResultSetType.
 int getResultSetType()
          Return the type of ResultSet objects the getResultSet method returns.
 void setConfigurator(CSVConfigurator configurator)
          Set the CSV file format configurator.
 void setInput(ActivityOutput input)
          Sets the input of this activity to be the output from another activity that will provide the ResultSet data.
 void setResultSetType(int resultSetType)
          Set the type of ResultSet objects the getResultSet method returns.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mResultSetType

private int mResultSetType
Type of ResultSets generated using this class


mConfigurator

private CSVConfigurator mConfigurator
CSV file format configurator

Constructor Detail

CSV

public CSV(ActivityOutput input)
Convert the ResultSet from the given activity output into CSV.

Parameters:
input - Output from another activity.
Throws:
java.lang.IllegalArgumentException - If input is null.
Method Detail

setInput

public final void setInput(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the ResultSet data.

Parameters:
input - Output from another activity.
Throws:
java.lang.IllegalArgumentException - If input is null.

getResultSetType

public int getResultSetType()
Return the type of ResultSet objects the getResultSet method returns.

Returns:
the ResultSet type

setResultSetType

public void setResultSetType(int resultSetType)
Set the type of ResultSet objects the getResultSet method returns.

Parameters:
resultSetType - Either of ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_INSENSITIVE.
Throws:
java.lang.IllegalArgumentException - if resultSetType is not one of the two above.

getResultSet

public java.sql.ResultSet getResultSet()
                                throws NoActivityOutputException,
                                       DataFormatException
Get the WebRowSet XML output from this activity and convert it into a ResultSet of type specified by getResultSetType.

Returns:
ResultSet containing query result.
Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the output from the activity cannot be parsed into a ResultSet.

getOutput

public ActivityOutput getOutput()
Gets the activity's only output - the XML WebRowSet.

Returns:
the activity output.

setConfigurator

public void setConfigurator(CSVConfigurator configurator)
Set the CSV file format configurator.

Parameters:
configurator - CSV file format configurator.
Throws:
java.lang.IllegalArgumentException - If configurator is null.

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity