JXTA

net.jxta.platform
Class JxtaLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by net.jxta.platform.JxtaLoader

public abstract class JxtaLoader
extends URLClassLoader

A ClassLoader which provides additional JXTA functionality. You can load classes by ModuleSpecID. Classes are defined with ModuleImplAdvertisements and class loading will determine suitability using the provided compatibility statements.


Constructor Summary
JxtaLoader(ClassLoader parent)
          Construct a new loader with the specified parent loader and
JxtaLoader(URL[] urls, ClassLoader parent)
          Construct a new loader for the specified URLS with the specified parent loader.
 
Method Summary
 void addURL(URL url)
          
abstract  Class<? extends Module> defineClass(ModuleImplAdvertisement impl)
          Defines a new class from a Module Impl Advertisement.
abstract  Class<? extends Module> findClass(ModuleSpecID spec)
          Finds and loads the class with the specified spec ID from the URL search path.
abstract  ModuleImplAdvertisement findModuleImplAdvertisement(Class<? extends Module> clazz)
          Finds the ModuleImplAdvertisement for the associated class in the context of this ClassLoader.
abstract  ModuleImplAdvertisement findModuleImplAdvertisement(ModuleSpecID msid)
          Finds the ModuleImplAdvertisement for the associated class in the context of this ClassLoader.
abstract  Class<? extends Module> loadClass(ModuleSpecID spec)
          Loads the class with the specified spec ID from the URL search path.
 
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, toString, wait, wait, wait
 

Constructor Detail

JxtaLoader

public JxtaLoader(ClassLoader parent)
Construct a new loader with the specified parent loader and

Parameters:
parent - the parent class loader for delegation.

JxtaLoader

public JxtaLoader(URL[] urls,
                  ClassLoader parent)
Construct a new loader for the specified URLS with the specified parent loader.

Parameters:
urls - the URLs from which to load classes and resources.
parent - the parent class loader for delegation.
Method Detail

addURL

public void addURL(URL url)

Overrides:
addURL in class URLClassLoader

findClass

public abstract Class<? extends Module> findClass(ModuleSpecID spec)
                                           throws ClassNotFoundException
Finds and loads the class with the specified spec ID from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found.

Parameters:
spec - the specid of the class to load.
Returns:
the resulting class.
Throws:
ClassNotFoundException - if the class could not be found.

loadClass

public abstract Class<? extends Module> loadClass(ModuleSpecID spec)
                                           throws ClassNotFoundException
Loads the class with the specified spec ID from the URL search path.

Parameters:
spec - the specid of the class to load.
Returns:
the resulting class.
Throws:
ClassNotFoundException - if the class could not be found.

defineClass

public abstract Class<? extends Module> defineClass(ModuleImplAdvertisement impl)
Defines a new class from a Module Impl Advertisement.

Parameters:
impl - The moduleImplAdvertisement containing the class specification
Returns:
The Class object that was created from the specified class data.

findModuleImplAdvertisement

public abstract ModuleImplAdvertisement findModuleImplAdvertisement(Class<? extends Module> clazz)
Finds the ModuleImplAdvertisement for the associated class in the context of this ClassLoader.

Parameters:
clazz - The class who's ModuleImplAdvertisement is desired.
Returns:
The matching ModuleImplAdvertisement otherwise null if there is no known association.

findModuleImplAdvertisement

public abstract ModuleImplAdvertisement findModuleImplAdvertisement(ModuleSpecID msid)
Finds the ModuleImplAdvertisement for the associated class in the context of this ClassLoader.

Parameters:
msid - The module spec id who's ModuleImplAdvertisement is desired.
Returns:
The matching ModuleImplAdvertisement otherwise null if there is no known association.

JXSE