Package org.postgis.java2d
Class Java2DWrapper
- java.lang.Object
-
- org.postgresql.Driver
-
- org.postgis.java2d.Java2DWrapper
-
- All Implemented Interfaces:
Driver
public class Java2DWrapper extends org.postgresql.DriverJava2DWrapper 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
Fields Modifier and Type Field Description static StringPOSTGIS_PROTOCOLstatic StringREVISION
-
Constructor Summary
Constructors Constructor Description Java2DWrapper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsURL(String url)Returns true if the driver thinks it can open a connection to the given URL.static voidaddGISTypes(org.postgresql.PGConnection pgconn)Adds the JTS/PostGIS Data types to a PG Connection.Connectionconnect(String url, Properties info)Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()intgetMajorVersion()Gets the underlying drivers major version numberintgetMinorVersion()Get the underlying drivers minor version numberLoggergetParentLogger()static StringgetVersion()Returns our own CVS version plus postgres Versionstatic StringmangleURL(String url)Mangles the PostGIS URL to return the original PostGreSQL URL
-
-
-
Field Detail
-
POSTGIS_PROTOCOL
public static final String POSTGIS_PROTOCOL
- See Also:
- Constant Field Values
-
REVISION
public static final String REVISION
- See Also:
- Constant Field Values
-
-
Method Detail
-
connect
public Connection connect(String url, Properties info) throws SQLException
Creates a postgresql connection, and then adds the PostGIS data types to it calling addpgtypes()- Specified by:
connectin interfaceDriver- Overrides:
connectin classorg.postgresql.Driver- Parameters:
url- the URL of the database to connect toinfo- a list of arbitrary tag/value pairs as connection arguments- Returns:
- a connection to the URL or null if it isnt us
- Throws:
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 SQLExceptionAdds the JTS/PostGIS Data types to a PG Connection.- Parameters:
pgconn- The PGConnection object to add the types to- Throws:
SQLException- when a SQLException occursSQLException- when an SQLException occurs
-
mangleURL
public static String mangleURL(String url) throws SQLException
Mangles the PostGIS URL to return the original PostGreSQL URL- Parameters:
url- String containing the url to be "mangled"- Returns:
- "mangled" string
- Throws:
SQLException- when a SQLException occurs
-
acceptsURL
public boolean acceptsURL(String url)
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:
acceptsURLin interfaceDriver- Overrides:
acceptsURLin classorg.postgresql.Driver- Parameters:
url- the URL of the driver- Returns:
- true if this driver accepts the given URL
- See Also:
Driver.acceptsURL(java.lang.String)
-
getMajorVersion
public int getMajorVersion()
Gets the underlying drivers major version number- Specified by:
getMajorVersionin interfaceDriver- Overrides:
getMajorVersionin classorg.postgresql.Driver- Returns:
- the drivers major version number
-
getMinorVersion
public int getMinorVersion()
Get the underlying drivers minor version number- Specified by:
getMinorVersionin interfaceDriver- Overrides:
getMinorVersionin classorg.postgresql.Driver- Returns:
- the drivers minor version number
-
getVersion
public static String getVersion()
Returns our own CVS version plus postgres Version- Returns:
- String identifier for the version
-
getParentLogger
public Logger getParentLogger()
- Specified by:
getParentLoggerin interfaceDriver- Overrides:
getParentLoggerin classorg.postgresql.Driver
-
-