org.apache.cayenne.configuration.server
Class DefaultDataSourceFactoryLoader
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
objectFactory
protected AdhocObjectFactory objectFactory
DefaultDataSourceFactoryLoader
public DefaultDataSourceFactoryLoader()
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.