Package org.apache.torque.dsfactory
Interface DataSourceFactory
- All Known Implementing Classes:
AbstractDataSourceFactory,JndiDataSourceFactory,PerUserPool2DataSourceFactory,SharedPool2DataSourceFactory
public interface DataSourceFactory
A factory that returns a DataSource.
- Version:
- $Id: DataSourceFactory.java 1867515 2019-09-25 15:02:03Z gk $
- Author:
- John McNally, Thomas Fischer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()A hook which is called when the resources of the associated DataSource can be released.voidinitialize(org.apache.commons.configuration2.Configuration configuration) 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
-
getDataSource
- Returns:
- the
DataSourceconfigured by the factory. - Throws:
TorqueException- if the source can't be returned
-
initialize
void initialize(org.apache.commons.configuration2.Configuration configuration) throws TorqueException Initialize the factory.- Parameters:
configuration- where to load the factory settings from- Throws:
TorqueException- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
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:
TorqueException- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-