java.lang.Object
com.aoapps.sql.wrapper.DriverWrapper
- All Implemented Interfaces:
Driver
- Direct Known Subclasses:
Driver
Wraps connections obtained from other drivers.
- Author:
- AO Industries, Inc.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsURL
(String url) connect
(String url, Properties info) protected int
getDriverMajorVersion
(int wrappedMajor) Gets the driver major version for the given wrapped-driver's major version.protected int
getDriverMinorVersion
(int wrappedMinor) Gets the driver minor version for the given wrapped-driver's minor version.protected String
getDriverName
(String wrappedName) Gets the driver name for the given wrapped-driver's name.protected String
getDriverVersion
(String wrappedVersion) Gets the driver version for the given wrapped-driver's version.abstract int
abstract int
abstract Logger
getPropertyInfo
(String url, Properties info) protected abstract String
Gets the JDBC prefix used for this driver wrapper.protected abstract String
Gets the full version string, which may be used for the driver version meta data associated with connections.boolean
protected ConnectionWrapperImpl
newConnectionWrapper
(Connection connection) Creates a newConnectionWrapperImpl
.protected void
Called on driver deregistration.toString()
protected String
toWrappedUrl
(String wrapperUrl) Gets the JDBC URL used by the wrapped driver.protected String
toWrapperUrl
(String wrappedUrl) Gets the JDBC URL used by the wrapper driver.protected ConnectionWrapperImpl
wrapConnection
(Connection connection) Wraps aConnection
, if not already wrapped by this wrapper.
-
Constructor Details
-
DriverWrapper
protected DriverWrapper()
-
-
Method Details
-
toString
-
getUrlPrefix
Gets the JDBC prefix used for this driver wrapper. This will be inserted after "jdbc:" in the wrapped driver URL. For example, "jdbc:prefix:postgresql://host/database" -
newConnectionWrapper
Creates a newConnectionWrapperImpl
.- See Also:
-
wrapConnection
Wraps aConnection
, if not already wrapped by this wrapper.- See Also:
-
toWrappedUrl
Gets the JDBC URL used by the wrapped driver. This removes the prefix from the URL.- Returns:
- The modified URL or
null
when prefix not found in the URL.
-
toWrapperUrl
Gets the JDBC URL used by the wrapper driver. This adds the prefix to the URL.- Returns:
- The modified URL, with prefix in the URL.
- Throws:
SQLException
- When the wrapped URL does not begin withJDBC_SCHEMA
- See Also:
-
getDriverName
Gets the driver name for the given wrapped-driver's name.This default implementation prefixes the wrapped-driver's name with
.getUrlPrefix()
+ ':'- See Also:
-
getDriverVersion
Gets the driver version for the given wrapped-driver's version.This default implementation prefixes the wrapped-driver's version with
.getVersion()
+ ':'- See Also:
-
getDriverMajorVersion
protected int getDriverMajorVersion(int wrappedMajor) Gets the driver major version for the given wrapped-driver's major version.This default implementation returns
getMajorVersion()
.- See Also:
-
getDriverMinorVersion
protected int getDriverMinorVersion(int wrappedMinor) Gets the driver minor version for the given wrapped-driver's minor version.This default implementation returns
getMinorVersion()
.- See Also:
-
connect
- Specified by:
connect
in interfaceDriver
- Throws:
SQLException
-
acceptsURL
- Specified by:
acceptsURL
in interfaceDriver
- Throws:
SQLException
-
getPropertyInfo
- Specified by:
getPropertyInfo
in interfaceDriver
- Throws:
SQLException
-
getVersion
Gets the full version string, which may be used for the driver version meta data associated with connections.- See Also:
-
getMajorVersion
public abstract int getMajorVersion()- Specified by:
getMajorVersion
in interfaceDriver
-
getMinorVersion
public abstract int getMinorVersion()- Specified by:
getMinorVersion
in interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliant
in interfaceDriver
-
getParentLogger
- Specified by:
getParentLogger
in interfaceDriver
- Throws:
SQLFeatureNotSupportedException
-
onDeregister
protected void onDeregister()Called on driver deregistration.- See Also:
-