| java.lang.Object java.lang.ClassLoader dalma.container.ClassLoaderImpl
Method Summary | |
public void | addJarFiles(File dir) Adds all the jar files in the given directory. | public void | addLoaderPackageRoot(String packageRoot) Adds a package root to the list of packages which must be loaded using
this loader. | protected void | addPathFile(File pathComponent) Add a file to the path. | public void | addSystemPackageRoot(String packageRoot) Adds a package root to the list of packages which must be loaded on the
parent loader. | public synchronized void | cleanup() Cleans up any resources held by this classloader. | protected Class | defineClassFromData(File container, byte[] classData, String className) | protected void | definePackage(File container, String className) Define the package information associated with a class. | protected void | definePackage(File container, String packageName, Manifest manifest) | public Class | findClass(String name) Searches for and load a class on the classpath of this class loader.
Parameters: name - The name of the class to be loaded. | protected Enumeration<URL> | findResources(String name) Returns an enumeration of URLs representing all the resources with the
given name by searching the class loader's classpath.
Parameters: name - The resource name to search for.Must not be null . | public Class | forceLoadClass(String classname) Loads a class through this class loader even if that class is available
on the parent classpath.
This ensures that any classes which are loaded by the returned class
will use this classloader.
Parameters: classname - The name of the class to be loaded.Must not be null . | public Class | forceLoadSystemClass(String classname) Loads a class through this class loader but defer to the parent class
loader.
This ensures that instances of the returned class will be compatible
with instances which have already been loaded on the parent
loader.
Parameters: classname - The name of the class to be loaded.Must not be null . | public String | getClasspath() Returns the classpath this classloader will consult. | public URL | getResource(String name) Finds the resource with the given name. | public InputStream | getResourceAsStream(String name) Returns a stream to read the requested resource name.
Parameters: name - The name of the resource for which a stream is required.Must not be null . | protected URL | getResourceURL(File file, String resourceName) Returns the URL of a given resource in the given file which may
either be a directory or a zip file.
Parameters: file - The file (directory or jar) in which to search forthe resource. | protected boolean | isInPath(File component) | protected synchronized Class | loadClass(String classname, boolean resolve) Loads a class with this class loader.
This class attempts to load the class in an order determined by whether
or not the class matches the system/loader package lists, with the
loader package list taking priority. | public void | makeContinuable() | public synchronized void | setIsolated(boolean isolated) Sets whether this classloader should run in isolated mode. | public void | setParent(ClassLoader parent) Set the parent for this class loader. | public void | setParentFirst(boolean parentFirst) Control whether class lookup is delegated to the parent loader first
or after this loader. | public void | setTransformer(ResourceTransformer transformer) |
ClassLoaderImpl | public ClassLoaderImpl(ClassLoader cl)(Code) | | Create an Ant Class Loader
|
addJarFiles | public void addJarFiles(File dir) throws IOException(Code) | | Adds all the jar files in the given directory.
|
addLoaderPackageRoot | public void addLoaderPackageRoot(String packageRoot)(Code) | | Adds a package root to the list of packages which must be loaded using
this loader.
All subpackages are also included.
Parameters: packageRoot - The root of all packages to be included.Should not be null . |
addPathFile | protected void addPathFile(File pathComponent) throws IOException(Code) | | Add a file to the path. This classloader reads the manifest, if
available, and adds any additional class path jars specified in the
manifest.
Parameters: pathComponent - the file which is to be added to the path forthis class loader throws: IOException - if data needed from the file cannot be read. |
addSystemPackageRoot | public void addSystemPackageRoot(String packageRoot)(Code) | | Adds a package root to the list of packages which must be loaded on the
parent loader.
All subpackages are also included.
Parameters: packageRoot - The root of all packages to be included.Should not be null . |
cleanup | public synchronized void cleanup()(Code) | | Cleans up any resources held by this classloader. Any open archive
files are closed.
|
definePackage | protected void definePackage(File container, String className) throws IOException(Code) | | Define the package information associated with a class.
Parameters: container - the file containing the class definition. Parameters: className - the class name of for which the package informationis to be determined. exception: IOException - if the package information cannot be read from thecontainer. |
definePackage | protected void definePackage(File container, String packageName, Manifest manifest)(Code) | | Define the package information when the class comes from a
jar with a manifest
Parameters: container - the jar file containing the manifest Parameters: packageName - the name of the package being defined. Parameters: manifest - the jar's manifest |
findClass | public Class findClass(String name) throws ClassNotFoundException(Code) | | Searches for and load a class on the classpath of this class loader.
Parameters: name - The name of the class to be loaded. Must not benull . the required Class object exception: ClassNotFoundException - if the requested class does not existon this loader's classpath. |
findResources | protected Enumeration<URL> findResources(String name)(Code) | | Returns an enumeration of URLs representing all the resources with the
given name by searching the class loader's classpath.
Parameters: name - The resource name to search for.Must not be null . an enumeration of URLs for the resources |
forceLoadClass | public Class forceLoadClass(String classname) throws ClassNotFoundException(Code) | | Loads a class through this class loader even if that class is available
on the parent classpath.
This ensures that any classes which are loaded by the returned class
will use this classloader.
Parameters: classname - The name of the class to be loaded.Must not be null . the required Class object exception: ClassNotFoundException - if the requested class does not existon this loader's classpath. |
forceLoadSystemClass | public Class forceLoadSystemClass(String classname) throws ClassNotFoundException(Code) | | Loads a class through this class loader but defer to the parent class
loader.
This ensures that instances of the returned class will be compatible
with instances which have already been loaded on the parent
loader.
Parameters: classname - The name of the class to be loaded.Must not be null . the required Class object exception: ClassNotFoundException - if the requested class does not existon this loader's classpath. |
getClasspath | public String getClasspath()(Code) | | Returns the classpath this classloader will consult.
the classpath used for this classloader, with elementsseparated by the path separator for the system. |
getResource | public URL getResource(String name)(Code) | | Finds the resource with the given name. A resource is
some data (images, audio, text, etc) that can be accessed by class
code in a way that is independent of the location of the code.
Parameters: name - The name of the resource for which a stream is required.Must not be null . a URL for reading the resource, or null if theresource could not be found or the caller doesn't haveadequate privileges to get the resource. |
getResourceAsStream | public InputStream getResourceAsStream(String name)(Code) | | Returns a stream to read the requested resource name.
Parameters: name - The name of the resource for which a stream is required.Must not be null . a stream to the required resource or null if theresource cannot be found on the loader's classpath. |
getResourceURL | protected URL getResourceURL(File file, String resourceName)(Code) | | Returns the URL of a given resource in the given file which may
either be a directory or a zip file.
Parameters: file - The file (directory or jar) in which to search forthe resource. Must not be null . Parameters: resourceName - The name of the resource for which a streamis required. Must not be null . a stream to the required resource or null if theresource cannot be found in the given file object. |
isInPath | protected boolean isInPath(File component)(Code) | | Indicate if the given file is in this loader's path
Parameters: component - the file which is to be checked true if the file is in the class path |
loadClass | protected synchronized Class loadClass(String classname, boolean resolve) throws ClassNotFoundException(Code) | | Loads a class with this class loader.
This class attempts to load the class in an order determined by whether
or not the class matches the system/loader package lists, with the
loader package list taking priority. If the classloader is in isolated
mode, failure to load the class in this loader will result in a
ClassNotFoundException.
Parameters: classname - The name of the class to be loaded.Must not be null . Parameters: resolve - true if all classes upon which this classdepends are to be loaded. the required Class object exception: ClassNotFoundException - if the requested class does not existon the system classpath (when not in isolated mode) or this loader'sclasspath. |
makeContinuable | public void makeContinuable()(Code) | | |
setIsolated | public synchronized void setIsolated(boolean isolated)(Code) | | Sets whether this classloader should run in isolated mode. In
isolated mode, classes not found on the given classpath will
not be referred to the parent class loader but will cause a
ClassNotFoundException.
Parameters: isolated - Whether or not this classloader should run inisolated mode. |
setParent | public void setParent(ClassLoader parent)(Code) | | Set the parent for this class loader. This is the class loader to which
this class loader will delegate to load classes
Parameters: parent - the parent class loader. |
setParentFirst | public void setParentFirst(boolean parentFirst)(Code) | | Control whether class lookup is delegated to the parent loader first
or after this loader. Use with extreme caution. Setting this to
false violates the class loader hierarchy and can lead to Linkage errors
Parameters: parentFirst - if true, delegate initial class search to the parentclassloader. |
setTransformer | public void setTransformer(ResourceTransformer transformer)(Code) | | |
Methods inherited from java.lang.ClassLoader | public synchronized void clearAssertionStatus()(Code)(Java Doc) final protected Class> defineClass(byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code)(Java Doc) protected Class> findClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected String findLibrary(String libname)(Code)(Java Doc) final protected Class> findLoadedClass(String name)(Code)(Java Doc) protected URL findResource(String name)(Code)(Java Doc) protected Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc) final protected Class> findSystemClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected Package getPackage(String name)(Code)(Java Doc) protected Package[] getPackages()(Code)(Java Doc) final public ClassLoader getParent()(Code)(Java Doc) public URL getResource(String name)(Code)(Java Doc) public InputStream getResourceAsStream(String name)(Code)(Java Doc) public Enumeration<URL> getResources(String name) throws IOException(Code)(Java Doc) public static ClassLoader getSystemClassLoader()(Code)(Java Doc) public static URL getSystemResource(String name)(Code)(Java Doc) public static InputStream getSystemResourceAsStream(String name)(Code)(Java Doc) public static Enumeration<URL> getSystemResources(String name) throws IOException(Code)(Java Doc) public Class> loadClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)(Java Doc) final protected void resolveClass(Class> c)(Code)(Java Doc) public synchronized void setClassAssertionStatus(String className, boolean enabled)(Code)(Java Doc) public synchronized void setDefaultAssertionStatus(boolean enabled)(Code)(Java Doc) public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)(Code)(Java Doc) final protected void setSigners(Class> c, Object[] signers)(Code)(Java Doc)
|
|
|