gistoolkit.datasources.postgis
Class PostGISDataSource

java.lang.Object
  extended bygistoolkit.datasources.SimpleDataSource
      extended bygistoolkit.datasources.SimpleDBDataSource
          extended bygistoolkit.datasources.postgis.PostGISDataSource
All Implemented Interfaces:
DataSource
Direct Known Subclasses:
ReadOnlyPostGISDataSource, UpdateablePostGISDataSource

public abstract class PostGISDataSource
extends SimpleDBDataSource

PostGIS is an extension to the PostgreSQL object-relational database system which allows GIS (Geographic Information Systems) objects to be stored in the database. PostGIS includes support for GiST-based R-Tree spatial indexes, and functions for basic analysis of GIS objects.

From the PostGIS documentation by Paul Ramsey

Author:
bitterstorm

Field Summary
 
Fields inherited from class gistoolkit.datasources.SimpleDataSource
 
Constructor Summary
PostGISDataSource()
          Creates new PostGISDataSource
 
Method Summary
protected  void closeConnection()
          Close the connection to the database.
 java.sql.Connection connect()
          Connect this datasource to the database
 void finalize()
          Close any open connections
 java.lang.String getDatabaseName()
          Get the database name the postmaster should access for servicing this request.
 java.lang.String getDatabasePassword()
          Get the password that validates the username.
 int getDatabasePort()
          Get the TCP-IP port number on which the postmaster is listening.
 java.lang.String getDatabaseServername()
          Get thehostname/servername of the target computer.
 java.lang.String getDatabaseShapeColumn()
          Get the name of the column containing shapes.
 int getDatabaseSpatialReferenceID()
          Returns the spatial reference id to use for converting shapes to and from database format.
 java.lang.String getDatabaseURLBase()
          Get the string to prepend to the url used to locate the database.
 java.lang.String getDatabaseUsername()
          Get the username with permission to connect to the database.
 Node getNode()
          Get the configuration information for this data source
 SQLConverter getSQLConverter()
          Returns the converter for this Database.
 void load(java.util.Properties inProperties)
          Initialize the data source from the properties.
 Envelope readEnvelope()
          Returns the bounding rectangle of all the shapes in the Data Source.
 void setDatabaseName(java.lang.String inDatabaseName)
          Set the database name the postmaster should access for servicing this request.
 void setDatabasePassword(java.lang.String inDatabasePassword)
          Set the password that validates the username.
 void setDatabasePort(int inPortNumber)
          Set the TCP-IP port number on which the postmaster is listening.
 void setDatabaseServername(java.lang.String inDatabaseServername)
          Set thehostname/servername of the target computer.
 void setDatabaseShapeColumn(java.lang.String inShapeColumn)
          Set the name of the column containing shapes.
 void setDatabaseSpatialReferenceID(int inDatabaseSpatialReferenceID)
          Sets the SpatialReferenceID to use when converting shapes to and from database format.
 void setDatabaseSpatialReferenceID(java.lang.String inDatabaseSpatialReferenceID)
          Sets the SpatialReferenceID to use when converting shapes to and from database format.
 void setDatabaseURLBase(java.lang.String inURLBase)
          Set the string to prepend to the url used to locate the database.
 void setDatabaseUsername(java.lang.String inDatabaseUsername)
          Set the username with permission to connect to the database.
 void setNode(Node inNode)
          Set the configuration information for this data source
 
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, getName, getStyle, getToProjection, getValidShapeTypes, insert, isCachedProjected, isUpdateable, projectBackward, projectForward, queryFromCache, readDataset, readDataset, readShapes, removeDataSourceListener, rollback, setCache, setCached, setFromProjection, setName, setProjection, setToProjection, update
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostGISDataSource

public PostGISDataSource()
Creates new PostGISDataSource

Method Detail

getDatabaseURLBase

public java.lang.String getDatabaseURLBase()
Get the string to prepend to the url used to locate the database. This is usally a constant like "jdbc:postgresql://".


setDatabaseURLBase

public void setDatabaseURLBase(java.lang.String inURLBase)
Set the string to prepend to the url used to locate the database. This is usally a constant like "jdbc:postgresql://".


getDatabaseServername

public java.lang.String getDatabaseServername()
Get thehostname/servername of the target computer. This usually changes with each installation or application. The default is "localhost" for the local computer


setDatabaseServername

public void setDatabaseServername(java.lang.String inDatabaseServername)
Set thehostname/servername of the target computer. This usually changes with each installation or application. The default is "localhost" for the local computer


getDatabasePort

public int getDatabasePort()
Get the TCP-IP port number on which the postmaster is listening. The default is 5432, but it could be changed to a different port, depending on configuration.


setDatabasePort

public void setDatabasePort(int inPortNumber)
Set the TCP-IP port number on which the postmaster is listening. The default is 5432, but it could be changed to a different port, depending on configuration.


getDatabaseName

public java.lang.String getDatabaseName()
Get the database name the postmaster should access for servicing this request. The default is "database", which is most likely inappropriate.


setDatabaseName

public void setDatabaseName(java.lang.String inDatabaseName)
Set the database name the postmaster should access for servicing this request. The default is "database", which is most likely inappropriate.


getDatabaseShapeColumn

public java.lang.String getDatabaseShapeColumn()
Get the name of the column containing shapes.


setDatabaseShapeColumn

public void setDatabaseShapeColumn(java.lang.String inShapeColumn)
Set the name of the column containing shapes.


getDatabaseUsername

public java.lang.String getDatabaseUsername()
Get the username with permission to connect to the database. These are defined in the database.


setDatabaseUsername

public void setDatabaseUsername(java.lang.String inDatabaseUsername)
Set the username with permission to connect to the database. These are defined in the database.


getDatabasePassword

public java.lang.String getDatabasePassword()
Get the password that validates the username.


setDatabasePassword

public void setDatabasePassword(java.lang.String inDatabasePassword)
Set the password that validates the username.


getDatabaseSpatialReferenceID

public int getDatabaseSpatialReferenceID()
Returns the spatial reference id to use for converting shapes to and from database format.


setDatabaseSpatialReferenceID

public void setDatabaseSpatialReferenceID(int inDatabaseSpatialReferenceID)
Sets the SpatialReferenceID to use when converting shapes to and from database format.


setDatabaseSpatialReferenceID

public void setDatabaseSpatialReferenceID(java.lang.String inDatabaseSpatialReferenceID)
Sets the SpatialReferenceID to use when converting shapes to and from database format.


connect

public java.sql.Connection connect()
                            throws java.lang.Exception
Connect this datasource to the database

Throws:
java.lang.Exception

closeConnection

protected void closeConnection()
                        throws java.lang.Exception
Close the connection to the database.

Throws:
java.lang.Exception

finalize

public void finalize()
Close any open connections


getNode

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

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

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 SimpleDataSource
Throws:
java.lang.Exception

load

public void load(java.util.Properties inProperties)
Initialize the data source from the properties.


readEnvelope

public Envelope readEnvelope()
                      throws java.lang.Exception
Returns the bounding rectangle of all the shapes in the Data Source.

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

getSQLConverter

public SQLConverter getSQLConverter()
Returns the converter for this Database.

Overrides:
getSQLConverter in class SimpleDBDataSource