org.objectweb.jonas_lib.loader
Class AbsModuleClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.objectweb.jonas_lib.loader.AbsModuleClassLoader
Direct Known Subclasses:
ClientClassLoader, EjbJarClassLoader, SimpleWebappClassLoader

public abstract class AbsModuleClassLoader
extends java.net.URLClassLoader

The AbsModuleClassLoader class is used in JOnAS for loading web, ejbjars and client modules.

Author:
Guillaume Sauthier

Constructor Summary
AbsModuleClassLoader(java.net.URL[] modules)
          Create a new AbsModuleClassLoader for a list of URLs.
AbsModuleClassLoader(java.net.URL[] modules, java.lang.ClassLoader parent)
          Create a new AbsModuleClassLoader for a list of URLs with a specified parent loader.
 
Method Summary
protected  void addContentInRepository(java.lang.String location)
          Add specified location childs into the repository.
protected  void addInRepository(java.lang.String location)
          Add specified location into the repository.
 java.net.URL[] getBases()
           
 java.lang.String getClasspath()
           
protected  void init()
          Base Initialization of the ClassLoader, storage of URL list.
 java.lang.String 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, 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
 

Constructor Detail

AbsModuleClassLoader

public AbsModuleClassLoader(java.net.URL[] modules)
                     throws java.io.IOException
Create a new AbsModuleClassLoader for a list of URLs.

Parameters:
modules - the list of URL to be used in the ClassLoader.
Throws:
java.io.IOException - when Initialization fails.

AbsModuleClassLoader

public AbsModuleClassLoader(java.net.URL[] modules,
                            java.lang.ClassLoader parent)
                     throws java.io.IOException
Create a new AbsModuleClassLoader for a list of URLs with a specified parent loader.

Parameters:
modules - the list of URL to be used in the ClassLoader.
parent - the parent ClassLoader to be used.
Throws:
java.io.IOException - when Initialization fails.
Method Detail

init

protected void init()
             throws java.io.IOException
Base Initialization of the ClassLoader, storage of URL list.

Throws:
java.io.IOException - when URL pointed file is not supported (not an jar nor a directory).

addInRepository

protected void addInRepository(java.lang.String location)
                        throws java.io.IOException
Add specified location into the repository. If location is found in multiple URLs of the bases, new URLs will be added multiple times.

Parameters:
location - an entry name (for a jar) or a path name (for a directory)
Throws:
java.io.IOException - when constructed URL is malformed

addContentInRepository

protected void addContentInRepository(java.lang.String location)
                               throws java.io.IOException
Add specified location childs into the repository. Search will be performed on the bases URLs.

Parameters:
location - an entry name (for a jar) or a path name (for a directory)
Throws:
java.io.IOException - When a directory content cannot be explored. TODO test existence is now done in AbsModuleClassLoader

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
Returns a String representation of the AbsModuleClassLoader

getBases

public java.net.URL[] getBases()
Returns:
Returns the bases.

getClasspath

public java.lang.String getClasspath()
Returns:
Returns a String representation of the classpath used by this classloader