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

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

public class SQLBulkLoad
extends Activity

This activity bulk loads data into a table within a relational database. A typical application of this activity would be to insert data generated by an SQLQuery activity into another table.

The activity has one input and one outpe ut. The input must be XML data formatted using the WebRowSet standard, such as that generated by a WebRowSet activity. The output consists of a count of the number of rows inserted into the table.

Note that the destination table must exist before this activity is processed, and the table column names must match those contained in the WebRowSet input data.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String mTableName
          Name of table to load the data into
private  boolean mTransactionally
          Indicates whether the bulk load should be performed in a transactional manner - default false.
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
SQLBulkLoad(ActivityOutput input, java.lang.String tableName)
          Constructs an SQL bulk load activity.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 int getInsertedRowsCount()
          Gets the number of rows inserted into the table as a result of the bulk load operation.
 ActivityOutput getOutput()
          Gets the activity's only output.
 java.lang.String getTableName()
          Gets the name of the database table into which the data will be inserted.
 boolean isTransactionally()
          Gets whether this bulk load is performed in a transactional manner.
 void setInput(ActivityOutput input)
          Sets the input of this activity to be the output from another activity that will provide the data to be bulk loaded.
 void setTableName(java.lang.String tableName)
          Sets the name of the table to bulk load to.
 void setTransactionally(boolean transactionally)
          Sets whether this bulk load is performed in a transactional manner.
 
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

mTableName

private java.lang.String mTableName
Name of table to load the data into


mTransactionally

private boolean mTransactionally
Indicates whether the bulk load should be performed in a transactional manner - default false.

Constructor Detail

SQLBulkLoad

public SQLBulkLoad(ActivityOutput input,
                   java.lang.String tableName)
Constructs an SQL bulk load activity.

Parameters:
input - Output from another activity.
tableName - Name of table to bulk load to.
Throws:
java.lang.IllegalArgumentException - If input or tableName are 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 data to be bulk loaded.

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

setTableName

public final void setTableName(java.lang.String tableName)
Sets the name of the table to bulk load to.

Parameters:
tableName - Name of table to bulk load to.
Throws:
java.lang.IllegalArgumentException - If tableName is null.

getTableName

public java.lang.String getTableName()
Gets the name of the database table into which the data will be inserted.

Returns:
name of database table

setTransactionally

public void setTransactionally(boolean transactionally)
Sets whether this bulk load is performed in a transactional manner.

Parameters:
transactionally - true if the bulk load is transactional, false otherwise

isTransactionally

public boolean isTransactionally()
Gets whether this bulk load is performed in a transactional manner.

Returns:
true if the bulk load is transactional, false otherwise

getInsertedRowsCount

public int getInsertedRowsCount()
                         throws DataFormatException,
                                NoActivityOutputException
Gets the number of rows inserted into the table as a result of the bulk load operation.

Returns:
the number of rows inserted
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 number.

getOutput

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

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