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 FileConfiguration

    java.lang.Object
      org.apache.cayenne.conf.Configuration
          org.apache.cayenne.conf.DefaultConfiguration
              org.apache.cayenne.conf.FileConfiguration

Direct Known Subclasses:
  ProjectConfiguration

    public class FileConfiguration

extends DefaultConfiguration

FileConfiguration loads a Cayenne configuraton file from a given location in the file system.

Field Summary
`protected File` | `projectFile` The domain file used for this configuration

Fields inherited from class org.apache.cayenne.conf.DefaultConfiguration
`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, projectVersion, saverDelegate, sharedConfiguration`

Constructor Summary
`FileConfiguration()` Default constructor.
`FileConfiguration(File domainConfigurationFile)` Creates a configuration that uses the provided file as the main project file, ignoring any other lookup strategies.
`FileConfiguration(String domainConfigurationName)` Creates a configuration that uses the provided file name as the main project file, ignoring any other lookup strategies.

Method Summary
`void` | `addFilesystemPath(File path)` Adds the given directory as a path for filesystem lookups.
`void` | `addFilesystemPath(String path)` Adds the given String as a custom path for filesystem lookups.
`boolean` | `canInitialize()` Deprecated. since 3.0 - superclass method is deprecated.
`File` | `getProjectDirectory()` Returns the directory of the current project file as returned by `getProjectFile()`.
`File` | `getProjectFile()` Returns the main domain file used for this configuration.
`protected void` | `setProjectFile(File projectFile)` Sets the main domain file used for this configuration.

Methods inherited from class org.apache.cayenne.conf.DefaultConfiguration
`addClassPath, addResourcePath, getDomainConfiguration, getResourceFinder, getResourceLocator, initialize, setResourceLocator, toString`

Methods inherited from class org.apache.cayenne.conf.Configuration
`addDomain, didInitialize, getDataSourceFactory, getDataSourceFactory, getDataViewLocations, getDomain, getDomain, getDomainConfigurationName, getDomains, getEventManager, getLoaderDelegate, getLoadStatus, getMapConfiguration, getProjectVersion, getSaverDelegate, getSharedConfiguration, getViewConfiguration, 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`

Field Detail

### projectFile

    protected File projectFile

  The domain file used for this configuration

Constructor Detail

### FileConfiguration

    public FileConfiguration()

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

  See Also:
    `DefaultConfiguration.DefaultConfiguration()`

### FileConfiguration

    public FileConfiguration(String domainConfigurationName)

  Creates a configuration that uses the provided file name as the main project file, ignoring any other lookup strategies. The file name is not checked for existence and must not contain relative or absolute paths, i.e. only the file name.

  Throws:
    `ConfigurationException` - when projectFile is `null`.
  See Also:
    `DefaultConfiguration.DefaultConfiguration(String)`

### FileConfiguration

    public FileConfiguration(File domainConfigurationFile)

  Creates a configuration that uses the provided file as the main project file, ignoring any other lookup strategies.

  Throws:
    `ConfigurationException` - when projectFile is `null`, a directory or not readable.

Method Detail

### addFilesystemPath

    public void addFilesystemPath(String path)

  Adds the given String as a custom path for filesystem lookups. The path can be relative or absolute and is not checked for existence. This allows for easy customization of resource search paths after Constructor invocation:

       conf = new FileConfiguration("myconfig-cayenne.xml");
       conf.addFilesystemPath(new File("a/relative/path"));
       conf.addFilesystemPath(new File("/an/absolute/search/path"));
       Configuration.initializeSharedConfiguration(conf);

  Alternatively use `addFilesystemPath(File)` for adding a path that is checked for existence.

  Throws:
    `IllegalArgumentException` - if `path` is `null`.

### addFilesystemPath

    public void addFilesystemPath(File path)

  Adds the given directory as a path for filesystem lookups. The directory is checked for existence.

  Throws:
    `IllegalArgumentException` - if `path` is `null`, not a directory or not readable.

### canInitialize

    public boolean canInitialize()

  Deprecated. since 3.0 - superclass method is deprecated.

  Only returns `true` when `getProjectFile()` does not return `null`.

  Overrides:
    `canInitialize` in class `Configuration`

### getProjectFile

    public File getProjectFile()

  Returns the main domain file used for this configuration.

### setProjectFile

    protected void setProjectFile(File projectFile)

  Sets the main domain file used for this configuration.

  Throws:
    `ConfigurationException` - if `projectFile` is null, a directory or not readable.

### getProjectDirectory

    public File getProjectDirectory()

  Returns the directory of the current project file as returned by `getProjectFile()`.

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.