Class DatasourceConfiguration
java.lang.Object
org.apache.tomcat.jdbc.pool.PoolProperties
io.micronaut.configuration.jdbc.tomcat.DatasourceConfiguration
- All Implemented Interfaces:
BasicJdbcConfiguration
,Serializable
,Cloneable
,org.apache.tomcat.jdbc.pool.PoolConfiguration
@EachProperty(value="datasources",
primary="default")
public class DatasourceConfiguration
extends org.apache.tomcat.jdbc.pool.PoolProperties
implements BasicJdbcConfiguration
Allows the configuration of Tomcat JDBC data sources. All properties on
PoolProperties
are available to be configured.
If the url, driver class, username, or password are missing, sensible defaults
will be provided when possible. If no configuration beyond the datasource name
is provided, an in memory datasource will be configured based on the available
drivers on the classpath.- Since:
- 1.0
- Author:
- James Kleeh
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.PoolProperties
org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorDefinition, org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorProperty
-
Field Summary
Fields inherited from class org.apache.tomcat.jdbc.pool.PoolProperties
DEFAULT_MAX_ACTIVE, poolCounter
Fields inherited from interface io.micronaut.jdbc.BasicJdbcConfiguration
PREFIX
Fields inherited from interface org.apache.tomcat.jdbc.pool.PoolConfiguration
PKG_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetUrl()
void
setDataSourceProperties
(Map<String, ?> dsProperties) Sets the datasource properties.void
setDbProperties
(Properties dbProperties) void
setJndiName
(String jndiName) Methods inherited from class org.apache.tomcat.jdbc.pool.PoolProperties
clone, getAbandonWhenPercentageFull, getCommitOnReturn, getConnectionProperties, getDataSource, getDataSourceJNDI, getDbProperties, getDefaultAutoCommit, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getInitialSize, getInitSQL, getJdbcInterceptors, getJdbcInterceptorsAsArray, getLogValidationErrors, getMaxActive, getMaxAge, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getName, getNumTestsPerEvictionRun, getPoolCounter, getPoolName, getPropagateInterruptState, getProperties, getRemoveAbandonedTimeout, getRollbackOnReturn, getSuspectTimeout, getTimeBetweenEvictionRunsMillis, getUseDisposableConnectionFacade, getUseLock, getUseStatementFacade, getValidationInterval, getValidationQueryTimeout, getValidator, getValidatorClassName, isAccessToUnderlyingConnectionAllowed, isAlternateUsernameAllowed, isDefaultAutoCommit, isDefaultReadOnly, isFairQueue, isIgnoreExceptionOnPreLoad, isJmxEnabled, isLogAbandoned, isPoolSweeperEnabled, isRemoveAbandoned, isTestOnBorrow, isTestOnConnect, isTestOnReturn, isTestWhileIdle, isUseEquals, setAbandonWhenPercentageFull, setAccessToUnderlyingConnectionAllowed, setAlternateUsernameAllowed, setCommitOnReturn, setConnectionProperties, setDataSource, setDataSourceJNDI, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setDriverClassName, setFairQueue, setIgnoreExceptionOnPreLoad, setInitialSize, setInitSQL, setJdbcInterceptors, setJmxEnabled, setLogAbandoned, setLogValidationErrors, setMaxActive, setMaxAge, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setName, setNumTestsPerEvictionRun, setPassword, setPropagateInterruptState, setRemoveAbandoned, setRemoveAbandonedTimeout, setRollbackOnReturn, setSuspectTimeout, setTestOnBorrow, setTestOnConnect, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setUrl, setUseDisposableConnectionFacade, setUseEquals, setUseLock, setUsername, setUseStatementFacade, setValidationInterval, setValidationQuery, setValidationQueryTimeout, setValidator, setValidatorClassName, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.jdbc.BasicJdbcConfiguration
getName, setDriverClassName, setPassword, setUrl, setUsername
-
Constructor Details
-
DatasourceConfiguration
Constructor.- Parameters:
name
- name that comes from properties
-
-
Method Details
-
setDbProperties
- Specified by:
setDbProperties
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
setDbProperties
in classorg.apache.tomcat.jdbc.pool.PoolProperties
-
getDriverClassName
- Specified by:
getDriverClassName
in interfaceBasicJdbcConfiguration
- Specified by:
getDriverClassName
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
getDriverClassName
in classorg.apache.tomcat.jdbc.pool.PoolProperties
- Returns:
- The calculated driver class name
-
getConfiguredDriverClassName
- Specified by:
getConfiguredDriverClassName
in interfaceBasicJdbcConfiguration
- Returns:
- The configured driver class name
-
getUrl
- Specified by:
getUrl
in interfaceBasicJdbcConfiguration
- Specified by:
getUrl
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
getUrl
in classorg.apache.tomcat.jdbc.pool.PoolProperties
- Returns:
- The calculated URL
-
getConfiguredUrl
- Specified by:
getConfiguredUrl
in interfaceBasicJdbcConfiguration
- Returns:
- The configured URL
-
getUsername
- Specified by:
getUsername
in interfaceBasicJdbcConfiguration
- Specified by:
getUsername
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
getUsername
in classorg.apache.tomcat.jdbc.pool.PoolProperties
- Returns:
- The calculated username
-
getConfiguredUsername
- Specified by:
getConfiguredUsername
in interfaceBasicJdbcConfiguration
- Returns:
- The configured username
-
getPassword
- Specified by:
getPassword
in interfaceBasicJdbcConfiguration
- Specified by:
getPassword
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
getPassword
in classorg.apache.tomcat.jdbc.pool.PoolProperties
- Returns:
- The calculated password
-
getConfiguredPassword
- Specified by:
getConfiguredPassword
in interfaceBasicJdbcConfiguration
- Returns:
- The configured password
-
getValidationQuery
- Specified by:
getValidationQuery
in interfaceBasicJdbcConfiguration
- Specified by:
getValidationQuery
in interfaceorg.apache.tomcat.jdbc.pool.PoolConfiguration
- Overrides:
getValidationQuery
in classorg.apache.tomcat.jdbc.pool.PoolProperties
- Returns:
- The calculated validation query
-
setDataSourceProperties
public void setDataSourceProperties(@MapFormat(transformation=FLAT,keyFormat=RAW) Map<String, ?> dsProperties) Description copied from interface:BasicJdbcConfiguration
Sets the datasource properties.- Specified by:
setDataSourceProperties
in interfaceBasicJdbcConfiguration
- Parameters:
dsProperties
- The properties
-
getConfiguredValidationQuery
- Specified by:
getConfiguredValidationQuery
in interfaceBasicJdbcConfiguration
- Returns:
- The configured validation query
-
getJndiName
- Returns:
- The JNDI name
-
setJndiName
- Parameters:
jndiName
- Set the JDNI name
-