com.metamatrix.common.classloader
Class ClassLoaderUtil

java.lang.Object
  extended by com.metamatrix.common.classloader.ClassLoaderUtil

public class ClassLoaderUtil
extends java.lang.Object

Utility methods for dealing with class loaders. For now, this code is located here so that the class loading driver code will not reference anything in other packages.


Field Summary
static boolean debug
           
 
Constructor Summary
ClassLoaderUtil()
           
 
Method Summary
static java.lang.String getClassLoaderInformation(java.lang.ClassLoader classLoader, java.lang.String label)
          Walk through the chain of class loaders, printing information about where each will load classes from (if they are subclasses of URLClassLoader).
static java.lang.Object getInstanceInNewClassLoader(java.lang.String className, java.lang.String classPath)
          Create an instance of the specified class (using the default constructor) in a new class loader defined by the provided class path.
static void printLoadedClasses(java.lang.ClassLoader classLoader, java.io.PrintStream stream)
          This method assumes implementation knowledge of the class loaders (it accesses a private field in java.lang.ClassLoader).
static java.lang.String readResource(java.lang.String resourceName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

ClassLoaderUtil

public ClassLoaderUtil()
Method Detail

getClassLoaderInformation

public static java.lang.String getClassLoaderInformation(java.lang.ClassLoader classLoader,
                                                         java.lang.String label)
Walk through the chain of class loaders, printing information about where each will load classes from (if they are subclasses of URLClassLoader).


getInstanceInNewClassLoader

public static java.lang.Object getInstanceInNewClassLoader(java.lang.String className,
                                                           java.lang.String classPath)
Create an instance of the specified class (using the default constructor) in a new class loader defined by the provided class path. The new class loader's parent will be the extension class loader.


readResource

public static java.lang.String readResource(java.lang.String resourceName)

printLoadedClasses

public static void printLoadedClasses(java.lang.ClassLoader classLoader,
                                      java.io.PrintStream stream)
This method assumes implementation knowledge of the class loaders (it accesses a private field in java.lang.ClassLoader).



Copyright © 2009. All Rights Reserved.