Class BasicDataSourceExt

java.lang.Object
org.apache.commons.dbcp2.BasicDataSource
org.apache.druid.metadata.BasicDataSourceExt
All Implemented Interfaces:
Wrapper, MBeanRegistration, CommonDataSource, DataSource, org.apache.commons.dbcp2.BasicDataSourceMXBean

public class BasicDataSourceExt extends org.apache.commons.dbcp2.BasicDataSource
This class exists so that MetadataStorageConnectorConfig is asked for password every time a brand new connection is established with DB. PasswordProvider impls such as those based on AWS tokens refresh the underlying token periodically since each token is valid for a certain period of time only. So, This class overrides (and largely copies due to lack of extensibility), the methods from base class in order to keep track of connection properties and call MetadataStorageConnectorConfig.getPassword() everytime a new connection is setup.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.apache.commons.dbcp2.ConnectionFactory
     
     
    void
     
    void
    setConnectionProperties(String connectionProperties)
     

    Methods inherited from class org.apache.commons.dbcp2.BasicDataSource

    close, createConnectionPool, createDataSource, createDataSourceInstance, createPoolableConnectionFactory, getAbandonedLogWriter, getAbandonedUsageTracking, getCacheState, getConnection, getConnection, getConnectionInitSqls, getConnectionInitSqlsAsArray, getConnectionPool, getDefaultAutoCommit, getDefaultCatalog, getDefaultQueryTimeout, getDefaultReadOnly, getDefaultTransactionIsolation, getDriver, getDriverClassLoader, getDriverClassName, getEnableAutoCommitOnReturn, getEvictionPolicyClassName, getInitialSize, getJmxName, getLifo, getLogAbandoned, getLoginTimeout, getLogWriter, getMaxConnLifetimeMillis, getMaxIdle, getMaxOpenPreparedStatements, getMaxTotal, getMaxWaitMillis, getMinEvictableIdleTimeMillis, getMinIdle, getNumActive, getNumIdle, getNumTestsPerEvictionRun, getParentLogger, getPassword, getRegisteredJmxName, getRemoveAbandonedOnBorrow, getRemoveAbandonedOnMaintenance, getRemoveAbandonedTimeout, getRollbackOnReturn, getSoftMinEvictableIdleTimeMillis, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, getUrl, getUsername, getValidationQuery, getValidationQueryTimeout, isAccessToUnderlyingConnectionAllowed, isClosed, isPoolPreparedStatements, isWrapperFor, log, postDeregister, postRegister, preDeregister, preRegister, setAbandonedLogWriter, setAbandonedUsageTracking, setAccessToUnderlyingConnectionAllowed, setCacheState, setConnectionInitSqls, setDefaultAutoCommit, setDefaultCatalog, setDefaultQueryTimeout, setDefaultReadOnly, setDefaultTransactionIsolation, setDriver, setDriverClassLoader, setDriverClassName, setEnableAutoCommitOnReturn, setEvictionPolicyClassName, setInitialSize, setJmxName, setLifo, setLogAbandoned, setLoginTimeout, setLogWriter, setMaxConnLifetimeMillis, setMaxIdle, setMaxOpenPreparedStatements, setMaxTotal, setMaxWaitMillis, setMinEvictableIdleTimeMillis, setMinIdle, setNumTestsPerEvictionRun, setPassword, setPoolPreparedStatements, setRemoveAbandonedOnBorrow, setRemoveAbandonedOnMaintenance, setRemoveAbandonedTimeout, setRollbackOnReturn, setSoftMinEvictableIdleTimeMillis, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setUrl, setUsername, setValidationQuery, setValidationQueryTimeout, startPoolMaintenance, unwrap, validateConnectionFactory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface javax.sql.CommonDataSource

    createShardingKeyBuilder

    Methods inherited from interface javax.sql.DataSource

    createConnectionBuilder
  • Constructor Details

  • Method Details

    • addConnectionProperty

      public void addConnectionProperty(String name, String value)
      Overrides:
      addConnectionProperty in class org.apache.commons.dbcp2.BasicDataSource
    • removeConnectionProperty

      public void removeConnectionProperty(String name)
      Overrides:
      removeConnectionProperty in class org.apache.commons.dbcp2.BasicDataSource
    • setConnectionProperties

      public void setConnectionProperties(String connectionProperties)
      Overrides:
      setConnectionProperties in class org.apache.commons.dbcp2.BasicDataSource
    • getConnectionProperties

      public Properties getConnectionProperties()
    • createConnectionFactory

      protected org.apache.commons.dbcp2.ConnectionFactory createConnectionFactory() throws SQLException
      Overrides:
      createConnectionFactory in class org.apache.commons.dbcp2.BasicDataSource
      Throws:
      SQLException