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

## org.objectstyle.cayenne.conf
Class DefaultConfiguration

    java.lang.Object
      org.objectstyle.cayenne.conf.Configuration
          org.objectstyle.cayenne.conf.DefaultConfiguration

Direct Known Subclasses:
  BasicServletConfiguration, FileConfiguration

    public class DefaultConfiguration

extends Configuration

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

Author:
  Andrei Adamchik

Field Summary

Fields inherited from class org.objectstyle.cayenne.conf.Configuration
`ACCEPT_ALL_DATAVIEWS, configurationShutdownHook, dataDomains, dataViewLocations, DEFAULT_CONFIGURATION_CLASS, DEFAULT_DOMAIN_FILE, DEFAULT_LOGGING_PROPS_FILE, domainConfigurationName, eventManager, ignoringLoadFailures, loaderDelegate, loadStatus, overrideFactory, projectVersion, saverDelegate, sharedConfiguration`

Constructor Summary
`DefaultConfiguration()` Default constructor.
`DefaultConfiguration(java.lang.String domainConfigurationName)` Constructor with a named domain configuration resource.
`DefaultConfiguration(java.lang.String domainConfigurationName, ResourceLocator locator)` Creates DefaultConfiguration with specified cayenne project file name and ResourceLocator.

Method Summary
`void` | `addClassPath(java.lang.String customPath)` Adds a custom path for class path lookups.
`void` | `addResourcePath(java.lang.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 java.io.InputStream` | `getDomainConfiguration()` Returns the domain configuration as a stream or `null` if it cannot be found.
`protected java.io.InputStream` | `getMapConfiguration(java.lang.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 java.io.InputStream` | `getViewConfiguration(java.lang.String location)`
`void` | `initialize()` Initializes all Cayenne resources.
`protected void` | `setResourceLocator(ResourceLocator locator)` Sets the specified `ResourceLocator`.
`java.lang.String` | `toString()`

Methods inherited from class org.objectstyle.cayenne.conf.Configuration
`addDomain, bootstrapSharedConfiguration, configureCommonLogging, configureCommonLogging, configureLogging, getDataSourceFactory, getDataViewLocations, getDomain, getDomain, getDomainConfigurationName, getDomains, getEventManager, getLoaderDelegate, getLoadStatus, getLoggingLevel, getProjectVersion, getResourceLoader, getSaverDelegate, getSharedConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, initializeSharedConfiguration, installConfigurationShutdownHook, isIgnoringLoadFailures, isLoggingConfigured, loadDataView, loadDataView, removeDomain, setDataSourceFactory, setDataViewLocations, setDomainConfigurationName, setEventManager, setIgnoringLoadFailures, setLoaderDelegate, setLoadStatus, setLoggingConfigured, setLoggingLevel, 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(java.lang.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(java.lang.String domainConfigurationName,
                                ResourceLocator locator)

  Creates DefaultConfiguration with specified cayenne project file name and ResourceLocator.

  Since:
    1.2

Method Detail

### addClassPath

    public void addClassPath(java.lang.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(java.lang.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:
    `java.lang.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 java.lang.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:
    `java.lang.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 java.io.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 java.io.InputStream getMapConfiguration(java.lang.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 java.io.InputStream getViewConfiguration(java.lang.String location)

  Specified by:
    `getViewConfiguration` in class `Configuration`

### toString

    public java.lang.String toString()

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

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

Copyright © 2001-2006 ObjectStyle.org All Rights Reserved.