uk.org.ogsadai.client.toolkit.activity.sql
Class SQLResilientQuery
java.lang.Object
|
+--uk.org.ogsadai.client.toolkit.activity.RequestComponent
|
+--uk.org.ogsadai.client.toolkit.activity.Activity
|
+--uk.org.ogsadai.client.toolkit.activity.sql.SQLResilientQuery
- public class SQLResilientQuery
- extends Activity
This activity aims at executing the same SQL query over a number of different data resources being exposed by corresponding data service resources. It returns the results from the first availabale of these data resources.
The parameters of the activity are the SQL query and the timeout, while the output is the produced WebRowSet document.
- Author:
- OGSA-DAI Project Team
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
|
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
|
Constructor Summary |
SQLResilientQuery(java.lang.String sql)
Constructs an activity to execute a query over a number of data resources. |
Method Summary |
protected java.lang.String |
generateXML()
Generates the XML representing the activity. |
ActivityOutput |
getOutput()
Gets the activity's only output. |
java.sql.ResultSet |
getResultSet()
Get the WebRowSet XML output from this activity and convert it into a ResultSet of type specified by getResultSetType . |
void |
setResultSetType(int resultSetType)
Set the type of ResultSet objects the getResultSet method returns. |
void |
setTimeout(long timeout)
Sets the timeout within which a response should be returned from the data resources. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
Copyright statement
- See Also:
- Constant Field Values
mSqlStatement
private java.lang.String mSqlStatement
-
the sql statement
mTimeout
private long mTimeout
-
the timeout
mResultSetType
private int mResultSetType
-
Type of
ResultSet
s generated using this class
SQLResilientQuery
public SQLResilientQuery(java.lang.String sql)
-
Constructs an activity to execute a query over a number of data resources. The results of the first availabale data resource will be then returned.
- Parameters:
sql
- the sql query to be executed.
setTimeout
public void setTimeout(long timeout)
-
Sets the timeout within which a response should be returned from the data resources.
-
- Parameters:
timeout
-
getOutput
public ActivityOutput getOutput()
-
Gets the activity's only output.
-
- Returns:
- the activity output.
setResultSetType
public void setResultSetType(int resultSetType)
-
Set the type of
ResultSet
objects the getResultSet
method returns.
-
- Parameters:
resultSetType
- Either of ResultSet.TYPE_FORWARD_ONLY
or ResultSet.TYPE_SCROLL_INSENSITIVE
.
- Throws:
java.lang.IllegalArgumentException
- if resultSetType
is not one of the two above.
getResultSet
public java.sql.ResultSet getResultSet()
throws NoActivityOutputException,
DataFormatException
-
Get the WebRowSet XML output from this activity and convert it into a
ResultSet
of type specified by getResultSetType
.
-
- Returns:
ResultSet
containing query result.
- Throws:
NoActivityOutputException
- if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException
- if the output from the activity cannot be parsed into a ResultSet
.
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