org.apache.cayenne.configuration.server
Class DefaultDataSourceFactoryLoader

java.lang.Object
  extended by org.apache.cayenne.configuration.server.DefaultDataSourceFactoryLoader
All Implemented Interfaces:
DataSourceFactoryLoader

public class DefaultDataSourceFactoryLoader
extends Object
implements DataSourceFactoryLoader

A DataSourceFactoryLoader that loads factories explicitly configured in the DataNodeDescriptor. If the factory class is not explicitly configured, and the descriptor has a configuration resource attached to it, XMLPoolingDataSourceFactory is returned.

If the environment contains properties cayenne.jdbc.url.domain_name.node_name (or cayenne.jdbc.url) and cayenne.jdbc.driver.domain_name.node_name (or cayenne.jdbc.driver), any DataSourceFactory configured in the project is ignored, and the PropertyDataSourceFactory is returned.

Since:
3.1

Field Summary
protected  AdhocObjectFactory objectFactory
           
 
Constructor Summary
DefaultDataSourceFactoryLoader()
           
 
Method Summary
 DataSourceFactory getDataSourceFactory(DataNodeDescriptor nodeDescriptor)
          Returns a DataSourceFactory for a given DataNodeDescriptor configuration object.
protected  String getProperty(String key)
          Returns a property value for a given full key.
protected  boolean shouldConfigureDataSourceFromProperties(DataNodeDescriptor nodeDescriptor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectFactory

protected AdhocObjectFactory objectFactory
Constructor Detail

DefaultDataSourceFactoryLoader

public DefaultDataSourceFactoryLoader()
Method Detail

getDataSourceFactory

public DataSourceFactory getDataSourceFactory(DataNodeDescriptor nodeDescriptor)
Description copied from interface: DataSourceFactoryLoader
Returns a DataSourceFactory for a given DataNodeDescriptor configuration object. The factory should be specified in the node descriptor explicitly by the user. Cayenne will inject dependencies in all user-provided factories.

Specified by:
getDataSourceFactory in interface DataSourceFactoryLoader

shouldConfigureDataSourceFromProperties

protected boolean shouldConfigureDataSourceFromProperties(DataNodeDescriptor nodeDescriptor)

getProperty

protected String getProperty(String key)
Returns a property value for a given full key. This implementation returns a System property. Subclasses may lookup properties elsewhere. E.g. overriding this method can help with unit testing this class.



Copyright © 2001-2010 Apache Cayenne. All Rights Reserved.