org.apache.xbean.classloader
Class NamedClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.apache.xbean.classloader.NamedClassLoader
All Implemented Interfaces:
DestroyableClassLoader
Direct Known Subclasses:
MultiParentClassLoader

public class NamedClassLoader
extends URLClassLoader
implements DestroyableClassLoader

The NamedClassLoader is a simple extension to URLClassLoader that adds a name and a destroy method that cleans up the commons logging and JavaVM caches of the classloader.

Since:
2.0
Author:
Dain Sundstrom

Constructor Summary
NamedClassLoader(String name, URL[] urls)
          Creates a named class loader with no parents.
NamedClassLoader(String name, URL[] urls, ClassLoader parent)
          Creates a named class loader as a child of the specified parent.
NamedClassLoader(String name, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
          Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory for accessing the urls..
 
Method Summary
 void destroy()
          Destroys the clasloader releasing all resources.
 String getName()
          Gets the name of this class loader.
 boolean isDestroyed()
          Check if this classloader has been destroyed
 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

NamedClassLoader

public NamedClassLoader(String name,
                        URL[] urls)
Creates a named class loader with no parents.

Parameters:
name - the name of this class loader
urls - the urls from which this class loader will classes and resources

NamedClassLoader

public NamedClassLoader(String name,
                        URL[] urls,
                        ClassLoader parent)
Creates a named class loader as a child of the specified parent.

Parameters:
name - the name of this class loader
urls - the urls from which this class loader will classes and resources
parent - the parent of this class loader

NamedClassLoader

public NamedClassLoader(String name,
                        URL[] urls,
                        ClassLoader parent,
                        URLStreamHandlerFactory factory)
Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory for accessing the urls..

Parameters:
name - the name of this class loader
urls - the urls from which this class loader will classes and resources
parent - the parent of this class loader
factory - the URLStreamHandlerFactory used to access the urls
Method Detail

isDestroyed

public boolean isDestroyed()
Check if this classloader has been destroyed

Returns:

destroy

public void destroy()
Destroys the clasloader releasing all resources. After this mehtod is called, the class loader will no longer load any classes or resources.

Specified by:
destroy in interface DestroyableClassLoader

getName

public String getName()
Gets the name of this class loader.

Returns:
the name of this class loader

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.