Package io.dropwizard.jdbi3
Class JdbiFactory
java.lang.Object
io.dropwizard.jdbi3.JdbiFactory
-
Constructor Summary
ConstructorsConstructorDescriptionJdbiFactory(com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy) -
Method Summary
Modifier and TypeMethodDescriptionorg.jdbi.v3.core.Jdbibuild(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name) Build a fully configuredJdbiinstance 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.Jdbibuild(Environment environment, PooledDataSourceFactory configuration, String name) Build a fully configuredJdbiinstance 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.InstrumentedSqlLoggerbuildSQLLogger(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy) This creates a defaultInstrumentedSqlLoggerinstance with the specifiedMetricRegistryandnameStrategy.protected voidconfigure(org.jdbi.v3.core.Jdbi jdbi) Overridable function to allow extra customization of the createdJdbiinstance.protected org.jdbi.v3.core.JdbinewInstance(ManagedDataSource dataSource) This creates a vanillaJdbiinstance based on the specified data source; this can be overridden if required
-
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 configuredJdbiinstance 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
Jdbiobject 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 configuredJdbiinstance 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
Jdbiobject
-
buildSQLLogger
protected com.codahale.metrics.jdbi3.InstrumentedSqlLogger buildSQLLogger(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.jdbi3.strategies.StatementNameStrategy nameStrategy) This creates a defaultInstrumentedSqlLoggerinstance with the specifiedMetricRegistryandnameStrategy. This can be overridden if required.- Parameters:
metricRegistry- TheMetricRegistryto send to theInstrumentedSqlLogger.nameStrategy- TheStatementNameStrategyto send to theInstrumentedSqlLogger.- Returns:
- The created
InstrumentedSqlLogger. - Since:
- 2.0
-
newInstance
This creates a vanillaJdbiinstance 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 createdJdbiinstance.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-
-