Package org.umlg.sqlg

Interface SqlgPlugin


public interface SqlgPlugin
Since:
1.2.0
Author:
Lukas Krejci
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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
    load(String connectionUrl)
    Loads the plugin to use for the provided JDBC URL.
    static SqlgPlugin
    Loads the plugin to use for the provided database meta data.
    default String
    Add additional properties to the jdbc url
  • Method Details

    • getDriverFor

      String 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.
      Parameters:
      connectionUrl - the JDBC URL of the database to connect to
      Returns:
      the FQCN of the driver on null.
    • canWorkWith

      boolean canWorkWith(DatabaseMetaData metaData) throws SQLException
      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 if getDriverFor(String) returns non-null class name or canWorkWith(DatabaseMetaData) returns true.
      Returns:
      the dialect to use, never null
    • load

      static SqlgPlugin load(String connectionUrl)
      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

      static SqlgPlugin load(DatabaseMetaData metaData) throws SQLException
      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 found
      SQLException
    • manageJdbcUrl

      default String manageJdbcUrl(String jdbcUrl)
      Add additional properties to the jdbc url