Interface DataSourcePool


  • public interface DataSourcePool
    Combines multiple DataSourcePoolProvider services into a single service that gives access to preconfigured data sources.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Collection<java.lang.String> getAllJndiDataSourceNames()
      Return the collection of all JNDI data sources available with the system.
      java.lang.Object getDataSource​(java.lang.String name)
      Return the named data source, if available, as an Object.
      <AdapterType>
      AdapterType
      getDataSource​(java.lang.String name, java.lang.Class<AdapterType> desiredType)
      Return the named data source, if available
    • Method Detail

      • getDataSource

        <AdapterType> AdapterType getDataSource​(java.lang.String name,
                                                java.lang.Class<AdapterType> desiredType)
                                         throws DataSourceNotFoundException,
                                                TypeNotAvailableException
        Return the named data source, if available
        Parameters:
        name - Configured name of the data source
        desiredType - , expected type (for example DataSource.class for a j2ee DataSource).
        Returns:
        a data source object of the desired type, which must be properly closed or disposed of to be returned to the pool, according to the semantics of that data source type.
        Throws:
        DataSourceNotFoundException - no data source found with supplied name.
        TypeNotAvailableException - data source found but not compatible with desired type
      • getDataSource

        java.lang.Object getDataSource​(java.lang.String name)
                                throws DataSourceNotFoundException
        Return the named data source, if available, as an Object. Useful in scripting languages where the actual type is checked by the language, for other cases it is recommended to use the getDataSource method.
        Parameters:
        name - name of the data source
        Returns:
        the datasource
        Throws:
        DataSourceNotFoundException - if the data source is not found
      • getAllJndiDataSourceNames

        java.util.Collection<java.lang.String> getAllJndiDataSourceNames()
        Return the collection of all JNDI data sources available with the system. Useful for tooling which wants to show all datasources in the system
        Returns:
        Collection of all JNDI Data Sources that are register with this Pool