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

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

public class SQLResultToBytes
extends Activity

This activity takes an SQL result set and extracts the data from a single column of the first row as a stream of binary data. This functionality is useful when extracting BLOBs from databases and passing the contents onto a delivery activity.

The activity has a one input. This input should contain a single block which is an instance of java.sql.ResultSet.

The activity output has one output to which the binary data will be written as blocks of byte arrays. The number of bytes in each array can be specified by the user.

Author:
OGSA-DAI team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  int mBlockSize
          The number of bytes to output per block
private  int mColumnIndex
          The index of the column from which to extract the data
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
SQLResultToBytes(ActivityOutput input, int columnIndex)
          Constructor.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity output to which the blocks of byte arrays will be written.
 void setBlockSize(int blockSize)
          Sets the block size to use in the output steam.
 void setColumnIndex(int columnIndex)
          Resets the index of the column from which to extract the data.
 void setInput(ActivityOutput input)
          Resets the activity's input stream.
 
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

mColumnIndex

private int mColumnIndex
The index of the column from which to extract the data


mBlockSize

private int mBlockSize
The number of bytes to output per block

Constructor Detail

SQLResultToBytes

public SQLResultToBytes(ActivityOutput input,
                        int columnIndex)
Constructor.

Parameters:
input - The input stream. This input stream should produce a single java.sql.ResultSet block.
columnIndex - The index of the column from which to extract the data. The index of the first column is 1.
Method Detail

setColumnIndex

public void setColumnIndex(int columnIndex)
Resets the index of the column from which to extract the data. The index of the first column is 1.

Parameters:
columnIndex -

setBlockSize

public void setBlockSize(int blockSize)
Sets the block size to use in the output steam. All blocks will consist of this number of bytes except the final block which may contain less bytes.

If unspecified the activity's default block size of 1024 bytes will be used.

Parameters:
blockSize - Block size in bytes.

setInput

public void setInput(ActivityOutput input)
Resets the activity's input stream. This input stream should produce a single java.sql.ResultSet block.

Parameters:
input - Input stream.
Throws:
java.lang.IllegalArgumentException - if the argument is null.

getOutput

public ActivityOutput getOutput()
Gets the activity output to which the blocks of byte arrays will be written.

Returns:
the activity output

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