de.uni_paderborn.fujaba.basic
Class UnifiedClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byde.uni_paderborn.fujaba.basic.UnifiedClassLoader

public class UnifiedClassLoader
extends java.lang.ClassLoader

A ClassLoader that unifies all available UPBClassLoaders (all plugins)

Version:
$Revision: 1.5 $
Author:
$Author: schneider $

Nested Class Summary
 
Nested classes inherited from class java.lang.ClassLoader
 
Field Summary
private static java.lang.ClassLoader instance
          the only instance of this class
 
Fields inherited from class java.lang.ClassLoader
 
Constructor Summary
private UnifiedClassLoader()
          ensures that no instances can be created by other classes
 
Method Summary
 java.net.URL findResource(java.lang.String name)
          Finds the resource with the given name.
static java.lang.ClassLoader get()
           
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
          Loads the class with the specified name.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, 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
 

Field Detail

instance

private static java.lang.ClassLoader instance
the only instance of this class

Constructor Detail

UnifiedClassLoader

private UnifiedClassLoader()
ensures that no instances can be created by other classes

Method Detail

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
Loads the class with the specified name. The implementation of this method searches for classes in the following order:

  1. call UPBClassLoader.get().loadClass( name, resolve )
  2. Iterate through plugin ClassLoaders and call loadClass( name, resolve )

Parameters:
name - the name of the class
resolve - if true then resolve the class
Returns:
the resulting Class object
Throws:
java.lang.ClassNotFoundException - if the class could not be found

findResource

public java.net.URL findResource(java.lang.String name)
Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

The name of a resource is a "/"-separated path name that identifies the resource.

This method will first search the UPBClassLoader for the resource; That failing, this method will call getResource( name ) of all plugin class loaders.

Parameters:
name - resource name
Returns:
a URL for reading the resource, or null if the resource could not be found or the caller doesn't have adequate privileges to get the resource.
Since:
JDK1.1
See Also:
findResource(String)

get

public static java.lang.ClassLoader get()
Returns:
an instance of ClassLoader that has the UnifiedClassLoader behaviour