|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--submarine.pages.loader.SimpleClassLoader
This is a JDK1.1 equivalent of URLClassLoader. It have no dependency on tomcat or any other api - just standard java. Based on AdaptiveClassLoader from JServ1, with the dependency check and reloading features removed ( and moved to an external component) This is based on the fact that class loading and dependency checking can be separated and we want to support multiple forms of class loaders. The interface also changed to match URLClassLoader. This class should be used _only_ with JDK1.1, for JDK1.2 you should use a class loader that is aware of Permissions and the new rules ( sealing, etc ) This class loader respects the standard order defined in the ClassLoader documentation - for a different order you can plug in a different class loader ( in the configurations ). Since this class loader will be visible to applications we need to prevent exploits - we'll minimize the public method usage. The class path can be set only when the object is constructed.
Inner Class Summary | |
private class |
SimpleClassLoader.Resource
Private class used to store the result of the search |
Inner classes inherited from class java.lang.ClassLoader |
java.lang.ClassLoader.NativeLibrary |
Field Summary | |
private static int |
debug
|
protected java.lang.ClassLoader |
parent
A parent class loader for delegation of finding a class definition. |
protected java.lang.String[] |
reserved
Reserved names - this class loader will not allow creation of classes that start with one of those strings. |
(package private) java.lang.SecurityManager |
sm
|
protected java.net.URL[] |
urls
The classpath which this classloader searches for class definitions. |
Fields inherited from class java.lang.ClassLoader |
bootstrapClassPath, classes, defaultDomain, defaultPermissions, domains, getClassLoaderPerm, initialized, loadedLibraryNames, nativeLibraries, nativeLibraryContext, nocerts, package2certs, packages, scl, sclSet, sys_paths, systemNativeLibraries, usr_paths |
Constructor Summary | |
SimpleClassLoader(java.net.URL[] urls)
|
|
SimpleClassLoader(java.net.URL[] urls,
java.lang.ClassLoader parent)
|
|
SimpleClassLoader(java.net.URL[] urls,
java.lang.ClassLoader parent,
java.lang.String[] reserved)
This is the prefered constructor to be used with this class loader |
Method Summary | |
private void |
checkURLs()
|
private SimpleClassLoader.Resource |
doFindResource(java.lang.String name)
|
java.lang.ClassLoader |
getParentLoader()
We can't declare a method "getParent" since it'll not compile in JDK1.2 - the method is final. |
java.net.URL |
getResource(java.lang.String name)
Find a resource with a given name. |
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Get an InputStream on a given resource. |
java.net.URL[] |
getURLs()
|
boolean |
hasLoadedClass(java.lang.String name)
|
private byte[] |
loadBytesFromStream(java.io.InputStream in,
int length)
Loads all the bytes of an InputStream. |
protected java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Resolves the specified name to a Class. |
(package private) void |
log(java.lang.String s)
|
Methods inherited from class java.lang.ClassLoader |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Field Detail |
private static final int debug
protected java.net.URL[] urls
It may be empty when only system classes are controlled.
protected java.lang.ClassLoader parent
protected java.lang.String[] reserved
java.lang.SecurityManager sm
Constructor Detail |
public SimpleClassLoader(java.net.URL[] urls)
public SimpleClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
public SimpleClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent, java.lang.String[] reserved)
Method Detail |
public java.lang.ClassLoader getParentLoader()
private void checkURLs()
void log(java.lang.String s)
public boolean hasLoadedClass(java.lang.String name)
protected java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
name
- the name of the desired Class.resolve
- true if the Class needs to be resolved;
false if the virtual machine just wants to determine
whether the class exists or notjava.lang.ClassNotFoundException
- if the class loader cannot
find a the requested class.public java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
name
- the name of the resource, to be used as is.public java.io.InputStream getResourceAsStream(java.lang.String name)
The JServClassLoader translate the resource's name to a file or a zip entry. It looks for the resource in all its repository entry.
getResourceAsStream
in class java.lang.ClassLoader
name
- the name of the resource, to be used as is.Class.getResourceAsStream(String)
private SimpleClassLoader.Resource doFindResource(java.lang.String name)
private byte[] loadBytesFromStream(java.io.InputStream in, int length) throws java.io.IOException
public java.net.URL[] getURLs()
|
Submarine project. free distribution of this software must include the opensource licence. Guénolé de Cadoudal. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |