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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
A hook which is called when the resources of the associated DataSource can be released.getName()
void
initialize
(JDBCDiskCacheAttributes config) Initialize the factory.
-
Field Details
-
DSFACTORY_KEY
Key for the configuration which contains DataSourceFactories- See Also:
-
FACTORY_KEY
Key for the configuration which contains the fully qualified name of the factory implementation class- See Also:
-
-
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
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.
-