|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.util.ResourceLocator
@Deprecated public class ResourceLocator
Utility class to find resources (files, etc.), using a preconfigured strategy.
Field Summary | |
---|---|
protected java.util.List<java.lang.String> |
additionalClassPaths
Deprecated. |
protected java.util.List<java.lang.String> |
additionalFilesystemPaths
Deprecated. |
protected java.lang.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(java.lang.String customPath)
Deprecated. Adds a custom path for class path lookups. |
void |
addFilesystemPath(java.io.File path)
Deprecated. Adds the given directory as a path for filesystem lookups. |
void |
addFilesystemPath(java.lang.String path)
Deprecated. Adds the given String as a custom path for filesystem lookups. |
java.net.URL |
findDirectoryResource(java.lang.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 java.io.File |
findFileInCurrentDirectory(java.lang.String name)
Deprecated. Looks up a file in the current directory. |
static java.io.File |
findFileInFileSystem(java.lang.String name)
Deprecated. Looks up a file in the filesystem. |
static java.io.File |
findFileInHomeDirectory(java.lang.String name)
Deprecated. Looks up a file in the user home directory. |
java.net.URL |
findResource(java.lang.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. |
java.io.InputStream |
findResourceStream(java.lang.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 java.net.URL |
findURLInClassLoader(java.lang.String name,
java.lang.ClassLoader loader)
Deprecated. Looks up the URL for the named resource using the specified ClassLoader. |
static java.net.URL |
findURLInClasspath(java.lang.String name)
Deprecated. Looks up the URL for the named resource using this class' ClassLoader. |
java.lang.ClassLoader |
getClassLoader()
Deprecated. Returns the ClassLoader associated with this ResourceLocator. |
java.net.URL |
getResource(java.lang.String name)
Deprecated. Returns a single resource matching a given name. |
java.util.Collection<java.net.URL> |
getResources(java.lang.String name)
Deprecated. Returns a collection of resource URLs with a given name found in the environment using some lookup strategy. |
void |
setClassLoader(java.lang.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 |
---|
protected boolean skipAbsolutePath
protected boolean skipClasspath
protected boolean skipCurrentDirectory
protected boolean skipHomeDirectory
protected java.util.List<java.lang.String> additionalClassPaths
protected java.util.List<java.lang.String> additionalFilesystemPaths
protected java.lang.ClassLoader classLoader
Constructor Detail |
---|
public ResourceLocator()
Method Detail |
---|
public static java.io.File findFileInFileSystem(java.lang.String name)
findFileInHomeDirectory(String)
,
findFileInCurrentDirectory(String)
public static java.io.File findFileInHomeDirectory(java.lang.String name)
null
if file
cannot be found or is not readable.public static java.io.File findFileInCurrentDirectory(java.lang.String name)
null
if file
can not be found is not readable.public static java.net.URL findURLInClasspath(java.lang.String name)
public static java.net.URL findURLInClassLoader(java.lang.String name, java.lang.ClassLoader loader)
public java.io.InputStream findResourceStream(java.lang.String name)
null
if no readable resource can be found
for the given name.
public java.net.URL getResource(java.lang.String name)
ResourceFinder
getResource
in interface ResourceFinder
public java.util.Collection<java.net.URL> getResources(java.lang.String name)
ResourceFinder
getResources
in interface ResourceFinder
public java.net.URL findResource(java.lang.String name)
null
if no readable resource can be found for the
given name.
public java.net.URL findDirectoryResource(java.lang.String name)
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).
public boolean willSkipHomeDirectory()
public void setSkipHomeDirectory(boolean skipHomeDir)
public boolean willSkipCurrentDirectory()
public void setSkipCurrentDirectory(boolean skipCurDir)
public boolean willSkipClasspath()
public void setSkipClasspath(boolean skipClasspath)
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
null
is passed, the
ClassLoader of the ResourceLocator class will be used.
public boolean willSkipAbsolutePath()
public void setSkipAbsolutePath(boolean skipAbsPath)
public void addClassPath(java.lang.String customPath)
public void addFilesystemPath(java.lang.String path)
java.lang.IllegalArgumentException
- if path
is null
.public void addFilesystemPath(java.io.File path)
java.lang.IllegalArgumentException
- if path
is null
, not a
directory or not readable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |