Class 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:
    Serialized Form
    • 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 org.apache.tomcat.jdbc.pool.PoolConfiguration

        PKG_PREFIX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getConfiguredDriverClassName()  
      String getConfiguredPassword()  
      String getConfiguredUrl()  
      String getConfiguredUsername()  
      String getConfiguredValidationQuery()  
      String getDriverClassName()  
      String getJndiName()  
      String getPassword()  
      String getUrl()  
      String getUsername()  
      String getValidationQuery()  
      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
    • Constructor Detail

      • DatasourceConfiguration

        public DatasourceConfiguration​(@Parameter
                                       String name)
        Constructor.
        Parameters:
        name - name that comes from properties
    • Method Detail

      • setDbProperties

        public void setDbProperties​(@MapFormat(keyFormat=UNDER_SCORE_SEPARATED)
                                    Properties dbProperties)
        Specified by:
        setDbProperties in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        setDbProperties in class org.apache.tomcat.jdbc.pool.PoolProperties
      • getDriverClassName

        public String getDriverClassName()
        Specified by:
        getDriverClassName in interface BasicJdbcConfiguration
        Specified by:
        getDriverClassName in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        getDriverClassName in class org.apache.tomcat.jdbc.pool.PoolProperties
        Returns:
        The calculated driver class name
      • getUrl

        public String getUrl()
        Specified by:
        getUrl in interface BasicJdbcConfiguration
        Specified by:
        getUrl in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        getUrl in class org.apache.tomcat.jdbc.pool.PoolProperties
        Returns:
        The calculated URL
      • getUsername

        public String getUsername()
        Specified by:
        getUsername in interface BasicJdbcConfiguration
        Specified by:
        getUsername in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        getUsername in class org.apache.tomcat.jdbc.pool.PoolProperties
        Returns:
        The calculated username
      • getPassword

        public String getPassword()
        Specified by:
        getPassword in interface BasicJdbcConfiguration
        Specified by:
        getPassword in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        getPassword in class org.apache.tomcat.jdbc.pool.PoolProperties
        Returns:
        The calculated password
      • getValidationQuery

        public String getValidationQuery()
        Specified by:
        getValidationQuery in interface BasicJdbcConfiguration
        Specified by:
        getValidationQuery in interface org.apache.tomcat.jdbc.pool.PoolConfiguration
        Overrides:
        getValidationQuery in class org.apache.tomcat.jdbc.pool.PoolProperties
        Returns:
        The calculated validation query
      • getJndiName

        public String getJndiName()
        Returns:
        The JNDI name
      • setJndiName

        public void setJndiName​(String jndiName)
        Parameters:
        jndiName - Set the JDNI name