edu.rice.cs.util.classloader
Class LimitingClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--edu.rice.cs.util.classloader.LimitingClassLoader

public class LimitingClassLoader
extends ClassLoader

A class loader that does nothing but allow, at runtime, classes to be put on a list of "do not load" classes, which will be rejected from loading, even if they are available.

Version:
$Id: LimitingClassLoader.java,v 1.3 2002/02/08 14:22:22 brianstoler Exp $

Inner classes inherited from class java.lang.ClassLoader
ClassLoader.NativeLibrary
 
Field Summary
private  List _restrictedList
           
 
Fields inherited from class java.lang.ClassLoader
bootstrapClassPath, classes, defaultDomain, defaultPermissions, getClassLoaderPerm, initialized, loadedLibraryNames, nativeLibraries, nativeLibraryContext, nocerts, package2certs, packages, parent, scl, sclSet, sys_paths, systemNativeLibraries, usr_paths
 
Constructor Summary
LimitingClassLoader(ClassLoader parent)
          Creates a LimitingClassLoader.
 
Method Summary
 void addToRestrictedList(String name)
           
 void clearRestrictedList()
           
protected  Class loadClass(String name, boolean resolve)
          Overrides ClassLoader.loadClass(String,boolean) to reject classes whose names are on the restricted list.
 
Methods inherited from class java.lang.ClassLoader
, addClass, check, checkCerts, checkPackageAccess, compareCerts, copyFrom, defineClass, defineClass, defineClass, defineClass0, definePackage, findBootstrapClass, findBootstrapClass0, findClass, findLibrary, findLoadedClass, findNative, findResource, findResources, findSystemClass, getBootstrapClassPath, getBootstrapResource, getBootstrapResources, getCallerClassLoader, getDefaultDomain, getGetClassLoaderPerm, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, initializePath, isAncestor, loadClass, loadClassInternal, loadLibrary, loadLibrary0, removeSystemClassLoader, resolveClass, resolveClass0, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_restrictedList

private List _restrictedList
Constructor Detail

LimitingClassLoader

public LimitingClassLoader(ClassLoader parent)
Creates a LimitingClassLoader.
Parameters:
parent - Parent class loader, which is used to load all classes not restricted from loading.
Method Detail

addToRestrictedList

public void addToRestrictedList(String name)

clearRestrictedList

public void clearRestrictedList()

loadClass

protected Class loadClass(String name,
                          boolean resolve)
                   throws ClassNotFoundException
Overrides ClassLoader.loadClass(String,boolean) to reject classes whose names are on the restricted list.
Overrides:
loadClass in class ClassLoader
Parameters:
name - Name of class to load
resolve - If true then resolve the class
Returns:
Class object for the loaded class
Throws:
ClassNotFoundException - if name is on the restricted list, or if the parent class loader couldn't find the class.