|
|||||||||||
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.codehaus.classworlds.RealmClassLoader
org.codehaus.classworlds.UberJarRealmClassLoader
Classloader for ClassRealm
s.
Loads classes from an "uberjar".
Nested Class Summary |
Nested classes inherited from class java.lang.ClassLoader |
|
Field Summary | |
private java.util.Map |
classIndex
Classes, indexed by path. |
private java.util.Map |
jarIndexes
Indexes for constituent jars. |
protected DefaultClassRealm |
realm
The realm. |
private java.util.List |
urls
Urls. |
Fields inherited from class java.net.URLClassLoader |
|
Fields inherited from class java.security.SecureClassLoader |
|
Fields inherited from class java.lang.ClassLoader |
|
Constructor Summary | |
(package private) |
UberJarRealmClassLoader(DefaultClassRealm realm)
Construct. |
Method Summary | |
(package private) void |
addConstituent(java.net.URL constituent)
Add a constituent to this realm for locating classes. |
private void |
buildIndexForJar(java.net.URL inUrl)
Builds an index for an incoming jar. |
protected byte[] |
findClassInDirectoryUrl(java.net.URL url,
java.lang.String path)
Attempt to load the bytes of a class from a directory URL . |
protected byte[] |
findClassInJarStream(java.net.URL inUrl,
java.lang.String path)
Attempt to load the bytes of a class from a JAR URL . |
java.net.URL |
findResource(java.lang.String name)
|
protected java.net.URL |
findResourceInDirectoryUrl(java.net.URL inUrl,
java.lang.String path)
Find a resource that potentially exists within a directory. |
protected java.net.URL |
findResourceInJarStream(java.net.URL inUrl,
java.lang.String path)
Find a resource that potentially exists within a JAR stream. |
(package private) DefaultClassRealm |
getRealm()
Retrieve the realm. |
java.net.URL |
getResource(java.lang.String name)
|
java.net.URL[] |
getURLs()
Retrieve the URL s used by this ClassLoader . |
protected java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Load a class. |
(package private) java.lang.Class |
loadClassDirect(java.lang.String className)
Load a class directly from this classloader without defering through any other ClassRealm . |
private byte[] |
readStream(java.io.InputStream in)
Read the contents of the provided input stream and return the contents as a byte array. |
Methods inherited from class java.net.URLClassLoader |
addURL, definePackage, findClass, findResources, 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, toString, wait, wait, wait |
Field Detail |
private java.util.Map classIndex
private java.util.List urls
private java.util.Map jarIndexes
protected DefaultClassRealm realm
Constructor Detail |
UberJarRealmClassLoader(DefaultClassRealm realm)
realm
- The realm for which this loads.Method Detail |
DefaultClassRealm getRealm()
getRealm
in class RealmClassLoader
void addConstituent(java.net.URL constituent)
addConstituent
in class RealmClassLoader
constituent
- URL to contituent jar or directory.private void buildIndexForJar(java.net.URL inUrl)
inUrl
- java.lang.Class loadClassDirect(java.lang.String className) throws java.lang.ClassNotFoundException
ClassRealm
.
loadClassDirect
in class RealmClassLoader
className
- The name of the class to load.
java.lang.ClassNotFoundException
- If the class could not be found.public java.net.URL getResource(java.lang.String name)
ClassLoader
public java.net.URL findResource(java.lang.String name)
findResource
in class RealmClassLoader
ClassLoader
protected java.net.URL findResourceInJarStream(java.net.URL inUrl, java.lang.String path)
inUrl
- The jar stream URL.path
- The resource path to find.
null
if none found.protected java.net.URL findResourceInDirectoryUrl(java.net.URL inUrl, java.lang.String path)
inUrl
- The directory URL.path
- The resource path to find.
null
if none found.protected byte[] findClassInJarStream(java.net.URL inUrl, java.lang.String path)
URL
.
inUrl
- The base url.path
- The path to the desired class.
null
if not available
via the base url.protected byte[] findClassInDirectoryUrl(java.net.URL url, java.lang.String path)
URL
.
url
- The directory url.path
- The path to the desired class.
null
if not available
via the base url.protected java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class RealmClassLoader
name
- The name of the class to load.resolve
- If true
then resolve the class.
java.lang.ClassNotFoundException
- If the class cannot be found.private byte[] readStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public java.net.URL[] getURLs()
URL
s used by this ClassLoader
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |