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.access
Class DataNode

    java.lang.Object
      org.apache.cayenne.access.DataNode

All Implemented Interfaces:
  QueryEngine

    public class DataNode

extends Object
implements QueryEngine

An abstraction of a single physical data storage. This is usually a database server, but can potentially be some other storage type like an LDAP server, etc.

Author:
  Andrus Adamchik

Field Summary
`protected DbAdapter` | `adapter`
`protected Map<String,DataMap>` | `dataMaps`
`protected DataSource` | `dataSource`
`protected String` | `dataSourceFactory`
`protected String` | `dataSourceLocation`
`protected EntityResolver` | `entityResolver`
`protected EntitySorter` | `entitySorter`
`protected String` | `name`

Constructor Summary
`DataNode()` Creates a new unnamed DataNode.
`DataNode(String name)` Creates a new DataNode, assigning it a name.

Method Summary
`void` | `addDataMap(DataMap map)` Adds a DataMap to be handled by this node.
`DbAdapter` | `getAdapter()` Returns DbAdapter object.
`Collection<DataMap>` | `getDataMaps()` Returns an unmodifiable collection of DataMaps handled by this DataNode.
`DataSource` | `getDataSource()` Returns DataSource used by this DataNode to obtain connections.
`String` | `getDataSourceFactory()` Returns a name of DataSourceFactory class for this node.
`String` | `getDataSourceLocation()` Returns a location of DataSource of this node.
`EntityResolver` | `getEntityResolver()` Returns EntityResolver that handles DataMaps of this node.
`EntitySorter` | `getEntitySorter()` Returns EntitySorter used by the DataNode.
`String` | `getName()` Returns node name.
`DataNode` | `lookupDataNode(DataMap dataMap)` Returns a DataNode that should hanlde queries for all DataMap components.
`void` | `performQueries(Collection<Query> queries, OperationObserver callback)` Runs queries using Connection obtained from internal DataSource.
`void` | `removeDataMap(String mapName)`
`void` | `setAdapter(DbAdapter adapter)`
`void` | `setDataMaps(Collection<DataMap> dataMaps)`
`void` | `setDataSource(DataSource dataSource)`
`void` | `setDataSourceFactory(String dataSourceFactory)`
`void` | `setDataSourceLocation(String dataSourceLocation)`
`void` | `setEntityResolver(EntityResolver entityResolver)` Sets EntityResolver.
`void` | `setEntitySorter(EntitySorter entitySorter)` Sets an EntitySorter that is used to order objects on commit.
`void` | `setName(String name)`
`void` | `shutdown()` Tries to close JDBC connections opened by this node's data source.

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

Field Detail

### name

    protected String name

### dataSource

    protected DataSource dataSource

### adapter

    protected DbAdapter adapter

### dataSourceLocation

    protected String dataSourceLocation

### dataSourceFactory

    protected String dataSourceFactory

### entityResolver

    protected EntityResolver entityResolver

### entitySorter

    protected EntitySorter entitySorter

### dataMaps

    protected Map<String,DataMap> dataMaps

Constructor Detail

### DataNode

    public DataNode()

  Creates a new unnamed DataNode.

### DataNode

    public DataNode(String name)

  Creates a new DataNode, assigning it a name.

Method Detail

### getName

    public String getName()

  Returns node name. Name is used to uniquely identify DataNode within a DataDomain.

### setName

    public void setName(String name)

### getDataSourceLocation

    public String getDataSourceLocation()

  Returns a location of DataSource of this node. Depending on how this node was created, location is either a JNDI name, or a location of node XML file, etc.

### setDataSourceLocation

    public void setDataSourceLocation(String dataSourceLocation)

### getDataSourceFactory

    public String getDataSourceFactory()

  Returns a name of DataSourceFactory class for this node.

### setDataSourceFactory

    public void setDataSourceFactory(String dataSourceFactory)

### getDataMaps

    public Collection<DataMap> getDataMaps()

  Returns an unmodifiable collection of DataMaps handled by this DataNode.

### setDataMaps

    public void setDataMaps(Collection<DataMap> dataMaps)

### addDataMap

    public void addDataMap(DataMap map)

  Adds a DataMap to be handled by this node.

### removeDataMap

    public void removeDataMap(String mapName)

### getDataSource

    public DataSource getDataSource()

  Returns DataSource used by this DataNode to obtain connections.

### setDataSource

    public void setDataSource(DataSource dataSource)

### getAdapter

    public DbAdapter getAdapter()

  Returns DbAdapter object. This is a plugin that handles RDBMS vendor-specific features.

### setAdapter

    public void setAdapter(DbAdapter adapter)

### lookupDataNode

    public DataNode lookupDataNode(DataMap dataMap)

  Returns a DataNode that should hanlde queries for all DataMap components.

  Since:
    1.1

### performQueries

    public void performQueries(Collection<Query> queries,
                               OperationObserver callback)

  Runs queries using Connection obtained from internal DataSource.

  Specified by:
    `performQueries` in interface `QueryEngine`
  Since:
    1.1

### getEntityResolver

    public EntityResolver getEntityResolver()

  Returns EntityResolver that handles DataMaps of this node.

  Specified by:
    `getEntityResolver` in interface `QueryEngine`

### setEntityResolver

    public void setEntityResolver(EntityResolver entityResolver)

  Sets EntityResolver. DataNode relies on externally set EntityResolver, so if the node is created outside of DataDomain stack, a valid EntityResolver must be provided explicitly.

  Since:
    1.1

### getEntitySorter

    public EntitySorter getEntitySorter()

  Returns EntitySorter used by the DataNode.

### setEntitySorter

    public void setEntitySorter(EntitySorter entitySorter)

  Sets an EntitySorter that is used to order objects on commit.

  Since:
    1.2

### shutdown

    public void shutdown()

  Tries to close JDBC connections opened by this node's data source.

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-2008 Apache Cayenne. All Rights Reserved.