Package org.pjdbc.sql
Class AbstractDriver
java.lang.Object
org.pjdbc.sql.AbstractDriver
- All Implemented Interfaces:
Driver
- Direct Known Subclasses:
AbstractProxyDriver,FederatingDriver,MockDriver
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptsProtocol(String protocol) protected abstract booleanacceptsSubName(String subname) protected abstract booleanacceptsSubProtocol(String subprotocol) booleanacceptsURL(String url) intintgetPropertyInfo(String url, Properties info) protected StringgetUrlParameter(String url, String key) Get a URL parameter value.protected StringgetUrlParameter(String url, String key, String defaultValue) Get a URL parameter value with a default.getUrlParameters(String url) Get all URL parameters as a map.booleanprotected JdbcUrlParserParse the URL and return the JdbcUrlParser, or null if invalid.protected Stringprotected Stringprotected Stringsubprotocol(String url) protected voidvalidateParameters(String url) Validates URL parameters against @DriverParameter annotations on this driver class.
-
Constructor Details
-
AbstractDriver
public AbstractDriver()
-
-
Method Details
-
parseUrl
Parse the URL and return the JdbcUrlParser, or null if invalid. -
protocol
-
subprotocol
-
subname
-
getUrlParameter
Get a URL parameter value.- Parameters:
url- the JDBC URLkey- the parameter key- Returns:
- the parameter value, or null if not found
-
getUrlParameter
Get a URL parameter value with a default.- Parameters:
url- the JDBC URLkey- the parameter keydefaultValue- the default value if not found- Returns:
- the parameter value, or the default if not found
-
getUrlParameters
Get all URL parameters as a map.- Parameters:
url- the JDBC URL- Returns:
- unmodifiable map of parameters, empty if none
-
validateParameters
Validates URL parameters against @DriverParameter annotations on this driver class.Call this method at the beginning of
Driver.connect(String, Properties)to validate parameters before using them. Throws SQLException with detailed error messages if validation fails.- Parameters:
url- the JDBC URL containing parameters- Throws:
SQLException- if parameter validation fails
-
acceptsProtocol
-
acceptsSubProtocol
-
acceptsSubName
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver- Throws:
SQLFeatureNotSupportedException
-
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliantin interfaceDriver
-