Package org.kie.test.util.db.internal
Class PoolingDataSourceWrapperImpl
- java.lang.Object
-
- org.kie.test.util.db.internal.PoolingDataSourceWrapperImpl
-
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource,PoolingDataSourceWrapper
public final class PoolingDataSourceWrapperImpl extends Object implements PoolingDataSourceWrapper
Wrapper for actual Pooling Data Source provided by tomcat DBCP library. This class offers data source with XA transactions and connection pooling capabilities.
-
-
Constructor Summary
Constructors Constructor Description PoolingDataSourceWrapperImpl(String uniqueName, String dsClassName, Properties driverProperties)This constructor creates a PoolingDataSource using internallyBasicManagedDataSourcewith its default pooling parameters.PoolingDataSourceWrapperImpl(String uniqueName, String dsClassName, Properties driverProperties, Properties poolingProperties)This constructor creates a PoolingDataSource using internallyBasicManagedDataSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the data source; as a result, the data source will stop providing connections and will be unregistered from JNDI context.StringgetClassName()ConnectiongetConnection()ConnectiongetConnection(String username, String password)intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()StringgetUniqueName()booleanisWrapperFor(Class<?> iface)voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)<T> Tunwrap(Class<T> iface)-
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 Detail
-
PoolingDataSourceWrapperImpl
public PoolingDataSourceWrapperImpl(String uniqueName, String dsClassName, Properties driverProperties)
This constructor creates a PoolingDataSource using internallyBasicManagedDataSourcewith its default pooling parameters.- Parameters:
uniqueName- Data Source unique name. Serves for registration to JNDI.dsClassName- Name of a class implementingXADataSourceavailable in a JDBC driver on a classpath.driverProperties- Properties of a database driver.
-
PoolingDataSourceWrapperImpl
public PoolingDataSourceWrapperImpl(String uniqueName, String dsClassName, Properties driverProperties, Properties poolingProperties)
This constructor creates a PoolingDataSource using internallyBasicManagedDataSource.- Parameters:
uniqueName- Data Source unique name. Serves for registration to JNDI.dsClassName- Name of a class implementingXADataSourceavailable in a JDBC driver on a classpath.driverProperties- Properties of a database driver.poolingProperties- Properties of a pooling data source. SeeBasicManagedDataSourcefor details.
-
-
Method Detail
-
close
public void close()
Description copied from interface:PoolingDataSourceWrapperCloses the data source; as a result, the data source will stop providing connections and will be unregistered from JNDI context.- Specified by:
closein interfacePoolingDataSourceWrapper
-
getUniqueName
public String getUniqueName()
- Specified by:
getUniqueNamein interfacePoolingDataSourceWrapper- Returns:
- the data source JNDI name
-
getClassName
public String getClassName()
- Specified by:
getClassNamein interfacePoolingDataSourceWrapper- Returns:
- name of underlying XADataSource class
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
-