com.myarch.reloader
Class ExceptionCollectionController

java.lang.Object
  |
  +--com.myarch.reloader.ClassCollectionController
        |
        +--com.myarch.reloader.ExceptionCollectionController
All Implemented Interfaces:
LoadController

public class ExceptionCollectionController
extends ClassCollectionController

Allows for loading only the classes NOT listed with ExceptionCollectionController. In other words, all classes that can't be reloaded should be specified. You don't need to explicitly list java.lang classes, such as java.lang.Object. These classes throw SecurityException on the attempt to reload, so Reloader immediately passes them on to the parent loader.

If you choose not to specify java.lang classes, default JVM library (${java_home}/jre/lib/rt.jar) should be explicitly added to the classpath.

Author:
Alexander Ananiev

Constructor Summary
ExceptionCollectionController()
          Constructs a new ExceptionCollectionController with the empty class list.
ExceptionCollectionController(java.util.Collection classes)
          Constructs a new ExceptionCollectionController with the specified collection of classes.
ExceptionCollectionController(java.lang.String pClass)
          Constructs a new ExceptionCollectionController with a class list containing a single class.
 
Method Summary
 boolean isLoadByParentAllowed(java.lang.String className, java.lang.String mainClassName, java.lang.ClassLoader loader)
          Prohibits using parent loader for loadable classes.
 boolean isReloadAllowed(java.lang.String className, java.lang.String mainClassName, java.lang.ClassLoader loader)
          Returns true if a class is NOT among the classes in the class list
 
Methods inherited from class com.myarch.reloader.ClassCollectionController
addClass, getClasses, isClassFound, setClasses
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionCollectionController

public ExceptionCollectionController()
Constructs a new ExceptionCollectionController with the empty class list.

ExceptionCollectionController

public ExceptionCollectionController(java.util.Collection classes)
Constructs a new ExceptionCollectionController with the specified collection of classes.
Parameters:
classes - collection of classes that can't be re-loaded

ExceptionCollectionController

public ExceptionCollectionController(java.lang.String pClass)
Constructs a new ExceptionCollectionController with a class list containing a single class.
Parameters:
pClass - class name that can't be re-loaded
Method Detail

isReloadAllowed

public boolean isReloadAllowed(java.lang.String className,
                               java.lang.String mainClassName,
                               java.lang.ClassLoader loader)
Returns true if a class is NOT among the classes in the class list
Overrides:
isReloadAllowed in class ClassCollectionController
Parameters:
className - class name to load
mainClassName - name of the "main" class. Main class is a class passed as a parameter to Reloader.reload() method.
loader - the actual class loader used to load a class.
Returns:
true if class className is allowed to be loaded.

isLoadByParentAllowed

public boolean isLoadByParentAllowed(java.lang.String className,
                                     java.lang.String mainClassName,
                                     java.lang.ClassLoader loader)
Prohibits using parent loader for loadable classes. This ensures that the class is either loaded by the Reloader or ClassNotFoundException is thrown.
Overrides:
isLoadByParentAllowed in class ClassCollectionController
Parameters:
className - class name to load
mainClassName - name of the "main" class. Main class is a class passed as a parameter to Reloader.reload() method.
loader - the actual class loader used to load a class (parent loader).
Returns:
false all the time to prohibit using the parent loader.


Copyright © 2001 Alexander Ananiev & MyArch.com. All Rights Reserved.