Package org.kiwiproject.dropwizard.jdbi3
Class Jdbi3Builders
java.lang.Object
org.kiwiproject.dropwizard.jdbi3.Jdbi3Builders
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jdbi.v3.core.JdbibuildManagedJdbi(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-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.core.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.core.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.core.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 Details
-
DEFAULT_HEALTH_CHECK_NAME
- See Also:
-
-
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-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:
- 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-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:
- 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-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:
- 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-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:
- Except
SqlObjectPlugin, this method will allow you to install multiple of the same plugin. User beware.
-