public class BasicDataSourceExt
extends org.apache.commons.dbcp2.BasicDataSource
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 and Description |
|---|
BasicDataSourceExt(MetadataStorageConnectorConfig connectorConfig) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionProperty(String name,
String value) |
protected org.apache.commons.dbcp2.ConnectionFactory |
createConnectionFactory() |
Properties |
getConnectionProperties() |
void |
removeConnectionProperty(String name) |
void |
setConnectionProperties(String connectionProperties) |
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, validateConnectionFactorypublic BasicDataSourceExt(MetadataStorageConnectorConfig connectorConfig)
public void addConnectionProperty(String name, String value)
addConnectionProperty in class org.apache.commons.dbcp2.BasicDataSourcepublic void removeConnectionProperty(String name)
removeConnectionProperty in class org.apache.commons.dbcp2.BasicDataSourcepublic void setConnectionProperties(String connectionProperties)
setConnectionProperties in class org.apache.commons.dbcp2.BasicDataSourcepublic Properties getConnectionProperties()
protected org.apache.commons.dbcp2.ConnectionFactory createConnectionFactory()
throws SQLException
createConnectionFactory in class org.apache.commons.dbcp2.BasicDataSourceSQLExceptionCopyright © 2011–2021 The Apache Software Foundation. All rights reserved.