public abstract class AbstractDataSourceFactory extends Object implements DataSourceFactory
| Modifier and Type | Field and Description |
|---|---|
static String |
CONNECTION_KEY
"connection" Key for the configuration
|
static String |
DEFAULT_CONNECTION_KEY
"defaults.connection" Key for the configuration
|
static String |
DEFAULT_POOL_KEY
"defaults.pool" Key for the configuration
|
static String |
DEFAULTS_KEY
"defaults" Key for the configuration
|
static String |
POOL_KEY
"pool" Key for the configuration
|
DSFACTORY_KEY, FACTORY_KEY| Constructor and Description |
|---|
AbstractDataSourceFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyConfiguration(org.apache.commons.configuration2.Configuration c,
Object o)
Iterate over a Configuration subset and apply all
properties to a passed object which must contain Bean
setter and getter
|
abstract DataSource |
getDataSource() |
protected void |
initCPDS(org.apache.commons.configuration2.Configuration configuration,
ConnectionPoolDataSource cpds)
Initializes the ConnectionPoolDataSource.
|
abstract void |
initialize(org.apache.commons.configuration2.Configuration configuration)
Initialize the factory.
|
protected void |
initJdbc2Pool(DataSource dataSource,
org.apache.commons.configuration2.Configuration configuration)
Initializes the Jdbc2PoolDataSource.
|
protected void |
setProperty(String property,
org.apache.commons.configuration2.Configuration c,
Object ds)
Encapsulates setting configuration properties on
DataSource objects. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final String POOL_KEY
public static final String CONNECTION_KEY
public static final String DEFAULTS_KEY
public static final String DEFAULT_POOL_KEY
public static final String DEFAULT_CONNECTION_KEY
protected void setProperty(String property, org.apache.commons.configuration2.Configuration c, Object ds) throws Exception
DataSource objects.property - the property to read from the configurationc - the configuration to read the property fromds - the DataSource instance to write the property toException - if anything goes wrongprotected void applyConfiguration(org.apache.commons.configuration2.Configuration c,
Object o)
throws TorqueException
c - The configuration subseto - The object to apply the properties toTorqueException - if a property set failsprotected void initCPDS(org.apache.commons.configuration2.Configuration configuration,
ConnectionPoolDataSource cpds)
throws TorqueException
configuration - where to read the settings fromcpds - data source to configureTorqueException - if a property set failsprotected void initJdbc2Pool(DataSource dataSource, org.apache.commons.configuration2.Configuration configuration) throws TorqueException
dataSource - the dataSource to initialize, not null.configuration - where to read the settings from, not null.TorqueException - if a property set fails.public abstract DataSource getDataSource() throws TorqueException
getDataSource in interface DataSourceFactoryDataSource configured by the factory.TorqueException - if the source can't be returnedpublic abstract void initialize(org.apache.commons.configuration2.Configuration configuration)
throws TorqueException
initialize in interface DataSourceFactoryconfiguration - where to load the factory settings fromTorqueException - Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.