This project has retired. For details please refer to its Attic page.
DefaultClassLoader (Cocoon Sitemap Implementation 1.0.0 API)

org.apache.cocoon.classloader
Class DefaultClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.apache.cocoon.classloader.DefaultClassLoader

public class DefaultClassLoader
extends URLClassLoader

This class loader reverses the search order for classes. It checks this classloader before it checks its parent. In addition it can be configured with includes and excludes.

Since:
2.2
Version:
$Id: DefaultClassLoader.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  List excludes
           
protected  List includes
           
 
Constructor Summary
DefaultClassLoader(URL[] urls, List includePatterns, List excludePatterns, ClassLoader parent)
          Alternate constructor to define a parent and initial URL s.
DefaultClassLoader(URL[] urls, List includePatterns, List excludePatterns, ClassLoader parent, URLStreamHandlerFactory factory)
          Alternate constructor to define a parent, initial URLs, and a default URLStreamHandlerFactory.
 
Method Summary
 void addDirectory(File file)
          Adds a new directory of class files.
 void addURL(URL url)
          Adds a new URL
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
definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, 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

includes

protected final List includes

excludes

protected final List excludes
Constructor Detail

DefaultClassLoader

public DefaultClassLoader(URL[] urls,
                          List includePatterns,
                          List excludePatterns,
                          ClassLoader parent)
Alternate constructor to define a parent and initial URL s.


DefaultClassLoader

public DefaultClassLoader(URL[] urls,
                          List includePatterns,
                          List excludePatterns,
                          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.

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.

Parameters:
name - of resource

addDirectory

public final void addDirectory(File file)
                        throws IOException
Adds a new directory of class files.

Parameters:
file - for jar or directory
Throws:
IOException

addURL

public void addURL(URL url)
Adds a new URL



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