com.werken.forehead
Class ForeheadClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by com.werken.forehead.ForeheadClassLoader

public class ForeheadClassLoader
extends java.net.URLClassLoader

Named, dynamically modifiable ClassLoader implementation.

Author:
bob mcwhirter, Jason van Zyl
See Also:
Forehead

Field Summary
static java.net.URL[] EMPTY_URL_ARRAY
          Simple empty URL[0] array.
private  java.lang.String name
          The name of this loader.
 
Constructor Summary
ForeheadClassLoader(java.lang.ClassLoader parent, java.lang.String name)
          Construct given a parent and a name.
 
Method Summary
 void addRepository(java.io.File repository)
          Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
 void addRepository(java.lang.String repository)
          Add a new repository to the set of places this ClassLoader can look for classes to be loaded.
 void addURL(java.net.URL url)
          Append a URL to this loader's search path.
 java.lang.String getName()
          Retrieve the name of this ClassLoader.
 java.lang.String getResourceAsString(java.lang.String name)
          Find the resource with the given name, and return a String.
 java.lang.String toString()
          Produce output suitable for debugging.
 
Methods inherited from class java.net.URLClassLoader
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, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_URL_ARRAY

public static final java.net.URL[] EMPTY_URL_ARRAY
Simple empty URL[0] array.


name

private java.lang.String name
The name of this loader.

Constructor Detail

ForeheadClassLoader

public ForeheadClassLoader(java.lang.ClassLoader parent,
                           java.lang.String name)
Construct given a parent and a name.

Parameters:
parent - The parent loader.
name - The name of this loader.
Method Detail

getName

public java.lang.String getName()
Retrieve the name of this ClassLoader.

Returns:
The name of this loader.

addURL

public void addURL(java.net.URL url)
Append a URL to this loader's search path.

Overrides:
addURL in class java.net.URLClassLoader
Parameters:
url - The URL to append.

toString

public java.lang.String toString()
Produce output suitable for debugging.

Overrides:
toString in class java.lang.Object
Returns:
Output suitable for debugging.

getResourceAsString

public java.lang.String getResourceAsString(java.lang.String name)
Find the resource with the given name, and return a String. The search order is as described for getResource(), after checking to see if the resource data has been previously cached. If the resource cannot be found, return null.

Parameters:
name - Name of the resource to return a String for.

addRepository

public void addRepository(java.lang.String repository)
Add a new repository to the set of places this ClassLoader can look for classes to be loaded.

Parameters:
repository - Name of a source of classes to be loaded, such as a directory pathname, a JAR file pathname, or a ZIP file pathname. The parameter must be in the form of an URL.
Throws:
java.lang.IllegalArgumentException - if the specified repository is invalid or does not exist

addRepository

public void addRepository(java.io.File repository)
Add a new repository to the set of places this ClassLoader can look for classes to be loaded.

Parameters:
repository - Name of a source of classes to be loaded, such as a directory pathname, a JAR file pathname, or a ZIP file pathname. The parameter must be in the form of an URL.
Throws:
java.lang.IllegalArgumentException - if the specified repository is invalid or does not exist