uk.org.ogsadai.activity.sql
Class RelationalResourceManagementActivity

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

public class RelationalResourceManagementActivity
extends SQLActivity

Handles RelationalResourceManagement Elements from a Grid Data Service Document.

The RelationalResourceManagementActivity is constructed from an Element corresponding to a statement for execution on a database.

A Context can then be set detailing the environment in which this activity exists. Where to obtain inputs from and send output too.

The credentials of the user should be available to obtain a connection

The activity can then be processed a block at a time. On the request for the first block the activity will obtain a connection from the ConnectionManager, setup and execute the statement and return the results


Nested Class Summary
 
Nested classes inherited from class uk.org.ogsadai.activity.sql.SQLActivity
SQLActivity.ParameterInput, SQLActivity.StreamInput, SQLActivity.ValueInput
 
Field Summary
protected  int mStatementType
           
protected  int mUpdateCount
           
static int STATEMENT_CREATE_DATABASE
           
static int STATEMENT_DROP_DATABASE
           
 
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
RelationalResourceManagementActivity(org.w3c.dom.Element element)
          Constructor
 
Method Summary
 void cleanUp()
          Tidy up connections and statements in case the activity is terminated or an error occurred.
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 processBlock()
          This method will return the next block of output on the outputStream No exceptions are thrown since they will be flagged as a status flag with the activity
protected  void processFirst()
          This method will start processing.
 
Methods inherited from class uk.org.ogsadai.activity.sql.SQLActivity
initialise, 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

mStatementType

protected int mStatementType

mUpdateCount

protected int mUpdateCount

STATEMENT_CREATE_DATABASE

public static final int STATEMENT_CREATE_DATABASE
See Also:
Constant Field Values

STATEMENT_DROP_DATABASE

public static final int STATEMENT_DROP_DATABASE
See Also:
Constant Field Values
Constructor Detail

RelationalResourceManagementActivity

public RelationalResourceManagementActivity(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

processFirst

protected void processFirst()
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.

Overrides:
processFirst in class Activity

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

processBlock

public void processBlock()
This method will return the next block of output on the outputStream No exceptions are thrown since they will be flagged as a status flag with the activity

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()
Tidy up connections and statements in case the activity is terminated or an error occurred.

Overrides:
cleanUp in class Activity