org.freecompany.brimstone.module
Class ModuleClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.freecompany.brimstone.module.DelegatingClassLoader
                  extended by org.freecompany.brimstone.module.ModuleClassLoader

public class ModuleClassLoader
extends DelegatingClassLoader

Extends the standard URLClassLoader implementation to expose functions for adding URL instances to the base URLClassLoader at runtime. It also supports adding a set of class collections to the loader using a Brimstone Module.


Field Summary
protected static java.util.logging.Logger logger
           
 
Fields inherited from class org.freecompany.brimstone.module.DelegatingClassLoader
notifier
 
Constructor Summary
ModuleClassLoader(Module module)
           
ModuleClassLoader(Module module, java.lang.ClassLoader parent)
           
ModuleClassLoader(java.net.URL url)
           
ModuleClassLoader(java.net.URL[] urls)
           
ModuleClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
           
ModuleClassLoader(java.net.URL url, java.lang.ClassLoader parent)
           
 
Method Summary
 void addModule(Module module)
          Adds a module definition to this class loader.
 void addUrl(java.net.URL url)
          Extends the default add method to support automatic resolution of module sources.
 
Methods inherited from class org.freecompany.brimstone.module.DelegatingClassLoader
addDelegate, dump, getResource, getResources, loadClass, pop, push, searching, shortName, skip, toString
 
Methods inherited from class java.net.URLClassLoader
addURL, 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, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

logger

protected static java.util.logging.Logger logger
Constructor Detail

ModuleClassLoader

public ModuleClassLoader(java.net.URL url)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

ModuleClassLoader

public ModuleClassLoader(java.net.URL url,
                         java.lang.ClassLoader parent)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

ModuleClassLoader

public ModuleClassLoader(java.net.URL[] urls)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

ModuleClassLoader

public ModuleClassLoader(java.net.URL[] urls,
                         java.lang.ClassLoader parent)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

ModuleClassLoader

public ModuleClassLoader(Module module)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

ModuleClassLoader

public ModuleClassLoader(Module module,
                         java.lang.ClassLoader parent)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

addUrl

public void addUrl(java.net.URL url)
Extends the default add method to support automatic resolution of module sources. If a URL provided to this method provides the location of a module descriptor, it will be loaded and encapsulated in a new class loader as a child of this one.

Overrides:
addUrl in class DelegatingClassLoader
Parameters:
url - the url to add to list of locations searched for classes.

addModule

public void addModule(Module module)
Adds a module definition to this class loader. This method adds all of the dependencies and components of the provided module into this class loader. TODO: This should behave like the addURL call and simply add a new ModuleClassLoader as a child.

Parameters:
module - the module to add to this class loader.