Class Jdbi3Builders

java.lang.Object
org.kiwiproject.dropwizard.jdbi3.Jdbi3Builders

public final class Jdbi3Builders extends Object
Utilities for building Dropwizard-managed Jdbi version 3 instances.

The Jdbi factory methods in this class will automatically search for and install the appropriate JdbiPlugin when the database is H2 or Postgres. The H2 plugin is org.jdbi.v3.core.h2.H2DatabasePlugin and the Postgres plugin is org.jdbi.v3.postgres.PostgresPlugin.

The SqlObjectPlugin is always installed, and is assumed to be on the classpath.

Note also that when installing plugins, JDBI ignores duplicates (e.g. if you attempt to install more than one SqlObjectPlugin) only when the plugin is designed as a "single-install" plugin. JDBI plugins are "single-install" when they extend the package-private JdbiPlugin.Singleton class.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.jdbi.v3.core.Jdbi
    buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource managedDataSource, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
    Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, a ManagedDataSource, and a name to give the health check.
    static org.jdbi.v3.core.Jdbi
    buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource dataSource, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
    Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, and a ManagedDataSource.
    static org.jdbi.v3.core.Jdbi
    buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
    Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, and a name to give the health check.
    static org.jdbi.v3.core.Jdbi
    buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
    Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment and PooledDataSourceFactory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • buildManagedJdbi

      public static org.jdbi.v3.core.Jdbi buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
      Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment and PooledDataSourceFactory. This will also register SqlObjectPlugin with JDBI before returning it.
      Parameters:
      environment - the Environment
      dataSourceFactory - the PooledDataSourceFactory
      jdbiPlugins - any other JdbiPlugin objects desired
      Returns:
      the Jdbi instance
      Implementation Note:
      Except SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.
    • buildManagedJdbi

      public static org.jdbi.v3.core.Jdbi buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
      Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, and a name to give the health check.
      Parameters:
      environment - the Environment
      dataSourceFactory - the PooledDataSourceFactory
      healthCheckName - the health check's name
      jdbiPlugins - any other JdbiPlugin objects desired
      Returns:
      the Jdbi instance
      Implementation Note:
      Except SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.
    • buildManagedJdbi

      public static org.jdbi.v3.core.Jdbi buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource dataSource, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
      Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, and a ManagedDataSource. This will also register SqlObjectPlugin with JDBI before returning it.
      Parameters:
      environment - the Environment
      dataSourceFactory - the PooledDataSourceFactory
      dataSource - the ManagedDataSource
      jdbiPlugins - any other JdbiPlugin objects desired
      Returns:
      the Jdbi instance
      Implementation Note:
      Except SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.
    • buildManagedJdbi

      public static org.jdbi.v3.core.Jdbi buildManagedJdbi(io.dropwizard.core.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource managedDataSource, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)
      Build a Dropwizard-managed Jdbi instance with metrics and health check given an Environment, a PooledDataSourceFactory, a ManagedDataSource, and a name to give the health check. This will also register SqlObjectPlugin with JDBI before returning it.
      Parameters:
      environment - the Environment
      dataSourceFactory - the PooledDataSourceFactory
      managedDataSource - the ManagedDataSource
      healthCheckName - the health check's name
      jdbiPlugins - any other JdbiPlugin objects desired
      Returns:
      the Jdbi instance
      Implementation Note:
      Except SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.