Package io.dropwizard.jdbi3
Class JdbiFactory
- java.lang.Object
-
- io.dropwizard.jdbi3.JdbiFactory
-
public class JdbiFactory extends Object
-
-
Constructor Summary
Constructors Constructor Description JdbiFactory()
JdbiFactory(com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jdbi.v3.core.Jdbi
build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name)
Build a fully configuredJdbi
instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, overridenewInstance(ManagedDataSource)
andconfigure(Jdbi)
)org.jdbi.v3.core.Jdbi
build(Environment environment, PooledDataSourceFactory configuration, String name)
Build a fully configuredJdbi
instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, overridenewInstance(ManagedDataSource)
andconfigure(Jdbi)
)protected com.codahale.metrics.jdbi3.InstrumentedSqlLogger
buildSQLLogger(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy)
This creates a defaultInstrumentedSqlLogger
instance with the specifiedMetricRegistry
andnameStrategy
.protected void
configure(org.jdbi.v3.core.Jdbi jdbi)
Overridable function to allow extra customization of the createdJdbi
instance.protected org.jdbi.v3.core.Jdbi
newInstance(ManagedDataSource dataSource)
This creates a vanillaJdbi
instance based on the specified data source; this can be overridden if required
-
-
-
Method Detail
-
build
public org.jdbi.v3.core.Jdbi build(Environment environment, PooledDataSourceFactory configuration, String name)
Build a fully configuredJdbi
instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, overridenewInstance(ManagedDataSource)
andconfigure(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(Environment, PooledDataSourceFactory, ManagedDataSource, String)
-
build
public org.jdbi.v3.core.Jdbi build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name)
Build a fully configuredJdbi
instance managed by the DropWizard lifecycle with the configured health check; this method should not be overridden (instead, overridenewInstance(ManagedDataSource)
andconfigure(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 defaultInstrumentedSqlLogger
instance with the specifiedMetricRegistry
andnameStrategy
. This can be overridden if required.- Parameters:
metricRegistry
- TheMetricRegistry
to send to theInstrumentedSqlLogger
.nameStrategy
- TheStatementNameStrategy
to send to theInstrumentedSqlLogger
.- Returns:
- The created
InstrumentedSqlLogger
. - Since:
- 2.0
-
newInstance
protected org.jdbi.v3.core.Jdbi newInstance(ManagedDataSource dataSource)
This creates a vanillaJdbi
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 createdJdbi
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
-
-
-