Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.unittest.server
Class IsolatingDefaultSystemClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.hyperic.util.unittest.server.IsolatingDefaultSystemClassLoader

public class IsolatingDefaultSystemClassLoader
extends java.net.URLClassLoader

This classloader is used by the unit test framework to isolate jboss from the unit test framework classpath so that jboss may boot off its own resources instead of those residing on the classpath. This is achieved by setting this classloader as the system classloader with the java.system.class.loader system property. When the unit test framework vm is started, this classloader is substituted for the default system classloader containing the classpath. If set to isolate the default system classloader, this classloader will delegate all class/resource lookups to the parent of the default system classloader, effectively isolating the default system classloader from the jboss boot process.


Field Summary
static java.lang.ThreadLocal SHOULD_ISOLATE
           
 
Constructor Summary
IsolatingDefaultSystemClassLoader(java.lang.ClassLoader parent)
          This constructor is required when registering this classloader as the system classloader.
 
Method Summary
 void addURL(java.net.URL url)
          Appends the specified URL to the list of URLs to search for classes and resources.
 java.lang.ClassLoader getEJBClassLoader()
           
 java.net.URL getResource(java.lang.String resName)
          If the current thread is set to isolate the default system classloader, then delegate resource lookups to the parent of the default system classloader before looking in this classloader for the resource.
protected  java.lang.Class loadClass(java.lang.String className, boolean resolveClass)
          If the current thread is set to isolate the default system classloader, then delegate class loads to the parent of the default system classloader before loading the class from this classloader.
 void registerEJBClassLoader(java.lang.ClassLoader classLoader)
          Register the EJB deployer classloader.
 void setIsolateDefaultSystemClassloader()
          Set the current thread and all child threads to isolate the default system classloader by delegating class/resource lookups to the parent of the default system classloader.
 
Methods inherited from class java.net.URLClassLoader
definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, 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

SHOULD_ISOLATE

public static final java.lang.ThreadLocal SHOULD_ISOLATE
Constructor Detail

IsolatingDefaultSystemClassLoader

public IsolatingDefaultSystemClassLoader(java.lang.ClassLoader parent)
This constructor is required when registering this classloader as the system classloader.

Parameters:
parent - The parent classloader. Should be the default system classloader.
Method Detail

addURL

public void addURL(java.net.URL url)
Appends the specified URL to the list of URLs to search for classes and resources.

Overrides:
addURL in class java.net.URLClassLoader
Parameters:
url - the URL to be added to the search path of URLs

setIsolateDefaultSystemClassloader

public void setIsolateDefaultSystemClassloader()
Set the current thread and all child threads to isolate the default system classloader by delegating class/resource lookups to the parent of the default system classloader.


getResource

public java.net.URL getResource(java.lang.String resName)
If the current thread is set to isolate the default system classloader, then delegate resource lookups to the parent of the default system classloader before looking in this classloader for the resource. Otherwise, use the standard delegation algorithm that looks in the parent classloader first.

Overrides:
getResource in class java.lang.ClassLoader
See Also:
ClassLoader.getResource(java.lang.String)

loadClass

protected java.lang.Class loadClass(java.lang.String className,
                                    boolean resolveClass)
                             throws java.lang.ClassNotFoundException
If the current thread is set to isolate the default system classloader, then delegate class loads to the parent of the default system classloader before loading the class from this classloader. Otherwise, use the standard delegation algorithm that loads from the parent classloader first.

Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException
See Also:
ClassLoader.loadClass(java.lang.String, boolean)

registerEJBClassLoader

public void registerEJBClassLoader(java.lang.ClassLoader classLoader)
Register the EJB deployer classloader.

Parameters:
classLoader - The EJB deployer classloader.

getEJBClassLoader

public java.lang.ClassLoader getEJBClassLoader()
Returns:
The registered EJB deployer classloader.

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.