gistoolkit.datasources.db2spatialextender
Class ReadOnlySpatialExtenderDataSource

java.lang.Object
  extended bygistoolkit.datasources.SimpleDataSource
      extended bygistoolkit.datasources.SimpleDBDataSource
          extended bygistoolkit.datasources.db2spatialextender.SpatialExtenderDataSource
              extended bygistoolkit.datasources.db2spatialextender.ReadOnlySpatialExtenderDataSource
All Implemented Interfaces:
DataSource

public class ReadOnlySpatialExtenderDataSource
extends SpatialExtenderDataSource
implements DataSource

Allows connections to a DB2 Database given an arbitrary SQL String.

This allows the datasource to be configured to select data from a db2 join, and even allows selecting data from temporary tables. An Example may be:

SELECT mktregion.profit Profit, db2gse.st_AsBinary(County.shape) FROM mktregion, county WHERE mktregion.fips = county.fips


Field Summary
 java.lang.String myDatabaseQuery
          The string to apply to select the data from DB2.
 
Fields inherited from class gistoolkit.datasources.db2spatialextender.SpatialExtenderDataSource
MAX_DB2_INT, myDatabaseName, myEnvelope
 
Fields inherited from class gistoolkit.datasources.SimpleDataSource
 
Constructor Summary
ReadOnlySpatialExtenderDataSource()
          SpatialExtenderDataSource constructor comment.
 
Method Summary
 java.sql.Connection connect()
          Connects this datasource to the database, calls the connect in the super class.
 Node getNode()
          Get the configuration information for this data source
 boolean getPreread()
          Returns the preread flag.
 java.lang.String getSQLString()
          retrieve the sql string that defines the layer.
 Style getStyle()
          Get the style to use with this datasource.
 GISDataset readDataset(Envelope inEnvelope)
          Reads only the objects from the data source that intersect these Envelope.
 GISDataset readShapes(Envelope inEnvelope)
          Reads the objects from the database that fall within the given Envelope.
 void setNode(Node inNode)
          Set the configuration information for this data source
 void setPreread(boolean inPreread)
          Sets the preread flag to tell this data source to preread the entire contents of the layer, and keep them in memory, essentially caching them, until the data source is disposed.
 void setSQLString(java.lang.String inQuery)
          sets the sql string that defines this layer.
 
Methods inherited from class gistoolkit.datasources.db2spatialextender.SpatialExtenderDataSource
checkMaxPoint, getDatabaseDriver, getDatabaseName, getDatabasePassword, getDatabasePort, getDatabaseSchema, getDatabaseServername, getDatabaseShapeColumn, getDatabaseSpatialReferenceID, getDatabaseURLBase, getDatabaseUsername, getJDBCURL, getName, getSQLConverter, getWhereString, readEnvelope, setDatabaseDriver, setDatabaseName, setDatabasePassword, setDatabasePort, setDatabaseSchema, setDatabaseServername, setDatabaseShapeColumn, setDatabaseSpatialReferenceID, setDatabaseSpatialReferenceID, setDatabaseURLBase, setDatabaseUsername, setName
 
Methods inherited from class gistoolkit.datasources.SimpleDBDataSource
getFilter, getFilterSQL, setFilter
 
Methods inherited from class gistoolkit.datasources.SimpleDataSource
addDataSourceListener, clearCache, commit, delete, doCommit, doDelete, doInsert, doRollback, doUpdate, filterDataset, fireCommit, fireDelete, fireInsert, fireRead, fireRollBack, fireUpdate, getCached, getCacheDataset, getCacheEnvelope, getEnvelope, getFromProjection, getToProjection, getValidShapeTypes, insert, isCachedProjected, isUpdateable, projectBackward, projectForward, queryFromCache, readDataset, removeDataSourceListener, rollback, setCache, setCached, setFromProjection, setProjection, setToProjection, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gistoolkit.datasources.DataSource
addDataSourceListener, commit, delete, getEnvelope, getFilter, getFromProjection, getName, getToProjection, insert, isUpdateable, readDataset, removeDataSourceListener, rollback, setFilter, setFromProjection, setName, setToProjection, update
 

Field Detail

myDatabaseQuery

public java.lang.String myDatabaseQuery
The string to apply to select the data from DB2.

Constructor Detail

ReadOnlySpatialExtenderDataSource

public ReadOnlySpatialExtenderDataSource()
SpatialExtenderDataSource constructor comment.

Method Detail

getSQLString

public java.lang.String getSQLString()
retrieve the sql string that defines the layer.


setSQLString

public void setSQLString(java.lang.String inQuery)
sets the sql string that defines this layer.


setPreread

public void setPreread(boolean inPreread)
Sets the preread flag to tell this data source to preread the entire contents of the layer, and keep them in memory, essentially caching them, until the data source is disposed.


getPreread

public boolean getPreread()
Returns the preread flag. This flag tells the data source to preread the entire contents of the layer, and to cach that information in memory until the data source is disposed.


connect

public java.sql.Connection connect()
                            throws java.lang.Exception
Connects this datasource to the database, calls the connect in the super class.

Overrides:
connect in class SpatialExtenderDataSource
Throws:
java.lang.Exception

readDataset

public GISDataset readDataset(Envelope inEnvelope)
                       throws java.lang.Exception
Reads only the objects from the data source that intersect these Envelope. This is heare instead of in the super class because of the preread logic.

Specified by:
readDataset in interface DataSource
Overrides:
readDataset in class SimpleDataSource
Throws:
java.lang.Exception

readShapes

public GISDataset readShapes(Envelope inEnvelope)
                      throws java.lang.Exception
Reads the objects from the database that fall within the given Envelope. If a null is sent in for the Envelope, all the objects in the shape file are read.

Specified by:
readShapes in class SimpleDataSource
Throws:
java.lang.Exception

getNode

public Node getNode()
Get the configuration information for this data source

Specified by:
getNode in interface DataSource
Overrides:
getNode in class SpatialExtenderDataSource

setNode

public void setNode(Node inNode)
             throws java.lang.Exception
Set the configuration information for this data source

Specified by:
setNode in interface DataSource
Overrides:
setNode in class SpatialExtenderDataSource
Throws:
java.lang.Exception

getStyle

public Style getStyle()
Get the style to use with this datasource.

Specified by:
getStyle in interface DataSource
Overrides:
getStyle in class SimpleDataSource