Class JdbiFactory

java.lang.Object
io.dropwizard.jdbi3.JdbiFactory

public class JdbiFactory extends Object
  • Constructor Details

    • JdbiFactory

      public JdbiFactory()
    • JdbiFactory

      public JdbiFactory(com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy)
  • Method Details

    • build

      public org.jdbi.v3.core.Jdbi build(Environment environment, PooledDataSourceFactory configuration, String name)
      Build a fully configured Jdbi instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, override newInstance(ManagedDataSource) and configure(Jdbi))
      Parameters:
      environment -
      configuration -
      name -
      Returns:
      A fully configured Jdbi object using a managed data source based on the specified environment and configuration
      See Also:
    • build

      public org.jdbi.v3.core.Jdbi build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name)
      Build a fully configured Jdbi instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, override newInstance(ManagedDataSource) and configure(Jdbi))
      Parameters:
      environment -
      configuration -
      dataSource -
      name -
      Returns:
      A fully configured Jdbi object
    • buildSQLLogger

      protected com.codahale.metrics.jdbi3.InstrumentedSqlLogger buildSQLLogger(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy)
      This creates a default InstrumentedSqlLogger instance with the specified MetricRegistry and nameStrategy. This can be overridden if required.
      Parameters:
      metricRegistry - The MetricRegistry to send to the InstrumentedSqlLogger.
      nameStrategy - The StatementNameStrategy to send to the InstrumentedSqlLogger.
      Returns:
      The created InstrumentedSqlLogger.
      Since:
      2.0
    • newInstance

      protected org.jdbi.v3.core.Jdbi newInstance(ManagedDataSource dataSource)
      This creates a vanilla Jdbi instance based on the specified data source; this can be overridden if required
      Parameters:
      dataSource -
      Returns:
    • configure

      protected void configure(org.jdbi.v3.core.Jdbi jdbi)
      Overridable function to allow extra customization of the created Jdbi instance.

      If this is overridden it is strongly recommend that super.configure(jdbi, configuration) is invoked before any other changes are made if you intend to use the default as a base so that the customized settings will supersede the defaults

      Parameters:
      jdbi -