SmartFrog 3.10.000

org.smartfrog.sfcore.common
Class BaseClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.smartfrog.sfcore.common.BaseClassLoader
Direct Known Subclasses:
URLClassLoader

public class BaseClassLoader
extends java.lang.ClassLoader

Basic class loader functionality. Provides system class lookups only. Hook methods are provided for subclasses to provide different mechanisms to locate a Class or its defining bytes.


Constructor Summary
BaseClassLoader()
          Constructor.
 
Method Summary
protected  java.lang.Class findClass(java.lang.String className)
          Hook method to locate a given class.
protected  byte[] findClassBytes(java.lang.String className)
          This classloaded expects to find everything using the primordial classloader, so this always throws an IOException.
 java.lang.Class loadClass(java.lang.String className)
          Overriden to forward to the expanded method with resolve set to true, since clients will generally want to resolve all their classes before returning.
 java.lang.Class loadClass(java.lang.String className, boolean resolveIt)
          Main method to locate or load a given class.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, 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
 

Constructor Detail

BaseClassLoader

public BaseClassLoader()
Constructor.

Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException
Overriden to forward to the expanded method with resolve set to true, since clients will generally want to resolve all their classes before returning.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - class to load
Returns:
requested class
Throws:
java.lang.ClassNotFoundException - class not found

loadClass

public java.lang.Class loadClass(java.lang.String className,
                                 boolean resolveIt)
                          throws java.lang.ClassNotFoundException
Main method to locate or load a given class. Calls findClass to locate a Class first, it not found calls findClassBytes to see it defining bytes can be downloaded from somewhere. If defined from bytes the class is maintained in an internal table.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - class to locate or load
resolveIt - whether to resolve referred classes
Returns:
Class object
Throws:
java.lang.ClassNotFoundException - class not found

findClass

protected java.lang.Class findClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
Hook method to locate a given class. Looks in the maintained classes table to locate a previously loaded class. Then asks primordial classloader to load class.

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
className - class to locate
Returns:
requested class; from table or system
Throws:
java.lang.ClassNotFoundException - class not found

findClassBytes

protected byte[] findClassBytes(java.lang.String className)
                         throws java.io.IOException
This classloaded expects to find everything using the primordial classloader, so this always throws an IOException. Subclasses can implement this method to locate defining bytes elsewhere (eg. at a URL)

Parameters:
className - class to find bytes for
Returns:
bytes defining class
Throws:
java.io.IOException - error while trying to locate or load bytes

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP