Interface DataSourceWrapper


  • public interface DataSourceWrapper
    Means to obtain the DataSource being wrapped.
    Author:
    Daniel Sagenschneider
    • Method Detail

      • isGetRealDataSourceMethod

        static boolean isGetRealDataSourceMethod​(java.lang.reflect.Method method)
        Indicates if Method is the getRealDataSource().
        Parameters:
        method - Method.
        Returns:
        true if getRealDataSource().
      • getRealDataSource

        static javax.sql.DataSource getRealDataSource​(javax.sql.DataSource dataSource)
                                               throws java.sql.SQLException
        Obtains the "real" DataSource from the input DataSource.
        Parameters:
        dataSource - DataSource to inspect for the "real" DataSource.
        Returns:
        The "real" DataSource.
        Throws:
        java.sql.SQLException - If fails to obtain the "real" DataSource.
      • getRealDataSource

        javax.sql.DataSource getRealDataSource()
                                        throws java.sql.SQLException

        Allows obtaining the actual DataSource.

        Some implementations may Proxy the DataSource. Therefore, in inspecting the DataSource on closing OfficeFloor, it will incorrectly determine if the DataSource is AutoCloseable.

        This enables obtaining the "real" DataSource.

        Returns:
        The "real" DataSource. In some implementations it may actually be null as no "real" backing DataSource is available.
        Throws:
        java.sql.SQLException - If fails to obtain the "real" DataSource.