org.apache.cocoon.components.classloader
Class ClassLoaderManagerImpl

java.lang.Object
  extended by org.apache.cocoon.components.classloader.ClassLoaderManagerImpl
All Implemented Interfaces:
Disposable, Component, ThreadSafe, ClassLoaderManager
Direct Known Subclasses:
NonStaticClassLoaderManager

public class ClassLoaderManagerImpl
extends Object
implements ClassLoaderManager, ThreadSafe, Disposable

A singleton-like implementation of ClassLoaderManager

Version:
$Id: ClassLoaderManagerImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha

Field Summary
protected  Set fileSet
          Set of class directories
 
Fields inherited from interface org.apache.cocoon.components.classloader.ClassLoaderManager
ROLE
 
Constructor Summary
ClassLoaderManagerImpl()
          A constructor that ensures only a single class loader instance exists
 
Method Summary
 void addDirectory(File directoryName)
          Add a directory to the proxied class loader
 void dispose()
           
 Class loadClass(String className)
          Load a class through the proxied class loader
 void reinstantiate()
          Reinstantiate the proxied class loader to allow for class reloading
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileSet

protected final Set fileSet
Set of class directories

Constructor Detail

ClassLoaderManagerImpl

public ClassLoaderManagerImpl()
A constructor that ensures only a single class loader instance exists

Method Detail

dispose

public void dispose()
Specified by:
dispose in interface Disposable

addDirectory

public void addDirectory(File directoryName)
                  throws IOException
Add a directory to the proxied class loader

Specified by:
addDirectory in interface ClassLoaderManager
Parameters:
directoryName - The repository name
Throws:
IOException - If the directory is invalid

loadClass

public Class loadClass(String className)
                throws ClassNotFoundException
Load a class through the proxied class loader

Specified by:
loadClass in interface ClassLoaderManager
Parameters:
className - The name of the class to be loaded
Returns:
The loaded class
Throws:
ClassNotFoundException - If the class is not found

reinstantiate

public void reinstantiate()
Reinstantiate the proxied class loader to allow for class reloading

Specified by:
reinstantiate in interface ClassLoaderManager


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