Package org.apache.calcite.avatica
Class UnregisteredDriver
java.lang.Object
org.apache.calcite.avatica.UnregisteredDriver
- All Implemented Interfaces:
Driver
- Direct Known Subclasses:
Driver
Implementation of JDBC driver that does not register itself.
You can easily create a "vanity driver" that recognizes its own URL prefix as a sub-class of this class. Per the JDBC specification it must register itself when the class is loaded.
Derived classes must implement createDriverVersion() and
getConnectStringPrefix(), and may override
createFactory().
The provider must implement:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumJDBC version. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) connect(String url, Properties info) protected abstract DriverVersionCreates an object describing the name and version of this driver.protected AvaticaFactoryCreates a factory for JDBC objects (connection, statement).protected HandlerCreates a Handler.abstract MetacreateMeta(AvaticaConnection connection) Creates a service handler that will give connections from this Driver their behavior.protected Collection<ConnectionProperty>Returns the connection properties supported by this driver.protected abstract StringReturns the prefix of the connect string that this driver will recognize as its own.Returns the driver version object.protected StringgetFactoryClassName(UnregisteredDriver.JdbcVersion jdbcVersion) Returns the name of a class to be factory for JDBC objects (connection, statement) appropriate for the current JDBC version.final intfinal intgetPropertyInfo(String url, Properties info) protected static AvaticaFactoryinstantiateFactory(String factoryClassName) Helper method for creating factories.booleanprotected voidregister()Registers this driver with the driver manager.
-
Field Details
-
factory
-
handler
-
-
Constructor Details
-
UnregisteredDriver
protected UnregisteredDriver()
-
-
Method Details
-
createFactory
Creates a factory for JDBC objects (connection, statement). Called from the driver constructor.The default implementation calls
UnregisteredDriver.JdbcVersion.current(), thengetFactoryClassName(org.apache.calcite.avatica.UnregisteredDriver.JdbcVersion)with that version, then passes that class name toinstantiateFactory(String). This approach is recommended it does not include in the code references to classes that may not be instantiable in all JDK versions. But drivers are free to do it their own way.- Returns:
- JDBC object factory
-
createHandler
Creates a Handler. -
getFactoryClassName
Returns the name of a class to be factory for JDBC objects (connection, statement) appropriate for the current JDBC version. -
createDriverVersion
Creates an object describing the name and version of this driver. Called from the driver constructor. -
getConnectionProperties
Returns the connection properties supported by this driver. -
instantiateFactory
Helper method for creating factories. -
connect
- Specified by:
connectin interfaceDriver- Throws:
SQLException
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver- Throws:
SQLException
-
getConnectStringPrefix
Returns the prefix of the connect string that this driver will recognize as its own. For example, "jdbc:calcite:". -
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver
-
getDriverVersion
Returns the driver version object. Not in the JDBC API.- Returns:
- Driver version
-
getMajorVersion
public final int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public final int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliantin interfaceDriver
-
register
protected void register()Registers this driver with the driver manager. -
createMeta
Creates a service handler that will give connections from this Driver their behavior.
-