|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.xbean.server.classloader.NamedClassLoader
org.apache.xbean.server.classloader.MultiParentClassLoader
org.apache.xbean.server.classloader.JarFileClassLoader
The JarFileClassLoader that loads classes and resources from a list of JarFiles. This method is simmilar to URLClassLoader except it properly closes JarFiles when the classloader is destroyed so that the file read lock will be released, and the jar file can be modified and deleted.
Note: This implementation currently does not work reliably on windows, since the jar URL handler included with the Sun JavaVM holds a read lock on the JarFile, and this lock is not released when the jar url is dereferenced. To fix this a replacement for the jar url handler must be written.
Constructor Summary | |
JarFileClassLoader(java.lang.String name,
java.net.URL[] urls)
Creates a JarFileClassLoader that is a child of the system class loader. |
|
JarFileClassLoader(java.lang.String name,
java.net.URL[] urls,
java.lang.ClassLoader parent)
Creates a JarFileClassLoader that is a child of the specified class loader. |
|
JarFileClassLoader(java.lang.String name,
java.net.URL[] urls,
java.lang.ClassLoader[] parents)
Creates a named class loader as a child of the specified parents. |
|
JarFileClassLoader(java.lang.String name,
java.net.URL[] urls,
java.lang.ClassLoader[] parents,
java.net.URLStreamHandlerFactory factory)
Creates a named class loader as a child of the specified parents and using the specified URLStreamHandlerFactory for accessing the urls.. |
|
JarFileClassLoader(java.lang.String name,
java.net.URL[] urls,
java.lang.ClassLoader parent,
java.net.URLStreamHandlerFactory factory)
Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory for accessing the urls.. |
Method Summary | |
protected void |
addURL(java.net.URL url)
|
protected void |
addURLs(java.util.List urls)
Adds a list of urls to the end of this class loader. |
protected void |
addURLs(java.net.URL[] urls)
Adds an array of urls to the end of this class loader. |
void |
destroy()
Destroys the clasloader releasing all resources. After this mehtod is called, the class loader will no longer load any classes or resources. |
protected java.lang.Class |
findClass(java.lang.String className)
|
java.net.URL |
findResource(java.lang.String resourceName)
|
java.util.Enumeration |
findResources(java.lang.String resourceName)
|
java.net.URL[] |
getURLs()
|
Methods inherited from class org.apache.xbean.server.classloader.MultiParentClassLoader |
getParents, getResource, loadClass, toString |
Methods inherited from class org.apache.xbean.server.classloader.NamedClassLoader |
getName |
Methods inherited from class java.net.URLClassLoader |
definePackage, getPermissions, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JarFileClassLoader(java.lang.String name, java.net.URL[] urls)
name
- the name of this class loaderurls
- a list of URLs from which classes and resources should be loadedpublic JarFileClassLoader(java.lang.String name, java.net.URL[] urls, java.lang.ClassLoader parent)
name
- the name of this class loaderurls
- a list of URLs from which classes and resources should be loadedparent
- the parent of this class loaderpublic JarFileClassLoader(java.lang.String name, java.net.URL[] urls, java.lang.ClassLoader parent, java.net.URLStreamHandlerFactory factory)
name
- the name of this class loaderurls
- the urls from which this class loader will classes and resourcesparent
- the parent of this class loaderfactory
- the URLStreamHandlerFactory used to access the urlspublic JarFileClassLoader(java.lang.String name, java.net.URL[] urls, java.lang.ClassLoader[] parents)
name
- the name of this class loaderurls
- the urls from which this class loader will classes and resourcesparents
- the parents of this class loaderpublic JarFileClassLoader(java.lang.String name, java.net.URL[] urls, java.lang.ClassLoader[] parents, java.net.URLStreamHandlerFactory factory)
name
- the name of this class loaderurls
- the urls from which this class loader will classes and resourcesparents
- the parents of this class loaderfactory
- the URLStreamHandlerFactory used to access the urlsMethod Detail |
public java.net.URL[] getURLs()
protected void addURL(java.net.URL url)
protected void addURLs(java.net.URL[] urls)
urls
- the URLs to addprotected void addURLs(java.util.List urls)
urls
- the URLs to addpublic void destroy()
destroy
in interface DestroyableClassLoader
destroy
in class NamedClassLoader
public java.net.URL findResource(java.lang.String resourceName)
public java.util.Enumeration findResources(java.lang.String resourceName) throws java.io.IOException
findResources
in class MultiParentClassLoader
java.io.IOException
protected java.lang.Class findClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |