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.conf
Class DefaultConfiguration

    java.lang.Object
      org.apache.cayenne.conf.Configuration
          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.

Author:
  Andrus Adamchik

Field Summary

Fields inherited from class org.apache.cayenne.conf.Configuration
`configurationShutdownHook, dataDomains, dataViewLocations, DEFAULT_CONFIGURATION_CLASS, DEFAULT_DOMAIN_FILE, domainConfigurationName, eventManager, ignoringLoadFailures, loaderDelegate, loadStatus, overrideFactory, 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.
`boolean` | `canInitialize()` Default implementation of `Configuration.canInitialize()`.
`void` | `didInitialize()` Default implementation of `Configuration.didInitialize()`.
`protected InputStream` | `getDomainConfiguration()` Returns the domain configuration as a stream or `null` if it cannot be found.
`protected InputStream` | `getMapConfiguration(String location)` Returns the `DataMap` configuration from a specified location or `null` if it cannot be found.
`protected ResourceLocator` | `getResourceLocator()` Returns the default ResourceLocator configured for CLASSPATH lookups.
`protected InputStream` | `getViewConfiguration(String location)` See 'https://svn.apache.org/repos/asf/cayenne/dataviews/trunk' for DataViews code, which is not a part of Cayenne since 3.0.
`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, getDataSourceFactory, getDataSourceFactory, getDataViewLocations, getDomain, getDomain, getDomainConfigurationName, getDomains, getEventManager, getLoaderDelegate, getLoadStatus, getProjectVersion, getSaverDelegate, getSharedConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, installConfigurationShutdownHook, isIgnoringLoadFailures, removeDomain, setDataSourceFactory, setDataViewLocations, setDomainConfigurationName, setEventManager, setIgnoringLoadFailures, setLoaderDelegate, setLoadStatus, setProjectVersion, setSaverDelegate, shutdown, uninstallConfigurationShutdownHook`

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

Constructor Detail

### DefaultConfiguration

    public DefaultConfiguration()

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

  See Also:
    `Configuration.Configuration()`

### 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.

### canInitialize

    public boolean canInitialize()

  Default implementation of `Configuration.canInitialize()`. Creates a ResourceLocator suitable for loading from the CLASSPATH, unless it has already been set in a subclass. Always returns `true`.

  Specified by:
    `canInitialize` 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`

### didInitialize

    public void didInitialize()

  Default implementation of `Configuration.didInitialize()`. Currently does nothing except logging.

  Specified by:
    `didInitialize` in class `Configuration`

### getResourceLocator

    protected ResourceLocator getResourceLocator()

  Returns the default ResourceLocator configured for CLASSPATH lookups.

  Specified by:
    `getResourceLocator` in class `Configuration`

### setResourceLocator

    protected void setResourceLocator(ResourceLocator locator)

  Sets the specified `ResourceLocator`. Currently called from `initialize()`.

### getDomainConfiguration

    protected InputStream getDomainConfiguration()

  Returns the domain configuration as a stream or `null` if it cannot be found. Uses the configured `ResourceLocator` to find the file.

  Specified by:
    `getDomainConfiguration` in class `Configuration`

### getMapConfiguration

    protected InputStream getMapConfiguration(String location)

  Returns the `DataMap` configuration from a specified location or `null` if it cannot be found. Uses the configured `ResourceLocator` to find the file.

  Specified by:
    `getMapConfiguration` in class `Configuration`

### getViewConfiguration

    protected InputStream getViewConfiguration(String location)

  Description copied from class: `Configuration`
  See 'https://svn.apache.org/repos/asf/cayenne/dataviews/trunk' for DataViews code, which is not a part of Cayenne since 3.0.

  Specified by:
    `getViewConfiguration` in class `Configuration`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

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.