uk.org.ogsadai.activity.sql
Class AbstractSQLActivity

java.lang.Object
  |
  +--uk.org.ogsadai.activity.Activity
        |
        +--uk.org.ogsadai.activity.sql.AbstractSQLActivity
Direct Known Subclasses:
AbstractParameterisedSQLActivity, SQLBulkLoadRowSetActivity

public abstract class AbstractSQLActivity
extends Activity

Super-class of SQL activity implementations.

Author:
The OGSA-DAI Project Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
static java.lang.String CREATE_DATABASE
           
static java.lang.String DROP_DATABASE
           
static java.lang.String EXPRESSION
          Constants for parsing SQL activity XML
private static DAILogger LOG
          Logger object for logging in this class
protected  java.lang.String mCredentials
          Client credentials
protected  JDBCConnectionProvider mDataResource
          Database connection manager
protected  java.lang.String mExpression
          SQL expression
protected  java.util.Set mInputStreamNames
          Activity input names
protected  BlockWriter mOutput
          Activity output
protected  SQLStatement mStatement
          SQLStatement object for executing the SQL expression
static java.lang.String RESULT_STREAM
           
static java.lang.String SQL_OUT_PARAMETERS
           
static java.lang.String SQL_PARAMETERS
           
static java.lang.String STORED_PROCEDURE
           
static java.lang.String WEB_ROW_SET_STREAM
           
 
Fields inherited from class uk.org.ogsadai.activity.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
AbstractSQLActivity(org.w3c.dom.Element element)
           
 
Method Summary
protected  Pipe createOutputPipe(int i)
          Creates an output pipe for an internal output.
 void initialise()
          This method should be overridden by subclasses to perform any initialisation they require before the process method invocations begin.
protected  void parseExpression(java.lang.String eltName, org.w3c.dom.NodeList list)
          Finds the SQL expression for this activity from the activity request XML.
protected  void parseResultStream(java.lang.String eltName, org.w3c.dom.NodeList list)
          Get the name of an output stream for the activity.
 
Methods inherited from class uk.org.ogsadai.activity.Activity
cleanUp, connectsTo, getActivityConfiguration, getActivityName, getCause, getName, getObservableStatus, getProperties, getSession, getStatus, hasActivityConfiguration, hasProperties, process, processBlock, processFirst, setActivityName, setCompleted, setError
 
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

LOG

private static DAILogger LOG
Logger object for logging in this class


mCredentials

protected java.lang.String mCredentials
Client credentials


mDataResource

protected JDBCConnectionProvider mDataResource
Database connection manager


mOutput

protected BlockWriter mOutput
Activity output


mInputStreamNames

protected java.util.Set mInputStreamNames
Activity input names


mExpression

protected java.lang.String mExpression
SQL expression


mStatement

protected SQLStatement mStatement
SQLStatement object for executing the SQL expression


EXPRESSION

public static final java.lang.String EXPRESSION
Constants for parsing SQL activity XML

See Also:
Constant Field Values

STORED_PROCEDURE

public static final java.lang.String STORED_PROCEDURE
See Also:
Constant Field Values

CREATE_DATABASE

public static final java.lang.String CREATE_DATABASE
See Also:
Constant Field Values

DROP_DATABASE

public static final java.lang.String DROP_DATABASE
See Also:
Constant Field Values

SQL_PARAMETERS

public static final java.lang.String SQL_PARAMETERS
See Also:
Constant Field Values

SQL_OUT_PARAMETERS

public static final java.lang.String SQL_OUT_PARAMETERS
See Also:
Constant Field Values

WEB_ROW_SET_STREAM

public static final java.lang.String WEB_ROW_SET_STREAM
See Also:
Constant Field Values

RESULT_STREAM

public static final java.lang.String RESULT_STREAM
See Also:
Constant Field Values
Constructor Detail

AbstractSQLActivity

public AbstractSQLActivity(org.w3c.dom.Element element)
                    throws ActivitySpecificationException,
                           ActivityCreationException
Method Detail

initialise

public void initialise()
                throws ActivitySpecificationException,
                       ActivityExecutionException
Description copied from class: Activity
This method should be overridden by subclasses to perform any initialisation they require before the process method invocations begin. This might be used for setting up convenient fields to reference objects contained in the context. It shouldn't be used for opening resources. That should be done in processFirst.

Overrides:
initialise in class Activity
Throws:
ActivityExecutionException - If some system problem prevents the activity from initialising.
ActivitySpecificationException - If a problem with settings provided by a client prevents the activity from initialising.

parseExpression

protected void parseExpression(java.lang.String eltName,
                               org.w3c.dom.NodeList list)
                        throws ActivitySpecificationException
Finds the SQL expression for this activity from the activity request XML.

Parameters:
eltName - Name of element containing the expression.
list - A list of DOM nodes with tag eltName
Throws:
ActivitySpecificationException - If the first item in list does not contain an SQL expressions.

parseResultStream

protected void parseResultStream(java.lang.String eltName,
                                 org.w3c.dom.NodeList list)
                          throws ActivitySpecificationException
Get the name of an output stream for the activity.

Parameters:
eltName - Name of element containing the output stream name.
list - A list of DOM nodes with tag eltName and assumed to have attribute name with a non-null content.
Throws:
ActivitySpecificationException - If the first item in list does not contain an attribute name with a non-null value.

createOutputPipe

protected Pipe createOutputPipe(int i)
Description copied from class: Activity
Creates an output pipe for an internal output. This method can be overriden by subclasses in order to create specific types of output pipes.

Overrides:
createOutputPipe in class Activity
Parameters:
i - Index of the output pipe.
Returns:
an output pipe of suitable type.