org.sapia.clazzy
Class CompositeClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by org.sapia.clazzy.BaseClassLoader
              extended by org.sapia.clazzy.CompositeClassLoader
All Implemented Interfaces:
Consts

public class CompositeClassLoader
extends BaseClassLoader
implements Consts

This classloader delegates class lookups the Loader instances that it encapsulates. Children are added through the addLoader() or addFile method.

The CompositeClassLoaderBuilder can conveniently be used to create an instance of this class.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2004 Sapia Open Source Software . All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
CompositeClassLoaderBuilder

Field Summary
 
Fields inherited from interface org.sapia.clazzy.Consts
PACKAGE_IMPL_TITLE, PACKAGE_IMPL_VENDOR, PACKAGE_IMPL_VERSION, PACKAGE_SPEC_TITLE, PACKAGE_SPEC_VENDOR, PACKAGE_SPEC_VERSION
 
Constructor Summary
CompositeClassLoader(java.lang.ClassLoader parent, LoaderSelector selector)
           
CompositeClassLoader(LoaderSelector selector)
           
 
Method Summary
 void addLoader(Loader loader)
           
 void addPath(java.io.File file)
          Adds the file object corresponding to a directory of classes or a jar to this instance.
 void close()
          Releases all resources that this instance.
 java.lang.Class findClass(java.lang.String name)
           
protected  java.net.URL findResource(java.lang.String name)
           
 java.net.URL[] getURLs()
           
 
Methods inherited from class org.sapia.clazzy.BaseClassLoader
loadClass, setParentFirst
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, 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

CompositeClassLoader

public CompositeClassLoader(java.lang.ClassLoader parent,
                            LoaderSelector selector)

CompositeClassLoader

public CompositeClassLoader(LoaderSelector selector)
Method Detail

getURLs

public java.net.URL[] getURLs()
Returns:
the URLs to which this instance "points".

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException
See Also:
ClassLoader.findClass(java.lang.String)

findResource

protected java.net.URL findResource(java.lang.String name)
Overrides:
findResource in class java.lang.ClassLoader
See Also:
ClassLoader.findResource(java.lang.String)

addLoader

public void addLoader(Loader loader)
Parameters:
loader - the Loader to add to this instance.

addPath

public void addPath(java.io.File file)
Adds the file object corresponding to a directory of classes or a jar to this instance.

Internally, the method creates either a FileSystemLoader (if the given file object corresponds to a directory) or a JarLoader.

Parameters:
file - a File

close

public void close()
Releases all resources that this instance.



Copyright © 2011 Sapia OSS. All Rights Reserved.