org.apache.cocoon.maven.deployer.servlet
Class ShieldedClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.apache.cocoon.maven.deployer.servlet.ShieldedClassLoader

public class ShieldedClassLoader
extends URLClassLoader

This class loader reverses the search order for classes. It checks this classloader before it checks its parent.

Version:
$Id: ShieldedClassLoader.html 1351235 2012-06-18 08:41:39Z ilgrosso $

Constructor Summary
ShieldedClassLoader(URL[] urls, ClassLoader parent)
          Alternate constructor to define a parent and initial URLs.
ShieldedClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
          Alternate constructor to define a parent, initial URLs, and a default URLStreamHandlerFactory.
 
Method Summary
protected  Class getClass(String name)
           
 URL getResource(String name)
          Gets a resource from this ClassLoader.
 Class loadClass(String name, boolean resolve)
          Loads the class from this ClassLoader.
protected  boolean tryClassHere(String name)
           
 
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

ShieldedClassLoader

public ShieldedClassLoader(URL[] urls,
                           ClassLoader parent)
Alternate constructor to define a parent and initial URLs.


ShieldedClassLoader

public ShieldedClassLoader(URL[] urls,
                           ClassLoader parent,
                           URLStreamHandlerFactory factory)
Alternate constructor to define a parent, initial URLs, and a default URLStreamHandlerFactory.

Method Detail

tryClassHere

protected boolean tryClassHere(String name)

getClass

protected Class getClass(String name)
                  throws ClassNotFoundException
Throws:
ClassNotFoundException

loadClass

public final Class loadClass(String name,
                             boolean resolve)
                      throws ClassNotFoundException
Loads the class from this ClassLoader. If the class does not exist in this one, we check the parent. Please note that this is the exact opposite of the ClassLoader spec. We use it to work around inconsistent class loaders from third party vendors.

Overrides:
loadClass in class ClassLoader
Parameters:
name - the name of the class
resolve - if true then resolve the class
Returns:
the resulting Class object
Throws:
ClassNotFoundException - if the class could not be found

getResource

public final URL getResource(String name)
Gets a resource from this ClassLoader. If the resource does not exist in this one, we check the parent. Please note that this is the exact opposite of the ClassLoader spec. We use it to work around inconsistent class loaders from third party vendors.

Overrides:
getResource in class ClassLoader
Parameters:
name - of resource


Copyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.