public class DelegatingDataSourceFactory extends Object implements DataSourceFactory
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.
| Modifier and Type | Field and Description |
|---|---|
protected Map<DataSource,ScopeEventListener> |
managedDataSources |
protected AdhocObjectFactory |
objectFactory |
protected RuntimeProperties |
properties |
| Constructor and Description |
|---|
DelegatingDataSourceFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachToScope(DataSource dataSource)
Ensure that DataSource implementations returned from this factory receive
BeforeScopeEnd events. |
DataSource |
getDataSource(DataNodeDescriptor nodeDescriptor)
Returns DataSource object based on the configuration provided in the
"nodeDescriptor".
|
protected DataSourceFactory |
getDataSourceFactory(DataNodeDescriptor nodeDescriptor) |
protected boolean |
shouldConfigureDataSourceFromProperties(DataNodeDescriptor nodeDescriptor) |
void |
shutdown() |
protected AdhocObjectFactory objectFactory
protected RuntimeProperties properties
protected Map<DataSource,ScopeEventListener> managedDataSources
public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception
DataSourceFactorygetDataSource in interface DataSourceFactoryException@BeforeScopeEnd public void shutdown()
protected void attachToScope(DataSource dataSource)
BeforeScopeEnd events.protected DataSourceFactory getDataSourceFactory(DataNodeDescriptor nodeDescriptor)
protected boolean shouldConfigureDataSourceFromProperties(DataNodeDescriptor nodeDescriptor)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.