Interface DataSourceFactory

All Known Implementing Classes:
JndiDataSourceFactory, SharedPoolDataSourceFactory

public interface DataSourceFactory
A factory that returns a DataSource. Borrowed from Apache DB Torque
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Key for the configuration which contains DataSourceFactories
    static final String
    Key for the configuration which contains the fully qualified name of the factory implementation class
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    A hook which is called when the resources of the associated DataSource can be released.
     
     
    void
    Initialize the factory.
  • Field Details

  • Method Details

    • getName

      Returns:
      the name of the factory.
    • getDataSource

      Returns:
      the DataSource configured by the factory.
      Throws:
      SQLException - if the source can't be returned
    • initialize

      Initialize the factory.
      Parameters:
      config - the factory settings
      Throws:
      SQLException - Any exceptions caught during processing will be rethrown wrapped into a SQLException.
    • close

      void close() throws SQLException
      A hook which is called when the resources of the associated DataSource can be released. After close() is called, the other methods may not work any more (e.g. getDataSource() might return null). It is not guaranteed that this method does anything. For example, we do not want to close connections retrieved via JNDI, so the JndiDataSouurceFactory does not close these connections
      Throws:
      SQLException - Any exceptions caught during processing will be rethrown wrapped into a SQLException.