org.mbari.siam.utils
Class MultiClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.mbari.siam.utils.MultiClassLoader
Direct Known Subclasses:
JarClassLoader

public abstract class MultiClassLoader
extends java.lang.ClassLoader

A simple test class loader capable of loading from multiple sources, such as local files or a URL. This class is derived from an article by Chuck McManis http://www.javaworld.com/javaworld/jw-10-1996/indepth.src.html with large modifications. Note that this has been updated to use the non-deprecated version of defineClass() -- JDM. Based on code found in "Java Tip 70" at "Java World".

Author:
Jack Harich - 8/18/97, John D. Mitchell - 99.03.04

Field Summary
protected  boolean monitorOn
           
protected  boolean sourceMonitorOn
           
 
Constructor Summary
MultiClassLoader()
           
 
Method Summary
protected  java.lang.String formatClassName(java.lang.String className)
           
 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)
           
protected abstract  byte[] loadClassBytes(java.lang.String className)
           
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 package org.mbari.siam.utils in the same retrival directory.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, 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

monitorOn

protected boolean monitorOn

sourceMonitorOn

protected boolean sourceMonitorOn
Constructor Detail

MultiClassLoader

public MultiClassLoader()
Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException
This is a simple version for external clients since they will always want the class resolved before it is returned to them.

Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

loadClass

public java.lang.Class loadClass(java.lang.String className,
                                 boolean resolveIt)
                          throws java.lang.ClassNotFoundException
Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

setClassNameReplacementChar

public 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 package org.mbari.siam.utils in the same retrival directory. In the above example the char would be '_'.


loadClassBytes

protected abstract byte[] loadClassBytes(java.lang.String className)

formatClassName

protected java.lang.String formatClassName(java.lang.String className)

monitor

protected void monitor(java.lang.String text)

print

protected static void print(java.lang.String text)


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.