|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nfis.gdas.v091.JDBCDataRetriever
public class JDBCDataRetriever
This DataRetrieverInterface implementation
connects to a JDBC resource and runs a query using a JDBC connection.
The results of the query are written to the passed in
OutputStream as a Rowset element (described in the
GDAS 0.9.1 Specification section 7.2.4.3).
For more information see
DataRetrieverInterface.getData(String, String, DatasetConfigType, ArrayList, BigInteger, OutputStream)
Consult the GDAS Specifications Document Version 0.9.1.
To use this class to link to a specific data store you must configure the database parameters in the dataHandlerConfig091.xml document.
The getData(String, String, DatasetConfigType, ArrayList, BigInteger, OutputStream)
method requires two parameter elements nested in the dataset_config element
in the DataHandlerConfig XML. Example:
<dataset_config DatasetName="BC_forest_cover" DatasetDomain="nfis.org">
<parameter name="table_name" value="FIP_LAYER"/>
<parameter name="connParams" value="username=myUserName,
password=secretPassword,
conn_url=jdbc:oracle:thin:@db.nfis.org:1521:myDatabase,
jdbc_driver=oracle.jdbc.driver.OracleDriver"/>
<geo_linkage_field_type value="string"/>
<data_retriever_class data_retriever_class_name="org.nfis.gdas.v091.JDBCDataRetriever"/>
</dataset_config>
One parameter element's attribute 'name' must have the value 'table_name'. The elements 'value' attribute has the name of the table to be queried.
The other parameter element's 'name' attribute must have the value 'connParams' or 'connectionPoolParams'. This element has as its value a comma delimited string which defines the connection parameters.
If the parameter elements 'name' attribute's value is 'connParams' the comma delimited string of the 'value' attribute must contain the following key=value pairs:
If the parameter elements 'name' attribute's value is 'connectionPoolParams' the comma delimited string of the 'value' attribute must contain the following key=value pairs:
| Field Summary | |
|---|---|
static java.lang.String |
CONNECTION_PARAMS
value is 'connParams'> |
static java.lang.String |
CONNECTION_POOL_PARAMS
Database config Parameter element name |
static java.lang.String |
CONNECTION_URL
value is 'conn_url' |
static java.lang.String |
FLOAT
A value for the GEOLINKAGE_FIELD_TYPE parameter: 'float' |
static java.lang.String |
GEOLINKAGE_FIELD_TYPE
The parameter element attribute name from the DataHandlerConfig XML whose value is the data type of the Geolinkage field (defined in GDAS 0.9.1 specification, section 7.1.4.1.10.9). |
static java.lang.String |
JDBC_DRIVER
value is 'jdbc_driver' |
static java.lang.String |
KEY_VALUE_DELIMITER
|
static java.lang.String |
NAMING_CONTEXT
|
static java.lang.String |
NUMBER
A value for the GEOLINKAGE_FIELD_TYPE parameter: 'number' |
static java.lang.String |
PARAMS_DELIMITER
|
static java.lang.String |
PASSWORD
value is 'password' |
static java.lang.String |
POOL_NAME
|
static java.lang.String |
STRING
A value for the GEOLINKAGE_FIELD_TYPE parameter: 'string' |
static java.lang.String |
TABLE_NAME
The parameter element attribute name from the DataHandlerConfig XML whose value is the "table_name" to query on. |
static java.lang.String |
USER_NAME
value is 'username' |
| Constructor Summary | |
|---|---|
JDBCDataRetriever()
|
|
| Method Summary | |
|---|---|
void |
getData(java.lang.String geoLinkageField,
java.lang.String geoLinkIds,
org.nfis.gdas.v091.DatasetConfigType dataSourceParams,
java.util.ArrayList attributesArrayList,
java.math.BigInteger geoLinkIdsLimit,
java.io.OutputStream fileOut)
Using the parameters the client has provided, and values stored in the DataHandlerConfig document, make a connection to the right data source, build an SQL Query and use the results to create to write a Rowset element (described in the GDAS 0.9.1 specification section 7.2.4.3) to the passed in OutputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String PARAMS_DELIMITER
public static java.lang.String KEY_VALUE_DELIMITER
public static java.lang.String TABLE_NAME
public static java.lang.String GEOLINKAGE_FIELD_TYPE
public static java.lang.String NUMBER
GEOLINKAGE_FIELD_TYPE parameter: 'number'
public static java.lang.String STRING
GEOLINKAGE_FIELD_TYPE parameter: 'string'
public static java.lang.String FLOAT
GEOLINKAGE_FIELD_TYPE parameter: 'float'
public static java.lang.String CONNECTION_PARAMS
public static java.lang.String USER_NAME
public static java.lang.String PASSWORD
public static java.lang.String CONNECTION_URL
public static java.lang.String JDBC_DRIVER
public static java.lang.String CONNECTION_POOL_PARAMS
public static java.lang.String POOL_NAME
public static java.lang.String NAMING_CONTEXT
| Constructor Detail |
|---|
public JDBCDataRetriever()
| Method Detail |
|---|
public void getData(java.lang.String geoLinkageField,
java.lang.String geoLinkIds,
org.nfis.gdas.v091.DatasetConfigType dataSourceParams,
java.util.ArrayList attributesArrayList,
java.math.BigInteger geoLinkIdsLimit,
java.io.OutputStream fileOut)
throws ServiceReportException
OutputStream.
getData in interface DataRetrieverInterfacegeoLinkageField - defined in GDAS 0.9.1 specification section
7.1.4.1.10.9geoLinkIds - (optional, can be null) A comma delimited string used
to limit the number of records that will be returned by the server.
If null,return all geoLinkIds available. Defined in GDAS 0.9.1
specification section 7.2.3.10dataSourceParams - the Java object representation of the
dataset_config element from the DataHandler's
dataHandlerConfig XML.
This element potentially has an unlimited number of 'parameter'
elements for passing information into a this method. See
JDBCDataRetriever for an example implementation using these
parameter elements.attributesArrayList - A list of attribute names (must be Strings) used to
query a data source, defined in GDAS 0.9.1 specification section
7.2.3.9geoLinkIdsLimit - a number limiting the number of rows that can
be returned from a GDAS GetData request. Defined in GDAS 0.9.1
specification section 7.1.4fileOut - the Rowset element described in the GDAS 0.9.1 Specification
section 7.2.4.3 is written as text/xml to this stream. This must
be a valid Rowset element and only a Rowset element.
ServiceReportException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||