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

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

public class SQLStoredProcedure
extends ParameterizedActivity

This activity evaluates a stored procedure within a relational database. A stored procedure may generate a java.sql.ResultSet , multiple ResultSets, an update count or no result data at all.

This activity has no inputs and one output - the result of the stored procedure.

The format of the output data depends on the behaviour of the stored procedure, so it may contain any of the following:

See SQLQuery for information on handling ResultSet outputs from activities.

Author:
The OGSA-DAI Project Team
See Also:
SQLQuery

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.util.Map mOutParams
          OUT parameter types
private  java.lang.String mProcedureName
          SQL stored procedure name
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
SQLStoredProcedure(java.lang.String procedureName)
          Constructs activity to execute the named stored procedure.
 
Method Summary
private  void generateOutParametersXML(java.lang.StringBuffer buf)
          Add XML fragments for the stored procedure's output parameters to the internal representation of the request fragment for this activity.
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity's only output.
 java.lang.String getProcedureName()
          Gets the SQL stored procedure name.
 void registerOutParameter(int position, int type)
          Register an OUT parameter of the stored procedure.
 void setStoredProcedure(java.lang.String procedureName)
          Sets the SQL stored procedure name.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity
clearParameters, generateParametersXML, setParameter, setParameter
 
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

mProcedureName

private java.lang.String mProcedureName
SQL stored procedure name


mOutParams

private java.util.Map mOutParams
OUT parameter types

Constructor Detail

SQLStoredProcedure

public SQLStoredProcedure(java.lang.String procedureName)
Constructs activity to execute the named stored procedure. The parameters passed to the stored procedure must be subsequently added using the setParameter method.

Parameters:
procedureName - Name of the stored procedure to execute.
Throws:
java.lang.IllegalArgumentException - If procedureName is null.
Method Detail

setStoredProcedure

public void setStoredProcedure(java.lang.String procedureName)
Sets the SQL stored procedure name.

Parameters:
procedureName - Stored procedure name.
Throws:
java.lang.IllegalArgumentException - If procedureName is null.

getProcedureName

public java.lang.String getProcedureName()
Gets the SQL stored procedure name.

Returns:
the SQL stored procedure name

registerOutParameter

public void registerOutParameter(int position,
                                 int type)
Register an OUT parameter of the stored procedure.

Parameters:
position - The position of the parameter.
type - JDBC type (as in java.sql.Types) of the parameter

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

generateOutParametersXML

private void generateOutParametersXML(java.lang.StringBuffer buf)
Add XML fragments for the stored procedure's output parameters to the internal representation of the request fragment for this activity.

Parameters:
buf - Buffer holding internal representation of request fragment.