uk.org.ogsadai.activity.sql
Class SQLBulkLoadRowSetActivity

java.lang.Object
  |
  +--uk.org.ogsadai.engine.Activity
        |
        +--uk.org.ogsadai.activity.sql.SQLActivity
              |
              +--uk.org.ogsadai.activity.sql.SQLBulkLoadRowSetActivity

public class SQLBulkLoadRowSetActivity
extends SQLActivity

Performs a bulk load to a database. This will get one row at a time and insert it into a table. It is assumed that the table already exists. If the table name is not specified in the perform document the table name of the first column is used.

Author:
The OGSA-DAI Project Team

Nested Class Summary
 
Nested classes inherited from class uk.org.ogsadai.activity.sql.SQLActivity
SQLActivity.ParameterInput, SQLActivity.StreamInput, SQLActivity.ValueInput
 
Field Summary
protected  int mUpdateCount
           
 
Fields inherited from class uk.org.ogsadai.activity.sql.SQLActivity
CREATE_DATABASE, DROP_DATABASE, EXPRESSION, mAllInput, mConnection, mConnectionManager, mCredentials, mExpression, mExpressionInput, mInputStreams, mIsTransaction, mNameToInput, mOpenConnection, mOutput, mStatement, RESULT_STREAM, SQL_PARAMETERS, STORED_PROCEDURE, WEB_ROW_SET_STREAM
 
Fields inherited from class uk.org.ogsadai.engine.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
SQLBulkLoadRowSetActivity(org.w3c.dom.Element element)
          Constructor
 
Method Summary
 void cleanUp()
          This method is called if an error occurred or the activity was terminated.
protected  void endProcessing()
          This method will complete the processing and tidy up
protected  boolean getResult()
          This method will try and complete the statement with parameters Then try and execute the query and obtain the resultSet
 void initialise()
          Completes initialisation of Activity.
 void processBlock()
          Performs an iteration of the processing of an activity.
 void processFirst()
          This method is called during the first iteration of processing an activity.
protected  boolean startProcessing()
          This method will start processing.
 
Methods inherited from class uk.org.ogsadai.activity.sql.SQLActivity
loadNextExpression, parseCommand, parseResultStream, parseSQLParameters, prepareStatement, setupInputStreamNames
 
Methods inherited from class uk.org.ogsadai.engine.Activity
connectsTo, getActivityConfiguration, getName, getObservableStatus, getProperties, getStatus, hasActivityConfiguration, hasProperties, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mUpdateCount

protected int mUpdateCount
Constructor Detail

SQLBulkLoadRowSetActivity

public SQLBulkLoadRowSetActivity(org.w3c.dom.Element element)
                          throws ActivityUserException,
                                 ActivitySystemException
Constructor

Parameters:
element - Element containing Statement conforming to schema for a SQLQueryStatement. It is assumed schema checks have been carried out.
Throws:
ActivityUserException
ActivitySystemException
Method Detail

initialise

public void initialise()
                throws ActivityUserException
Description copied from class: SQLActivity
Completes initialisation of Activity.

Overrides:
initialise in class SQLActivity
Throws:
ActivityUserException - If a user problem prevents the activity from initialising.

startProcessing

protected boolean startProcessing()
                           throws ActivityUserException,
                                  ActivitySystemException,
                                  java.sql.SQLException
This method will start processing. So it will retrieve the connection and set up the statement. The connection isn't returned/closed until the output is complete, i.e. last block has been read.

ActivityUserException
ActivitySystemException
java.sql.SQLException

getResult

protected boolean getResult()
                     throws java.sql.SQLException,
                            ActivitySystemException,
                            ActivityUserException
This method will try and complete the statement with parameters Then try and execute the query and obtain the resultSet

Overrides:
getResult in class SQLActivity
Returns:
true if it has successfully created a new result
Throws:
ActivityUserException
ActivitySystemException
java.sql.SQLException

processFirst

public void processFirst()
Description copied from class: Activity
This method is called during the first iteration of processing an activity. It can be overridden by subclasses to define some processing that should be done only once during the first iteration of the activity processing, for example evaluating a database query.

Overrides:
processFirst in class Activity

processBlock

public void processBlock()
Description copied from class: Activity
Performs an iteration of the processing of an activity. This may involve reading a block of input data and writing a block of output data, or may involve some other kind of processing. When an activity is processed by the OGSA-DAI engine, this method will be invoked repeatedly until the activity either completes or stops due to an error or termination call. An implementation of this method should invoke the setCompleted method to indicate that processing is complete, or the setError method if an error occurs that will prevent the processing from completing.

Specified by:
processBlock in class Activity

endProcessing

protected void endProcessing()
                      throws java.sql.SQLException,
                             ActivitySystemException
This method will complete the processing and tidy up

Overrides:
endProcessing in class SQLActivity
Throws:
java.sql.SQLException
ActivitySystemException

cleanUp

public void cleanUp()
This method is called if an error occurred or the activity was terminated.

Overrides:
cleanUp in class Activity