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.util
Class ResourceLocator

    java.lang.Object
      org.apache.cayenne.util.ResourceLocator

All Implemented Interfaces:
  ResourceFinder

Deprecated. since 3.1 deprecated in favor of injectable org.apache.cayenne.resource.ResourceLocator.

    @Deprecated
    public class ResourceLocator

extends Object
implements ResourceFinder

Utility class to find resources (files, etc.), using a preconfigured strategy.

Field Summary
`protected List<String>` | `additionalClassPaths` Deprecated.
`protected List<String>` | `additionalFilesystemPaths` Deprecated.
`protected ClassLoader` | `classLoader` Deprecated.
`protected boolean` | `skipAbsolutePath` Deprecated.
`protected boolean` | `skipClasspath` Deprecated.
`protected boolean` | `skipCurrentDirectory` Deprecated.
`protected boolean` | `skipHomeDirectory` Deprecated.

Constructor Summary
`ResourceLocator()` Deprecated. Creates new ResourceLocator with default lookup policy including user home directory, current directory and CLASSPATH.

Method Summary
`void` | `addClassPath(String customPath)` Deprecated. Adds a custom path for class path lookups.
`void` | `addFilesystemPath(File path)` Deprecated. Adds the given directory as a path for filesystem lookups.
`void` | `addFilesystemPath(String path)` Deprecated. Adds the given String as a custom path for filesystem lookups.
`URL` | `findDirectoryResource(String name)` Deprecated. Returns a directory resource URL using the lookup strategy configured for this ResourceLocator or `null` if no readable resource can be found for the given name.
`static File` | `findFileInCurrentDirectory(String name)` Deprecated. Looks up a file in the current directory.
`static File` | `findFileInFileSystem(String name)` Deprecated. Looks up a file in the filesystem.
`static File` | `findFileInHomeDirectory(String name)` Deprecated. Looks up a file in the user home directory.
`URL` | `findResource(String name)` Deprecated. Returns a resource URL using the lookup strategy configured for this Resourcelocator or `null` if no readable resource can be found for the given name.
`InputStream` | `findResourceStream(String name)` Deprecated. Returns an InputStream on the found resource using the lookup strategy configured for this ResourceLocator or `null` if no readable resource can be found for the given name.
`static URL` | `findURLInClassLoader(String name, ClassLoader loader)` Deprecated. Looks up the URL for the named resource using the specified ClassLoader.
`static URL` | `findURLInClasspath(String name)` Deprecated. Looks up the URL for the named resource using this class' ClassLoader.
`ClassLoader` | `getClassLoader()` Deprecated. Returns the ClassLoader associated with this ResourceLocator.
`URL` | `getResource(String name)` Deprecated. Returns a single resource matching a given name.
`Collection<URL>` | `getResources(String name)` Deprecated. Returns a collection of resource URLs with a given name found in the environment using some lookup strategy.
`void` | `setClassLoader(ClassLoader classLoader)` Deprecated. Sets ClassLoader used to locate resources.
`void` | `setSkipAbsolutePath(boolean skipAbsPath)` Deprecated. Sets "skipAbsolutePath" property.
`void` | `setSkipClasspath(boolean skipClasspath)` Deprecated. Sets "skipClasspath" property.
`void` | `setSkipCurrentDirectory(boolean skipCurDir)` Deprecated. Sets "skipCurrentDirectory" property.
`void` | `setSkipHomeDirectory(boolean skipHomeDir)` Deprecated. Sets "skipHomeDirectory" property.
`boolean` | `willSkipAbsolutePath()` Deprecated. Returns true if no lookups are performed using path as absolute path.
`boolean` | `willSkipClasspath()` Deprecated. Returns true if no lookups are performed in the classpath.
`boolean` | `willSkipCurrentDirectory()` Deprecated. Returns true if no lookups are performed in the current directory.
`boolean` | `willSkipHomeDirectory()` Deprecated. Returns true if no lookups are performed in the user home directory.

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

Field Detail

### skipAbsolutePath

    protected boolean skipAbsolutePath

  Deprecated.

### skipClasspath

    protected boolean skipClasspath

  Deprecated.

### skipCurrentDirectory

    protected boolean skipCurrentDirectory

  Deprecated.

### skipHomeDirectory

    protected boolean skipHomeDirectory

  Deprecated.

### additionalClassPaths

    protected List<String> additionalClassPaths

  Deprecated.

### additionalFilesystemPaths

    protected List<String> additionalFilesystemPaths

  Deprecated.

### classLoader

    protected ClassLoader classLoader

  Deprecated.

Constructor Detail

