org.apache.cocoon.components.classloader
Class RepositoryClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.apache.cocoon.components.classloader.RepositoryClassLoader
All Implemented Interfaces:
LogEnabled

public class RepositoryClassLoader
extends URLClassLoader
implements LogEnabled

A class loader with a growable list of path search directories. BL: Changed to extend URLClassLoader for both maintenance and compatibility reasons. It doesn't hurt that it runs quicker now as well.

Version:
$Id: RepositoryClassLoader.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha, Berin Loritsch

Field Summary
protected  Logger log
          The logger
 
Constructor Summary
  RepositoryClassLoader()
          Create an empty new class loader.
protected RepositoryClassLoader(Collection repositories)
          Create a class loader from a list of directories
  RepositoryClassLoader(URL[] urls)
          Create an empty new class loader.
  RepositoryClassLoader(URL[] urls, ClassLoader parentClassLoader)
          Create an empty new class loader.
protected RepositoryClassLoader(Vector repositories)
          Create a class loader from a list of directories
 
Method Summary
 void addDirectory(File repository)
          Add a directory to the list of searchable repositories.
 void addDirectory(String repository)
          Add a directory to the list of searchable repositories.
 void addURL(URL url)
          Add a url to the list of searchable repositories
 Class defineClass(byte[] b)
          Create a Class from a byte array
 void enableLogging(Logger logger)
          Provide component with a logger.
 
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
 

Field Detail

log

protected Logger log
The logger

Constructor Detail

RepositoryClassLoader

public RepositoryClassLoader()
Create an empty new class loader.


RepositoryClassLoader

public RepositoryClassLoader(URL[] urls)
Create an empty new class loader.


RepositoryClassLoader

public RepositoryClassLoader(URL[] urls,
                             ClassLoader parentClassLoader)
Create an empty new class loader.


RepositoryClassLoader

protected RepositoryClassLoader(Vector repositories)
Create a class loader from a list of directories

Parameters:
repositories - List of searchable directories

RepositoryClassLoader

protected RepositoryClassLoader(Collection repositories)
Create a class loader from a list of directories

Parameters:
repositories - List of searchable directories
Method Detail

enableLogging

public void enableLogging(Logger logger)
Provide component with a logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger - the logger

addDirectory

public void addDirectory(File repository)
                  throws IOException
Add a directory to the list of searchable repositories. This methods ensures that no directory is specified more than once.

Parameters:
repository - The directory path
Throws:
IOException - Non-existent, non-readable or non-directory repository

addDirectory

public void addDirectory(String repository)
                  throws IOException
Add a directory to the list of searchable repositories. This methods ensures that no directory is specified more than once.

Parameters:
repository - The directory path
Throws:
IOException - Non-existent, non-readable or non-directory repository

addURL

public void addURL(URL url)
Add a url to the list of searchable repositories

Overrides:
addURL in class URLClassLoader

defineClass

public Class defineClass(byte[] b)
                  throws ClassFormatError
Create a Class from a byte array

Throws:
ClassFormatError


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.