com.metamatrix.common.classloader
Class NonDelegatingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by com.metamatrix.common.classloader.NonDelegatingClassLoader
Direct Known Subclasses:
URLFilteringClassLoader

public class NonDelegatingClassLoader
extends java.net.URLClassLoader

This Class circumvents the java ClassLoader delegation model. This ClassLoader will first look in it's own store of classes, and only then check it's parent ClassLoader, which is the reverse of the delegation model.


Constructor Summary
NonDelegatingClassLoader(java.net.URL[] urls)
           
NonDelegatingClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
           
NonDelegatingClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent, java.net.URLStreamHandlerFactory factory)
           
 
Method Summary
 java.net.URL getResource(java.lang.String name)
          By overriding this method, this Class circumvents the java ClassLoader delegation model.
 java.lang.Class loadClass(java.lang.String name)
          By overriding this method, this Class circumvents the java ClassLoader delegation model.
 
Methods inherited from class java.net.URLClassLoader
addURL, 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
 

Constructor Detail

NonDelegatingClassLoader

public NonDelegatingClassLoader(java.net.URL[] urls,
                                java.lang.ClassLoader parent)

NonDelegatingClassLoader

public NonDelegatingClassLoader(java.net.URL[] urls,
                                java.lang.ClassLoader parent,
                                java.net.URLStreamHandlerFactory factory)

NonDelegatingClassLoader

public NonDelegatingClassLoader(java.net.URL[] urls)
Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
By overriding this method, this Class circumvents the java ClassLoader delegation model. This ClassLoader will first look in it's own store of classes, and only then check it's parent ClassLoader, which is the reverse of the delegation model.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - The name of the class to load
Returns:
Class loaded Class object
Throws:
java.lang.ClassNotFoundException
See Also:
ClassLoader.loadClass(java.lang.String)

getResource

public java.net.URL getResource(java.lang.String name)
By overriding this method, this Class circumvents the java ClassLoader delegation model. This ClassLoader will first look in it's own store of resources, and only then check it's parent ClassLoader, which is the reverse of the delegation model.

Overrides:
getResource in class java.lang.ClassLoader
Parameters:
name - The name of the resource to load
Returns:
URL of resource
See Also:
ClassLoader.getResource(java.lang.String)


Copyright © 2009. All Rights Reserved.