Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.configuration.server
Class DelegatingDataSourceFactory

    java.lang.Object
      org.apache.cayenne.configuration.server.DelegatingDataSourceFactory

All Implemented Interfaces:
  DataSourceFactory

    public class DelegatingDataSourceFactory

extends 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

Field Summary
`protected Map<DataSource,ScopeEventBinding>` | `managedDataSources`
`protected AdhocObjectFactory` | `objectFactory`
`protected RuntimeProperties` | `properties`

Constructor Summary
`DelegatingDataSourceFactory()`

Method Summary
`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()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### objectFactory

    protected AdhocObjectFactory objectFactory

### properties

    protected RuntimeProperties properties

### managedDataSources

    protected Map<DataSource,ScopeEventBinding> managedDataSources

Constructor Detail

### DelegatingDataSourceFactory

    public DelegatingDataSourceFactory()

Method Detail

### getDataSource

    public DataSource getDataSource(DataNodeDescriptor nodeDescriptor)
                             throws Exception

  Description copied from interface: `DataSourceFactory`
  Returns DataSource object based on the configuration provided in the "nodeDescriptor".

  Specified by:
    `getDataSource` in interface `DataSourceFactory`
  Throws:
    `Exception`

### shutdown

    @BeforeScopeEnd
    public void shutdown()

### attachToScope

    protected void attachToScope(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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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