|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mospace.lang.MinimalClassLoaderProvider
de.mospace.lang.DefaultClassLoaderProvider
public class DefaultClassLoaderProvider
A fully functional implementation of the ClassLoaderProvider
interface. Libraries can be registered with a DefaultClassLoaderProvider
and class loaders that look for class files in these libraries
can be obtained with the getClassLoader() method.
| Field Summary | |
|---|---|
static long |
serialVersionUID
serialization version id |
| Constructor Summary | |
|---|---|
DefaultClassLoaderProvider()
Constructs a new ClassLoaderProvider whose getClassLoader()
method will return class loaders that finally delegate to
the system class loader. |
|
DefaultClassLoaderProvider(ClassLoader parent)
Constructs a new ClassLoaderProvider whose getClassLoader()
method will return class loaders that finally delegate to
the specified class loader. |
|
| Method Summary | |
|---|---|
ClassLoader |
getClassLoader()
Returns a class loader that looks for class files in all libraries that have been successfully registered with this ClassLoaderProvider, so far. |
URL[] |
getLibraries()
Returns all libraries that have been registered with this ClassLoaderProvider, so far. |
File[] |
getLibraryFiles()
Returns the library files that have been registered with this ClassLoaderProvider, so far. |
static URI |
getRepositoryRoot(Class klass)
Tries to determine the class path element from which the specified class has been loaded. |
static File |
getRepositoryRootDir(Class klass)
Tries to determine the directory that is or that contains the class path element from which the specified class has been loaded. |
static boolean |
isTemporary(File file)
Determines whether the path of the specified file starts with the directory specified in the Java system property java.io.tmpdir. |
boolean |
registerDirectory(File dir)
Requests that the specified directory be registered, so that it is on the class path of all class loaders returned by future calls to getClassLoader(). |
boolean |
registerLibraries(File[] jarFiles)
Requests that the specified jar files be registered, so that they are in the class path of all class loaders returned by future calls to getClassLoader(). |
boolean |
registerLibrary(File jarFile)
Requests that the specified jar file be registered, so that it is in the class path of all class loaders returned by future calls to getClassLoader(). |
boolean |
registerLibraryDirectories(File[] dirs)
Requests that all jar files in the specified directories be registered, so that they are in the class path of all class loaders returned by future calls to getClassLoader(). |
boolean |
registerLibraryDirectory(File dir)
Requests that all jar files in the specified directory be registered, so that they are in the class path of all class loaders returned by future calls to getClassLoader(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public DefaultClassLoaderProvider()
getClassLoader()
method will return class loaders that finally delegate to
the system class loader.
public DefaultClassLoaderProvider(ClassLoader parent)
getClassLoader()
method will return class loaders that finally delegate to
the specified class loader.
parent - the delegating-parent for all class loaders returned
by this ClassLoaderProvider's getClassLoader() method, may be
null.| Method Detail |
|---|
public static File getRepositoryRootDir(Class klass)
klass - a class loaded from the local file system
IllegalArgumentException - if the repository root of the
specified class is not a file.public static URI getRepositoryRoot(Class klass)
klass - a non-null class object
klass
has been loadedpublic static boolean isTemporary(File file)
file - a non-null file object
System.getProperty(java.lang.String)public final URL[] getLibraries()
public final File[] getLibraryFiles()
public final ClassLoader getClassLoader()
getClassLoader in interface ClassLoaderProvidergetClassLoader in class MinimalClassLoaderProviderpublic final boolean registerLibrary(File jarFile)
getClassLoader().
registerLibrary in interface ClassLoaderProviderregisterLibrary in class MinimalClassLoaderProviderjarFile - a jar archive with Java class files
IllegalArgumentException - if jarFile does not exist
or is not a jar filepublic final boolean registerLibraries(File[] jarFiles)
getClassLoader().
registerLibraries in interface ClassLoaderProviderregisterLibraries in class MinimalClassLoaderProviderjarFiles - an array of jar archives with Java class files
public final boolean registerLibraryDirectory(File dir)
getClassLoader().
registerLibraryDirectory in interface ClassLoaderProviderregisterLibraryDirectory in class MinimalClassLoaderProviderdir - a directory with jar archives. The client must assure that
dir exists and is a directory. dir may contain non-jar files
dir,
for wich the request was honored.
IllegalArgumentException - if dir is not a directorypublic final boolean registerLibraryDirectories(File[] dirs)
getClassLoader().
Non-directory files in dirs will be ignored.
registerLibraryDirectories in interface ClassLoaderProviderregisterLibraryDirectories in class MinimalClassLoaderProviderdirs - an array of directories with jar archives
dirs,
for wich the request was honored.public final boolean registerDirectory(File dir)
getClassLoader().
dir - a non-null directory with Java class files
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||