org.apache.cayenne.conf
Class RuntimeLoadDelegate

java.lang.Object
  extended by org.apache.cayenne.conf.RuntimeLoadDelegate
All Implemented Interfaces:
ConfigLoaderDelegate

public class RuntimeLoadDelegate
extends Object
implements ConfigLoaderDelegate

Implementation of ConfigLoaderDelegate that creates Cayenne access objects stack.


Field Summary
protected  Configuration config
           
protected  Map<String,DataDomain> domains
           
protected  MapLoader mapLoader
           
protected  long startTime
           
protected  ConfigStatus status
           
protected  Map<String,String> views
           
 
Constructor Summary
RuntimeLoadDelegate(Configuration config, ConfigStatus status)
           
 
Method Summary
protected  DataNode createDataNode(String nodeName)
          Creates a new DataNode.
protected  DataDomain findDomain(String name)
           
protected  DataMap findMap(String domainName, String mapName)
           
protected  DataNode findNode(String domainName, String nodeName)
           
 void finishedLoading()
          Callback methods invoked at the end of the configuration processing.
 Configuration getConfig()
          Returns the config.
 Map<String,DataDomain> getDomains()
          Returns the domains.
protected  MapLoader getMapLoader()
           
 ConfigStatus getStatus()
          Returns the status.
protected  void initAdapter(DataNode node, String adapterName)
          Intializes DataNode adapter.
protected  DataMap loadDataMap(DataDomain domain, String mapName, Map locations)
          Returns DataMap for the name and location information.
 boolean loadError(Throwable th)
          Gives delegate an opportunity to process the error.
 void setConfig(Configuration config)
          Sets the config.
 void shouldLinkDataMap(String domainName, String nodeName, String mapName)
           
 void shouldLoadDataDomain(String domainName)
          Callback method invoked when a domain is encountered in the configuration file.
 void shouldLoadDataDomainProperties(String domainName, Map<String,String> properties)
           
 void shouldLoadDataMaps(String domainName, Map<String,DataMap> locations)
           
 void shouldLoadDataNode(String domainName, String nodeName, String dataSource, String adapter, String factory, String schemaUpdateStrategy)
           
 void shouldLoadProjectVersion(String version)
          Callback method invoked when a project version is read.
 void shouldRegisterDataView(String name, String location)
          Callback method invoked when a DataView reference is encountered in the configuration file.
 void startedLoading()
          Callback methods invoked in the beginning of the configuration processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domains

protected Map<String,DataDomain> domains

views

protected Map<String,String> views

status

protected ConfigStatus status

config

protected Configuration config

startTime

protected long startTime

mapLoader

protected MapLoader mapLoader
Constructor Detail

RuntimeLoadDelegate

public RuntimeLoadDelegate(Configuration config,
                           ConfigStatus status)
Method Detail

findDomain

protected DataDomain findDomain(String name)
                         throws org.apache.cayenne.conf.RuntimeLoadDelegate.FindException
Throws:
org.apache.cayenne.conf.RuntimeLoadDelegate.FindException

findMap

protected DataMap findMap(String domainName,
                          String mapName)
                   throws org.apache.cayenne.conf.RuntimeLoadDelegate.FindException
Throws:
org.apache.cayenne.conf.RuntimeLoadDelegate.FindException

findNode

protected DataNode findNode(String domainName,
                            String nodeName)
                     throws org.apache.cayenne.conf.RuntimeLoadDelegate.FindException
Throws:
org.apache.cayenne.conf.RuntimeLoadDelegate.FindException

loadError

public boolean loadError(Throwable th)
Description copied from interface: ConfigLoaderDelegate
Gives delegate an opportunity to process the error.

Specified by:
loadError in interface ConfigLoaderDelegate
Returns:
boolean indicating whether ConfigLoader should proceed with further processing. Ultimately it is up to the ConfigLoader to make this decision.

shouldLoadProjectVersion

public void shouldLoadProjectVersion(String version)
Description copied from interface: ConfigLoaderDelegate
Callback method invoked when a project version is read.

Specified by:
shouldLoadProjectVersion in interface ConfigLoaderDelegate
Since:
1.1

shouldRegisterDataView

public void shouldRegisterDataView(String name,
                                   String location)
Description copied from interface: ConfigLoaderDelegate
Callback method invoked when a DataView reference is encountered in the configuration file.

Specified by:
shouldRegisterDataView in interface ConfigLoaderDelegate
Since:
1.1

shouldLoadDataDomainProperties

public void shouldLoadDataDomainProperties(String domainName,
                                           Map<String,String> properties)
Specified by:
shouldLoadDataDomainProperties in interface ConfigLoaderDelegate

shouldLoadDataDomain

public void shouldLoadDataDomain(String domainName)
Description copied from interface: ConfigLoaderDelegate
Callback method invoked when a domain is encountered in the configuration file.

Specified by:
shouldLoadDataDomain in interface ConfigLoaderDelegate
Parameters:
domainName - domain name.

shouldLoadDataMaps

public void shouldLoadDataMaps(String domainName,
                               Map<String,DataMap> locations)
Specified by:
shouldLoadDataMaps in interface ConfigLoaderDelegate

getMapLoader

protected MapLoader getMapLoader()

loadDataMap

protected DataMap loadDataMap(DataDomain domain,
                              String mapName,
                              Map locations)
Returns DataMap for the name and location information. If a DataMap is already loaded within a given domain, such loaded map is returned, otherwise the map is loaded and linked with the DataDomain.


createDataNode

protected DataNode createDataNode(String nodeName)
Creates a new DataNode. Subclasses may override this method to provide a custom node class.

Since:
1.

shouldLoadDataNode

public void shouldLoadDataNode(String domainName,
                               String nodeName,
                               String dataSource,
                               String adapter,
                               String factory,
                               String schemaUpdateStrategy)
Specified by:
shouldLoadDataNode in interface ConfigLoaderDelegate

initAdapter

protected void initAdapter(DataNode node,
                           String adapterName)
Intializes DataNode adapter.

Since:
1.2

shouldLinkDataMap

public void shouldLinkDataMap(String domainName,
                              String nodeName,
                              String mapName)
Specified by:
shouldLinkDataMap in interface ConfigLoaderDelegate

getDomains

public Map<String,DataDomain> getDomains()
Returns the domains.

Returns:
List

getStatus

public ConfigStatus getStatus()
Returns the status.

Specified by:
getStatus in interface ConfigLoaderDelegate
Returns:
ConfigStatus

getConfig

public Configuration getConfig()
Returns the config.

Returns:
Configuration

setConfig

public void setConfig(Configuration config)
Sets the config.

Parameters:
config - The config to set

finishedLoading

public void finishedLoading()
Description copied from interface: ConfigLoaderDelegate
Callback methods invoked at the end of the configuration processing.

Specified by:
finishedLoading in interface ConfigLoaderDelegate
See Also:
ConfigLoaderDelegate.finishedLoading()

startedLoading

public void startedLoading()
Description copied from interface: ConfigLoaderDelegate
Callback methods invoked in the beginning of the configuration processing.

Specified by:
startedLoading in interface ConfigLoaderDelegate


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