Package org.umlg.sqlg
Interface SqlgPlugin
public interface SqlgPlugin
- Since:
- 1.2.0
- Author:
- Lukas Krejci
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canWorkWith
(DatabaseMetaData metaData) Returns true if this dialect can handle a connection to a database identified by the provided metadata, false otherwise.getDriverFor
(String connectionUrl) Returns the fully qualified class name of the JDBC driver to use for given connection URL or null if this dialect doesn't know how to handle that URL.Instantiates the dialect based on the provided configuration.static SqlgPlugin
Loads the plugin to use for the provided JDBC URL.static SqlgPlugin
load
(DatabaseMetaData metaData) Loads the plugin to use for the provided database meta data.default String
manageJdbcUrl
(String jdbcUrl) Add additional properties to the jdbc url
-
Method Details
-
getDriverFor
Returns the fully qualified class name of the JDBC driver to use for given connection URL or null if this dialect doesn't know how to handle that URL.- Parameters:
connectionUrl
- the JDBC URL of the database to connect to- Returns:
- the FQCN of the driver on null.
-
canWorkWith
Returns true if this dialect can handle a connection to a database identified by the provided metadata, false otherwise.Note that this method is only used when Sqlg is provided the connection from JNDI and thus the connection and pooling is handled externally.
- Parameters:
metaData
- the metadata identifying the database being connected to.- Returns:
- true if this dialect can work on this connection, false otherwise
- Throws:
SQLException
-
instantiateDialect
SqlDialect instantiateDialect()Instantiates the dialect based on the provided configuration. This only gets called ifgetDriverFor(String)
returns non-null class name orcanWorkWith(DatabaseMetaData)
returns true.- Returns:
- the dialect to use, never null
-
load
Loads the plugin to use for the provided JDBC URL.- Parameters:
connectionUrl
- the JDBC URL of the database to connect to- Returns:
- the plugin to use, never null
- Throws:
IllegalStateException
- if no suitable Sqlg plugin could be found
-
load
Loads the plugin to use for the provided database meta data.- Parameters:
metaData
- the JDBC meta data from an established database connection- Returns:
- the plugin to use, never null
- Throws:
IllegalStateException
- if no suitable Sqlg plugin could be foundSQLException
-
manageJdbcUrl
Add additional properties to the jdbc url
-