org.apache.cayenne.configuration.server
Class DelegatingDataSourceFactory
java.lang.Object
org.apache.cayenne.configuration.server.DelegatingDataSourceFactory
- All Implemented Interfaces:
- DataSourceFactory
public class DelegatingDataSourceFactory
- extends java.lang.Object
- implements DataSourceFactory
A DataSourceFactory
that delegates DataSource creation to another factory,
which is determined dynamically per DataNodeDescriptor. The delegate class may be
explicitly defined in the DataNodeDescriptor
. If not, and if the descriptor has
a configuration resource attached to it, XMLPoolingDataSourceFactory
is used.
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
DataNodeDescriptor is ignored, and the PropertyDataSourceFactory
is used.
- 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
properties
protected RuntimeProperties properties
managedDataSources
protected java.util.Map<javax.sql.DataSource,ScopeEventListener> managedDataSources
DelegatingDataSourceFactory
public DelegatingDataSourceFactory()
getDataSource
public javax.sql.DataSource getDataSource(DataNodeDescriptor nodeDescriptor)
throws java.lang.Exception
- Description copied from interface:
DataSourceFactory
- Returns DataSource object based on the configuration provided in the
"nodeDescriptor".
- Specified by:
getDataSource
in interface DataSourceFactory
- Throws:
java.lang.Exception
shutdown
@BeforeScopeEnd
public void shutdown()
attachToScope
protected void attachToScope(javax.sql.DataSource dataSource)
- Ensure that DataSource implementations returned from this factory receive
BeforeScopeEnd
events.
getDataSourceFactory
protected DataSourceFactory getDataSourceFactory(DataNodeDescriptor nodeDescriptor)
shouldConfigureDataSourceFromProperties
protected boolean shouldConfigureDataSourceFromProperties(DataNodeDescriptor nodeDescriptor)
Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.