org.apache.torque.dsfactory
Class AbstractDataSourceFactory

java.lang.Object
  extended byorg.apache.torque.dsfactory.AbstractDataSourceFactory
Direct Known Subclasses:
JndiDataSourceFactory, PerUserPoolDataSourceFactory, SharedPoolDataSourceFactory, TorqueDataSourceFactory

public abstract class AbstractDataSourceFactory
extends java.lang.Object

A class that contains common functionality of the factories in this package.

Version:
$Id: AbstractDataSourceFactory.java,v 1.12 2003/08/19 18:30:34 mpoeschl Exp $
Author:
John McNally, Henning P. Schmiedehausen

Field Summary
static java.lang.String CONNECTION_KEY
          "connection" Key for the configuration
static java.lang.String DEFAULT_CONNECTION_KEY
          "default.connection" Key for the configuration
static java.lang.String DEFAULT_POOL_KEY
          "default.pool" Key for the configuration
private static org.apache.commons.logging.Log log
          The log
static java.lang.String POOL_KEY
          "pool" Key for the configuration
 
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
protected  javax.sql.ConnectionPoolDataSource initCPDS(org.apache.commons.configuration.Configuration configuration)
          Initializes the ConnectionPoolDataSource.
protected  void setProperty(java.lang.String property, org.apache.commons.configuration.Configuration c, java.lang.Object ds)
          Encapsulates setting configuration properties on DataSource objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POOL_KEY

public static final java.lang.String POOL_KEY
"pool" Key for the configuration

See Also:
Constant Field Values

CONNECTION_KEY

public static final java.lang.String CONNECTION_KEY
"connection" Key for the configuration

See Also:
Constant Field Values

DEFAULT_POOL_KEY

public static final java.lang.String DEFAULT_POOL_KEY
"default.pool" Key for the configuration

See Also:
Constant Field Values

DEFAULT_CONNECTION_KEY

public static final java.lang.String DEFAULT_CONNECTION_KEY
"default.connection" Key for the configuration

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
The log

Constructor Detail

AbstractDataSourceFactory

public AbstractDataSourceFactory()
Method Detail

setProperty

protected void setProperty(java.lang.String property,
                           org.apache.commons.configuration.Configuration c,
                           java.lang.Object ds)
                    throws java.lang.Exception
Encapsulates setting configuration properties on DataSource objects.

Parameters:
property - the property to read from the configuration
c - the configuration to read the property from
ds - the DataSource instance to write the property to
Throws:
java.lang.Exception - if anything goes wrong

applyConfiguration

protected void applyConfiguration(org.apache.commons.configuration.Configuration c,
                                  java.lang.Object o)
                           throws TorqueException
Iterate over a Configuration subset and apply all properties to a passed object which must contain Bean setter and getter

Parameters:
c - The configuration subset
o - The object to apply the properties to
Throws:
TorqueException - if a property set fails

initCPDS

protected javax.sql.ConnectionPoolDataSource initCPDS(org.apache.commons.configuration.Configuration configuration)
                                               throws TorqueException
Initializes the ConnectionPoolDataSource.

Parameters:
configuration - where to read the settings from
Returns:
a configured ConnectionPoolDataSource
Throws:
TorqueException - if a property set fails


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.