Class PoolingDataSourceWrapperImpl

  • All Implemented Interfaces:
    java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource, PoolingDataSourceWrapper

    public final class PoolingDataSourceWrapperImpl
    extends java.lang.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​(java.lang.String uniqueName, java.lang.String dsClassName, java.util.Properties driverProperties)
      This constructor creates a PoolingDataSource using internally BasicManagedDataSource with its default pooling parameters.
      PoolingDataSourceWrapperImpl​(java.lang.String uniqueName, java.lang.String dsClassName, java.util.Properties driverProperties, java.util.Properties poolingProperties)
      This constructor creates a PoolingDataSource using internally BasicManagedDataSource.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the data source; as a result, the data source will stop providing connections and will be unregistered from JNDI context.
      java.lang.String getClassName()  
      java.sql.Connection getConnection()  
      java.sql.Connection getConnection​(java.lang.String username, java.lang.String password)  
      int getLoginTimeout()  
      java.io.PrintWriter getLogWriter()  
      java.util.logging.Logger getParentLogger()  
      java.lang.String getUniqueName()  
      boolean isWrapperFor​(java.lang.Class<?> iface)  
      void setLoginTimeout​(int seconds)  
      void setLogWriter​(java.io.PrintWriter out)  
      <T> T unwrap​(java.lang.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​(java.lang.String uniqueName,
                                            java.lang.String dsClassName,
                                            java.util.Properties driverProperties)
        This constructor creates a PoolingDataSource using internally BasicManagedDataSource with its default pooling parameters.
        Parameters:
        uniqueName - Data Source unique name. Serves for registration to JNDI.
        dsClassName - Name of a class implementing XADataSource available in a JDBC driver on a classpath.
        driverProperties - Properties of a database driver.
      • PoolingDataSourceWrapperImpl

        public PoolingDataSourceWrapperImpl​(java.lang.String uniqueName,
                                            java.lang.String dsClassName,
                                            java.util.Properties driverProperties,
                                            java.util.Properties poolingProperties)
        This constructor creates a PoolingDataSource using internally BasicManagedDataSource.
        Parameters:
        uniqueName - Data Source unique name. Serves for registration to JNDI.
        dsClassName - Name of a class implementing XADataSource available in a JDBC driver on a classpath.
        driverProperties - Properties of a database driver.
        poolingProperties - Properties of a pooling data source. See BasicManagedDataSource for details.
    • Method Detail

      • close

        public void close()
        Description copied from interface: PoolingDataSourceWrapper
        Closes the data source; as a result, the data source will stop providing connections and will be unregistered from JNDI context.
        Specified by:
        close in interface PoolingDataSourceWrapper
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Specified by:
        getConnection in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password)
                                          throws java.sql.SQLException
        Specified by:
        getConnection in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
                                         throws java.sql.SQLException
        Specified by:
        getLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        getLogWriter in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • setLogWriter

        public void setLogWriter​(java.io.PrintWriter out)
                          throws java.sql.SQLException
        Specified by:
        setLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        setLogWriter in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • setLoginTimeout

        public void setLoginTimeout​(int seconds)
                             throws java.sql.SQLException
        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        setLoginTimeout in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • getLoginTimeout

        public int getLoginTimeout()
                            throws java.sql.SQLException
        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        getLoginTimeout in interface javax.sql.DataSource
        Throws:
        java.sql.SQLException
      • getParentLogger

        public java.util.logging.Logger getParentLogger()
                                                 throws java.sql.SQLFeatureNotSupportedException
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLFeatureNotSupportedException