uk.org.ogsadai.client.toolkit.activity
Class ParameterizedActivity

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity
Direct Known Subclasses:
SQLQuery, SQLStoredProcedure, SQLUpdate

public abstract class ParameterizedActivity
extends Activity

An OGSA-DAI parameterized activity. Parameterized activities contains a number of parameters whose values or streams can be set using the methods defined here.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String mElementName
          Name of the element to use when generating parameter elements
private  java.util.Map mParameters
          Parameters - maps index (Integer) to value (String)
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
protected ParameterizedActivity(java.lang.String elementName)
          Constructor.
 
Method Summary
 void clearParameters()
          Clears the parameter values.
protected  java.lang.String generateParametersXML()
          Generates a fragment of XML that specifies the parameter values.
 void setParameter(int index, ActivityOutput output)
          Sets the output stream of an activity that will provide input into a specific parameter.
 void setParameter(int index, java.lang.String value)
          Sets the value of the specified parameter.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, generateXML, 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

mParameters

private java.util.Map mParameters
Parameters - maps index (Integer) to value (String)


mElementName

private java.lang.String mElementName
Name of the element to use when generating parameter elements

Constructor Detail

ParameterizedActivity

protected ParameterizedActivity(java.lang.String elementName)
Constructor.

Parameters:
elementName - Element name to use when generating the XML for each parameter.
Method Detail

setParameter

public void setParameter(int index,
                         java.lang.String value)
Sets the value of the specified parameter.

Parameters:
index - index of parameter (the first parameter is 1).
value - value of the parameter
Throws:
java.lang.IndexOutOfBoundsException - if index is < 1.
java.lang.IllegalArgumentException - if value is null

setParameter

public void setParameter(int index,
                         ActivityOutput output)
Sets the output stream of an activity that will provide input into a specific parameter.

Parameters:
index - index of parameter (the first parameter is 1).
output - activity output providing input into this parameter.
Throws:
java.lang.IndexOutOfBoundsException - if index is < 1.
java.lang.IllegalArgumentException - if output is null

clearParameters

public void clearParameters()
Clears the parameter values.


generateParametersXML

protected java.lang.String generateParametersXML()
Generates a fragment of XML that specifies the parameter values.

The XML fragment will contain an element for each parameter. The element will be of the form:
< elementName position="index"> value </elementName>
where elementName is the is the element name specified in the constructor, index is the parameter index and value is the parameter value.

Returns:
the XML fragment as a string.