org.apache.cayenne.conf
Class DefaultConfiguration

java.lang.Object
  extended by org.apache.cayenne.conf.Configuration
      extended by org.apache.cayenne.conf.DefaultConfiguration
Direct Known Subclasses:
FileConfiguration

public class DefaultConfiguration
extends Configuration

Subclass of Configuration that uses the System CLASSPATH to locate resources.


Field Summary
protected  ResourceLocator locator
           
 
Fields inherited from class org.apache.cayenne.conf.Configuration
configurationShutdownHook, dataDomains, dataViewLocations, DEFAULT_CONFIGURATION_CLASS, DEFAULT_DOMAIN_FILE, domainConfigurationName, eventManager, ignoringLoadFailures, loaderDelegate, loadStatus, overrideFactory, overrideStrategy, projectVersion, saverDelegate, sharedConfiguration
 
Constructor Summary
DefaultConfiguration()
          Default constructor.
DefaultConfiguration(String domainConfigurationName)
          Constructor with a named domain configuration resource.
DefaultConfiguration(String domainConfigurationName, ResourceLocator locator)
          Creates DefaultConfiguration with specified cayenne project file name and ResourceLocator.
 
Method Summary
 void addClassPath(String customPath)
          Adds a custom path for class path lookups.
 void addResourcePath(String path)
          Adds the given String as a custom path for resource lookups.
protected  InputStream getDomainConfiguration()
          Returns a DataDomain as a stream or null if it cannot be found.
protected  ResourceFinder getResourceFinder()
          Returns ResourceFinder associated with this Configuration that is to be used for config files lookup.
protected  ResourceLocator getResourceLocator()
          Deprecated. since 3.0 as super is deprecated.
 void initialize()
          Initializes all Cayenne resources.
protected  void setResourceLocator(ResourceLocator locator)
          Sets the specified ResourceLocator.
 String toString()
           
 
Methods inherited from class org.apache.cayenne.conf.Configuration
addDomain, canInitialize, didInitialize, getDataSourceFactory, getDataSourceFactory, getDataViewLocations, getDomain, getDomain, getDomainConfigurationName, getDomains, getEventManager, getLoaderDelegate, getLoadStatus, getMapConfiguration, getProjectVersion, getSaverDelegate, getSchemaUpdateStrategy, getSharedConfiguration, getViewConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, installConfigurationShutdownHook, isIgnoringLoadFailures, removeDomain, setDataSourceFactory, setDataViewLocations, setDomainConfigurationName, setEventManager, setIgnoringLoadFailures, setLoaderDelegate, setLoadStatus, setProjectVersion, setSaverDelegate, setSchemaUpdateStrategy, shutdown, uninstallConfigurationShutdownHook
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

locator

protected ResourceLocator locator
Constructor Detail

DefaultConfiguration

public DefaultConfiguration()
Default constructor. Simply calls DefaultConfiguration(String) with Configuration.DEFAULT_DOMAIN_FILE as argument.


DefaultConfiguration

public DefaultConfiguration(String domainConfigurationName)
Constructor with a named domain configuration resource. Simply calls Configuration.Configuration(String).

Throws:
ConfigurationException - when domainConfigurationName is null.
See Also:
Configuration.Configuration(String)

DefaultConfiguration

public DefaultConfiguration(String domainConfigurationName,
                            ResourceLocator locator)
Creates DefaultConfiguration with specified cayenne project file name and ResourceLocator.

Since:
1.2
Method Detail

addClassPath

public void addClassPath(String customPath)
Adds a custom path for class path lookups. Format should be "my/package/name" without leading "/". This allows for easy customization of custom search paths after Constructor invocation:
 conf = new DefaultConfiguration();
 conf.addClassPath("my/package/name");
 Configuration.initializeSharedConfiguration(conf);
 


addResourcePath

public void addResourcePath(String path)
Adds the given String as a custom path for resource lookups. The path can be relative or absolute and is not checked for existence. Depending on the underlying ResourceLocator configuration this can for instance be a path in the web application context or a filesystem path.

Throws:
IllegalArgumentException - if path is null.
Since:
1.2 moved from subclass - FileConfiguration.

getDomainConfiguration

protected InputStream getDomainConfiguration()
Description copied from class: Configuration
Returns a DataDomain as a stream or null if it cannot be found.

Overrides:
getDomainConfiguration in class Configuration

initialize

public void initialize()
                throws Exception
Initializes all Cayenne resources. Loads all configured domains and their data maps, initializes all domain Nodes and their DataSources.

Specified by:
initialize in class Configuration
Throws:
Exception

getResourceLocator

protected ResourceLocator getResourceLocator()
Deprecated. since 3.0 as super is deprecated.

Returns the default ResourceLocator configured for CLASSPATH lookups.

Overrides:
getResourceLocator in class Configuration

getResourceFinder

protected ResourceFinder getResourceFinder()
Description copied from class: Configuration
Returns ResourceFinder associated with this Configuration that is to be used for config files lookup.

Specified by:
getResourceFinder in class Configuration
Since:
3.0

setResourceLocator

protected void setResourceLocator(ResourceLocator locator)
Sets the specified ResourceLocator. Currently called from initialize().


toString

public String toString()
Overrides:
toString in class Object


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