### ResourceLocator

    public ResourceLocator()

  Deprecated.
  Creates new ResourceLocator with default lookup policy including user home directory, current directory and CLASSPATH.

Method Detail

### findFileInFileSystem

    public static File findFileInFileSystem(String name)

  Deprecated.
  Looks up a file in the filesystem. First looks in the user home directory, then in the current directory.

  Returns:
    file object matching the name, or null if file can not be found or if it is not readable.
  See Also:
    `findFileInHomeDirectory(String)`, `findFileInCurrentDirectory(String)`

### findFileInHomeDirectory

    public static File findFileInHomeDirectory(String name)

  Deprecated.
  Looks up a file in the user home directory.

  Returns:
    file object matching the name, or `null` if `file` cannot be found or is not readable.

### findFileInCurrentDirectory

    public static File findFileInCurrentDirectory(String name)

  Deprecated.
  Looks up a file in the current directory.

  Returns:
    file object matching the name, or `null` if `file` can not be found is not readable.

### findURLInClasspath

    public static URL findURLInClasspath(String name)

  Deprecated.
  Looks up the URL for the named resource using this class' ClassLoader.

### findURLInClassLoader

    public static URL findURLInClassLoader(String name,
                                           ClassLoader loader)

  Deprecated.
  Looks up the URL for the named resource using the specified ClassLoader.

### findResourceStream

    public InputStream findResourceStream(String name)

  Deprecated.
  Returns an InputStream on the found resource using the lookup strategy configured for this ResourceLocator or `null` if no readable resource can be found for the given name.

### getResource

    public URL getResource(String name)

  Deprecated.
  Description copied from interface: `ResourceFinder`
  Returns a single resource matching a given name. If more than one resource matches the name, it is implementation specific which one will be returned.

  Specified by:
    `getResource` in interface `ResourceFinder`
  Since:
    3.0

### getResources

    public Collection<URL> getResources(String name)

  Deprecated.
  Description copied from interface: `ResourceFinder`
  Returns a collection of resource URLs with a given name found in the environment using some lookup strategy.

  Specified by:
    `getResources` in interface `ResourceFinder`
  Since:
    3.0

### findResource

    public URL findResource(String name)

  Deprecated.
  Returns a resource URL using the lookup strategy configured for this Resourcelocator or `null` if no readable resource can be found for the given name.

### findDirectoryResource

    public URL findDirectoryResource(String name)

  Deprecated.
  Returns a directory resource URL using the lookup strategy configured for this ResourceLocator or `null` if no readable resource can be found for the given name. The returned resource is assumed to be a directory, so the returned URL will be in a directory format (with "/" at the end).

### willSkipHomeDirectory

    public boolean willSkipHomeDirectory()

  Deprecated.
  Returns true if no lookups are performed in the user home directory.

### setSkipHomeDirectory

    public void setSkipHomeDirectory(boolean skipHomeDir)

  Deprecated.
  Sets "skipHomeDirectory" property.

### willSkipCurrentDirectory

    public boolean willSkipCurrentDirectory()

  Deprecated.
  Returns true if no lookups are performed in the current directory.

### setSkipCurrentDirectory

    public void setSkipCurrentDirectory(boolean skipCurDir)

  Deprecated.
  Sets "skipCurrentDirectory" property.

### willSkipClasspath

    public boolean willSkipClasspath()

  Deprecated.
  Returns true if no lookups are performed in the classpath.

### setSkipClasspath

    public void setSkipClasspath(boolean skipClasspath)

  Deprecated.
  Sets "skipClasspath" property.

### getClassLoader

    public ClassLoader getClassLoader()

  Deprecated.
  Returns the ClassLoader associated with this ResourceLocator.

### setClassLoader

    public void setClassLoader(ClassLoader classLoader)

  Deprecated.
  Sets ClassLoader used to locate resources. If `null` is passed, the ClassLoader of the ResourceLocator class will be used.

### willSkipAbsolutePath

    public boolean willSkipAbsolutePath()

  Deprecated.
  Returns true if no lookups are performed using path as absolute path.

### setSkipAbsolutePath

    public void setSkipAbsolutePath(boolean skipAbsPath)

  Deprecated.
  Sets "skipAbsolutePath" property.

### addClassPath

    public void addClassPath(String customPath)

  Deprecated.
  Adds a custom path for class path lookups. Format should be "my/package/name" without leading "/".

### addFilesystemPath

    public void addFilesystemPath(String path)

  Deprecated.
  Adds the given String as a custom path for filesystem lookups. The path can be relative or absolute and is not checked for existence.

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

### addFilesystemPath

    public void addFilesystemPath(File path)

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

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-2010 Apache Cayenne. All Rights Reserved.