|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.dsfactory.AbstractDataSourceFactory
public abstract class AbstractDataSourceFactory
A class that contains common functionality of the factories in this package.
Field Summary | |
---|---|
static java.lang.String |
CONNECTION_KEY
"connection" Key for the configuration |
static java.lang.String |
DEFAULT_CONNECTION_KEY
"defaults.connection" Key for the configuration |
static java.lang.String |
DEFAULT_POOL_KEY
"defaults.pool" Key for the configuration |
static java.lang.String |
DEFAULT_SCHEMA_KEY
default schema name for the configuration |
static java.lang.String |
DEFAULTS_KEY
"defaults" Key for the configuration |
static java.lang.String |
POOL_KEY
"pool" Key for the configuration |
static java.lang.String |
SCHEMA_KEY
"schema" Key for the configuration |
Fields inherited from interface org.apache.torque.dsfactory.DataSourceFactory |
---|
DSFACTORY_KEY, FACTORY_KEY |
Constructor Summary | |
---|---|
AbstractDataSourceFactory()
|
Method Summary | |
---|---|
protected void |
applyConfiguration(org.apache.commons.configuration.Configuration c,
java.lang.Object o)
Iterate over a Configuration subset and apply all properties to a passed object which must contain Bean setter and getter |
abstract javax.sql.DataSource |
getDataSource()
|
java.lang.String |
getSchema()
Deprecated. use DatabaseInfo.setSchema() instead. Will be removed in a future version of Torque. |
protected javax.sql.ConnectionPoolDataSource |
initCPDS(org.apache.commons.configuration.Configuration configuration)
Initializes the ConnectionPoolDataSource. |
void |
initialize(org.apache.commons.configuration.Configuration configuration)
Initialize the factory. |
protected void |
setProperty(java.lang.String property,
org.apache.commons.configuration.Configuration c,
java.lang.Object ds)
Encapsulates setting configuration properties on DataSource objects. |
void |
setSchema(java.lang.String schema)
Sets the current schema for the database connection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.torque.dsfactory.DataSourceFactory |
---|
close |
Field Detail |
---|
public static final java.lang.String POOL_KEY
public static final java.lang.String CONNECTION_KEY
public static final java.lang.String SCHEMA_KEY
public static final java.lang.String DEFAULTS_KEY
public static final java.lang.String DEFAULT_POOL_KEY
public static final java.lang.String DEFAULT_CONNECTION_KEY
public static final java.lang.String DEFAULT_SCHEMA_KEY
Constructor Detail |
---|
public AbstractDataSourceFactory()
Method Detail |
---|
protected void setProperty(java.lang.String property, org.apache.commons.configuration.Configuration c, java.lang.Object ds) throws java.lang.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 to
java.lang.Exception
- if anything goes wrongprotected void applyConfiguration(org.apache.commons.configuration.Configuration c, java.lang.Object o) throws TorqueException
c
- The configuration subseto
- The object to apply the properties to
TorqueException
- if a property set failsprotected javax.sql.ConnectionPoolDataSource initCPDS(org.apache.commons.configuration.Configuration configuration) throws TorqueException
configuration
- where to read the settings from
ConnectionPoolDataSource
TorqueException
- if a property set failspublic void setSchema(java.lang.String schema)
setSchema
in interface DataSourceFactory
schema
- The current schema namepublic java.lang.String getSchema()
getSchema
in interface DataSourceFactory
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public abstract javax.sql.DataSource getDataSource() throws TorqueException
getDataSource
in interface DataSourceFactory
DataSource
configured by the factory.
TorqueException
- if the source can't be returnedpublic void initialize(org.apache.commons.configuration.Configuration configuration) throws TorqueException
initialize
in interface DataSourceFactory
configuration
- where to load the factory settings from
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |