org.openorb.util.launcher
Class LibraryClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--java.security.SecureClassLoader
              |
              +--java.net.URLClassLoader
                    |
                    +--org.openorb.util.launcher.LibraryClassLoader
Direct Known Subclasses:
ProjectClassLoader

public class LibraryClassLoader
extends URLClassLoader

A generic class loader using directory scans to add libraries to th class path.

Version:
$Revision: 1.5 $ $Date: 2004/02/03 23:25:32 $
Author:
Richard G Clark

Inner Class Summary
static class LibraryClassLoader.PostfixFileFilter
          A FileFilter that accepts files with a specified postfix.
 
Field Summary
static FileFilter ACCEPT_ALL_FILE_FILTER
          A FileFilter that accepts any file.
static FileFilter JAR_FILE_FILTER
          A FileFilter that accepts any file with.
static FileFilter REJECT_ALL_FILE_FILTER
          A FileFilter that accepts no file.
 
Constructor Summary
LibraryClassLoader(File[] roots, ClassLoader parent, FileFilter libraryFilter, FileFilter recursiveFilter, boolean dynamicRescan)
          Constructs this to search the specified roots for libraries matching the filter.
LibraryClassLoader(File[] roots, FileFilter libraryFilter, FileFilter recursiveFilter, boolean dynamicRescan)
          Constructs this to search the specified roots for libraries matching the filter.
 
Method Summary
protected  Class findClass(String className)
          Finds the specified class.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_ALL_FILE_FILTER

public static final FileFilter ACCEPT_ALL_FILE_FILTER
A FileFilter that accepts any file.

REJECT_ALL_FILE_FILTER

public static final FileFilter REJECT_ALL_FILE_FILTER
A FileFilter that accepts no file.

JAR_FILE_FILTER

public static final FileFilter JAR_FILE_FILTER
A FileFilter that accepts any file with.
Constructor Detail

LibraryClassLoader

public LibraryClassLoader(File[] roots,
                          FileFilter libraryFilter,
                          FileFilter recursiveFilter,
                          boolean dynamicRescan)
Constructs this to search the specified roots for libraries matching the filter.
Parameters:
roots - the root files to search
libraryFilter - used to identify library files
recursiveFilter - used to determine which directories to recursively traverse
dynamicRescan - indicates if the roots should be rescanned if a class could not be found

LibraryClassLoader

public LibraryClassLoader(File[] roots,
                          ClassLoader parent,
                          FileFilter libraryFilter,
                          FileFilter recursiveFilter,
                          boolean dynamicRescan)
Constructs this to search the specified roots for libraries matching the filter.
Parameters:
roots - the root files to search
parent - the parent class loader to use
libraryFilter - used to identify library files
recursiveFilter - used to determine which directories to recursively traverse
dynamicRescan - indicates if the roots should be rescanned if a class could not be found
Method Detail

findClass

protected Class findClass(String className)
                   throws ClassNotFoundException
Finds the specified class. If dynamic scanning is enabled then the roots will be rescanned before throwing an exception.
Overrides:
findClass in class URLClassLoader
Parameters:
className - the name of the class
Returns:
the resulting Class object
Throws:
ClassNotFoundException - if the class could not be found