org.postgis.java2d
Class Java2DWrapper

java.lang.Object
  extended by org.postgresql.Driver
      extended by org.postgis.java2d.Java2DWrapper
All Implemented Interfaces:
java.sql.Driver

public class Java2DWrapper
extends org.postgresql.Driver

Java2DWrapper Wraps the PostGreSQL Driver to add transparent readonly support for PostGIS objects into java2d path objects. This method currently works with J2EE DataSource implementations, and with DriverManager framework. Simply replace the "jdbc:postgresql:" with a "jdbc:postgis_j2d" in the jdbc URL.

Author:
markus.schaber@logix-tt.com

Field Summary
static java.lang.String POSTGIS_PROTOCOL
           
static java.lang.String REVISION
           
 
Fields inherited from class org.postgresql.Driver
DEBUG, INFO, MAJORVERSION, MINORVERSION
 
Constructor Summary
Java2DWrapper()
           
 
Method Summary
 boolean acceptsURL(java.lang.String url)
          Returns true if the driver thinks it can open a connection to the given URL.
static void addGISTypes(org.postgresql.PGConnection pgconn)
          adds the JTS/PostGIS Data types to a PG Connection.
 java.sql.Connection connect(java.lang.String url, java.util.Properties info)
          Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()
 int getMajorVersion()
          Gets the underlying drivers major version number
 int getMinorVersion()
          Get the underlying drivers minor version number
static java.lang.String getVersion()
          Returns our own CVS version plus postgres Version
static java.lang.String mangleURL(java.lang.String url)
          Mangles the PostGIS URL to return the original PostGreSQL URL
 
Methods inherited from class org.postgresql.Driver
getLogLevel, getPropertyInfo, jdbcCompliant, makeSSL, notImplemented, setLogLevel, sslEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSTGIS_PROTOCOL

public static final java.lang.String POSTGIS_PROTOCOL
See Also:
Constant Field Values

REVISION

public static final java.lang.String REVISION
See Also:
Constant Field Values
Constructor Detail

Java2DWrapper

public Java2DWrapper()
Method Detail

connect

public java.sql.Connection connect(java.lang.String url,
                                   java.util.Properties info)
                            throws java.sql.SQLException
Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()

Specified by:
connect in interface java.sql.Driver
Overrides:
connect in class org.postgresql.Driver
Parameters:
url - the URL of the database to connect to
info - a list of arbitrary tag/value pairs as connection arguments
Returns:
a connection to the URL or null if it isnt us
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
Driver.connect(java.lang.String, java.util.Properties), Driver

addGISTypes

public static void addGISTypes(org.postgresql.PGConnection pgconn)
                        throws java.sql.SQLException
adds the JTS/PostGIS Data types to a PG Connection.

Throws:
java.sql.SQLException

mangleURL

public static java.lang.String mangleURL(java.lang.String url)
                                  throws java.sql.SQLException
Mangles the PostGIS URL to return the original PostGreSQL URL

Throws:
java.sql.SQLException

acceptsURL

public boolean acceptsURL(java.lang.String url)
                   throws java.sql.SQLException
Returns true if the driver thinks it can open a connection to the given URL. Typically, drivers will return true if they understand the subprotocol specified in the URL and false if they don't. Our protocols start with jdbc:postgresql_postGIS:

Specified by:
acceptsURL in interface java.sql.Driver
Overrides:
acceptsURL in class org.postgresql.Driver
Parameters:
url - the URL of the driver
Returns:
true if this driver accepts the given URL
Throws:
java.sql.SQLException - if a database-access error occurs (Dont know why it would *shrug*)
See Also:
Driver.acceptsURL(java.lang.String)

getMajorVersion

public int getMajorVersion()
Gets the underlying drivers major version number

Specified by:
getMajorVersion in interface java.sql.Driver
Overrides:
getMajorVersion in class org.postgresql.Driver
Returns:
the drivers major version number

getMinorVersion

public int getMinorVersion()
Get the underlying drivers minor version number

Specified by:
getMinorVersion in interface java.sql.Driver
Overrides:
getMinorVersion in class org.postgresql.Driver
Returns:
the drivers minor version number

getVersion

public static java.lang.String getVersion()
Returns our own CVS version plus postgres Version