|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.ClassLoader
|
+--com.objectwave.customClassLoader.MultiClassLoader
A simple test class loader capable of loading from multiple sources, such as local files or a URL. Must be subclassed and the abstract method loadClassBytes() implemented to provide the preferred source. This class is derived from an article by Chuck McManis http://www.javaworld.com/javaworld/jw-10-1996/indepth.src.html with large modifications. This class is derived from an article by Jack Harich - 8/18/97
| Field Summary | |
protected boolean |
loadLocalClasses
|
boolean |
monitorOn
|
protected boolean |
sourceMonitorOn
|
| Constructor Summary | |
MultiClassLoader()
Register ourselves with the CclpURLConnection so that we can handle all system resource requests as well as class requests. |
|
| Method Summary | |
java.lang.Class |
findClass(java.lang.String str)
|
protected java.lang.String |
formatClassName(java.lang.String className)
|
abstract java.lang.Object |
getContent(java.net.URL url)
Every custom class loader will need to be able to get the content from a modified URL. |
abstract java.io.InputStream |
getInputStream(java.net.URL url)
Every custom class loader will need to be able to get the input stream from a modified URL. |
java.net.URL |
getResource(java.lang.String name)
This looks locally for the resource fist, then it returns our own CCLP url to retrieve this resource. |
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Return the resource as a stream. |
void |
initPathInformation()
Create the jar readers. |
java.lang.Class |
loadClass(java.lang.String className)
This is a simple version for external clients since they will always want the class resolved before it is returned to them. |
java.lang.Class |
loadClass(java.lang.String className,
boolean resolveIt)
This method is called from the VM. |
protected abstract byte[] |
loadClassBytes(java.lang.String className)
Must be implmented by subclass. |
protected byte[] |
loadLocalClassBytes(java.lang.String fullClassName)
Similar to findSystemClass but the newly defined class will have this as the ClassLoader. |
java.io.InputStream |
locateClass(java.lang.String fullClassName)
Find the request .class bytes for the provided classname. |
protected java.lang.Class |
lookForPreviousDefinitions(java.lang.String className)
|
static void |
main(java.lang.String[] args)
Test method. |
protected void |
monitor(java.lang.String text)
|
protected static void |
print(java.lang.String text)
|
void |
setClassNameReplacementChar(char replacement)
This optional call allows a class name such as "COM.test.Hello" to be changed to "COM_test_Hello", which is useful for storing classes from different packages in the same retrival directory. |
protected boolean |
useLocalLoader(java.lang.String className)
|
| Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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 |
public boolean monitorOn
protected boolean sourceMonitorOn
protected boolean loadLocalClasses
| Constructor Detail |
public MultiClassLoader()
| Method Detail |
public static void main(java.lang.String[] args)
args - The command line argumentsprotected static void print(java.lang.String text)
text - public void setClassNameReplacementChar(char replacement)
replacement - The new ClassNameReplacementChar value
public abstract java.lang.Object getContent(java.net.URL url)
throws java.io.IOException
url -
java.io.IOException
public abstract java.io.InputStream getInputStream(java.net.URL url)
throws java.io.IOException
url -
java.io.IOExceptionpublic java.net.URL getResource(java.lang.String name)
getResource in class java.lang.ClassLoadername -
public java.io.InputStream getResourceAsStream(java.lang.String name)
getResourceAsStream in class java.lang.ClassLoadername -
public java.io.InputStream locateClass(java.lang.String fullClassName)
fullClassName -
public void initPathInformation()
public java.lang.Class loadClass(java.lang.String className)
throws java.lang.ClassNotFoundException
loadClass in class java.lang.ClassLoaderclassName -
java.lang.ClassNotFoundExceptionprotected java.lang.Class lookForPreviousDefinitions(java.lang.String className)
public java.lang.Class findClass(java.lang.String str)
throws java.lang.ClassNotFoundException
findClass in class java.lang.ClassLoaderjava.lang.ClassNotFoundExceptionprotected boolean useLocalLoader(java.lang.String className)
public java.lang.Class loadClass(java.lang.String className,
boolean resolveIt)
throws java.lang.ClassNotFoundException
loadClass in class java.lang.ClassLoaderclassName - resolveIt -
java.lang.ClassNotFoundExceptionprotected java.lang.String formatClassName(java.lang.String className)
className -
protected abstract byte[] loadClassBytes(java.lang.String className)
className -
protected byte[] loadLocalClassBytes(java.lang.String fullClassName)
fullClassName -
protected void monitor(java.lang.String text)
text -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||