Package org.kiwiproject.dropwizard.jdbi3
Class Jdbi3Builders
- java.lang.Object
-
- org.kiwiproject.dropwizard.jdbi3.Jdbi3Builders
-
public class Jdbi3Builders extends Object
Utilities for building Dropwizard-managedJdbiversion 3 instances.The
Jdbifactory methods in this class will automatically search for and install the appropriateJdbiPluginwhen the database is H2 or Postgres. The H2 plugin isorg.jdbi.v3.core.h2.H2DatabasePluginand the Postgres plugin isorg.jdbi.v3.postgres.PostgresPlugin.The
SqlObjectPluginis 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-privateJdbiPlugin.Singletonclass.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_HEALTH_CHECK_NAME
-
Constructor Summary
Constructors Constructor Description Jdbi3Builders()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jdbi.v3.core.JdbibuildManagedJdbi(io.dropwizard.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-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, aManagedDataSource, and a name to give the health check.static org.jdbi.v3.core.JdbibuildManagedJdbi(io.dropwizard.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource dataSource, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, and aManagedDataSource.static org.jdbi.v3.core.JdbibuildManagedJdbi(io.dropwizard.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, and a name to give the health check.static org.jdbi.v3.core.JdbibuildManagedJdbi(io.dropwizard.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironmentandPooledDataSourceFactory.
-
-
-
Field Detail
-
DEFAULT_HEALTH_CHECK_NAME
public static final String DEFAULT_HEALTH_CHECK_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildManagedJdbi
public static org.jdbi.v3.core.Jdbi buildManagedJdbi(io.dropwizard.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironmentandPooledDataSourceFactory. This will also registerSqlObjectPluginwith JDBI before returning it.- Parameters:
environment- theEnvironmentdataSourceFactory- thePooledDataSourceFactoryjdbiPlugins- any otherJdbiPluginobjects desired- Returns:
- the
Jdbiinstance - Implementation Note:
- With the exception of
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.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, String healthCheckName, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, and a name to give the health check.- Parameters:
environment- theEnvironmentdataSourceFactory- thePooledDataSourceFactoryhealthCheckName- the health check's namejdbiPlugins- any otherJdbiPluginobjects desired- Returns:
- the
Jdbiinstance - Implementation Note:
- With the exception of
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.setup.Environment environment, io.dropwizard.db.PooledDataSourceFactory dataSourceFactory, io.dropwizard.db.ManagedDataSource dataSource, org.jdbi.v3.core.spi.JdbiPlugin... jdbiPlugins)Build a Dropwizard-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, and aManagedDataSource. This will also registerSqlObjectPluginwith JDBI before returning it.- Parameters:
environment- theEnvironmentdataSourceFactory- thePooledDataSourceFactorydataSource- theManagedDataSourcejdbiPlugins- any otherJdbiPluginobjects desired- Returns:
- the
Jdbiinstance - Implementation Note:
- With the exception of
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.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-managedJdbiinstance with metrics and health check given anEnvironment, aPooledDataSourceFactory, aManagedDataSource, and a name to give the health check. This will also registerSqlObjectPluginwith JDBI before returning it.- Parameters:
environment- theEnvironmentdataSourceFactory- thePooledDataSourceFactorymanagedDataSource- theManagedDataSourcehealthCheckName- the health check's namejdbiPlugins- any otherJdbiPluginobjects desired- Returns:
- the
Jdbiinstance - Implementation Note:
- With the exception of
SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.
-
-