org.objectweb.jonas.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.loader.AbsModuleClassLoader
Direct Known Subclasses:
ClientClassLoader, EjbJarClassLoader, SimpleWebappClassLoader

public abstract class AbsModuleClassLoader
extends URLClassLoader

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

Author:
Guillaume Sauthier

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

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

AbsModuleClassLoader

public AbsModuleClassLoader(URL[] modules,
                            ClassLoader parent)
                     throws 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:
IOException - when Initialization fails.
Method Detail

init

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

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

addInRepository

protected void addInRepository(String location)
                        throws 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:
IOException - when constructed URL is malformed

addContentInRepository

protected void addContentInRepository(String location)
                               throws 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:
IOException - When a directory content cannot be explored. TODO test existence is now done in AbsModuleClassLoader

toString

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

getBases

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

getClasspath

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


Copyright © 2007 OW2 Consortium. All Rights Reserved.