Package io.dropwizard.db
Interface PooledDataSourceFactory
-
- All Known Implementing Classes:
DataSourceFactory
public interface PooledDataSourceFactoryInterface of a factory that produces JDBC data sources backed by the connection pool.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidasSingleConnectionPool()Configures the pool as a single connection pool.ManagedDataSourcebuild(com.codahale.metrics.MetricRegistry metricRegistry, String name)Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.@Nullable StringgetDriverClass()Returns the Java class of the database driver.Map<String,String>getProperties()Returns the configuration properties for ORM tools.StringgetUrl()Returns the JDBC connection URL.Optional<String>getValidationQuery()Returns the SQL query, which is being used for the database connection health check.Optional<Duration>getValidationQueryTimeout()Returns the timeout for awaiting a response from the database during connection health checks.booleanisAutoCommentsEnabled()Whether ORM tools allowed to add comments to SQL queries.
-
-
-
Method Detail
-
isAutoCommentsEnabled
boolean isAutoCommentsEnabled()
Whether ORM tools allowed to add comments to SQL queries.- Returns:
true, if allowed
-
getProperties
Map<String,String> getProperties()
Returns the configuration properties for ORM tools.- Returns:
- configuration properties as a map
-
getValidationQueryTimeout
Optional<Duration> getValidationQueryTimeout()
Returns the timeout for awaiting a response from the database during connection health checks.- Returns:
- the timeout as
Duration
-
getValidationQuery
Optional<String> getValidationQuery()
Returns the SQL query, which is being used for the database connection health check.- Returns:
- the SQL query as a string
-
getDriverClass
@Nullable String getDriverClass()
Returns the Java class of the database driver.- Returns:
- the JDBC driver class as a string
-
getUrl
String getUrl()
Returns the JDBC connection URL.- Returns:
- the JDBC connection URL as a string
-
asSingleConnectionPool
void asSingleConnectionPool()
Configures the pool as a single connection pool. It's useful for tools that use only one database connection, such as database migrations.
-
build
ManagedDataSource build(com.codahale.metrics.MetricRegistry metricRegistry, String name)
Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.- Parameters:
metricRegistry- the application metric registryname- name of the connection pool- Returns:
- a new JDBC data source as
ManagedDataSource
-
-