org.glassfish.osgijavaeebase
Class BundleClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.glassfish.osgijavaeebase.BundleClassLoader

public class BundleClassLoader
extends ClassLoader

This is a delegating class loader. It always delegates to OSGi bundle's class loader. ClassLoader.defineClass() is never called in the context of this class. There will never be a class for which getClassLoader() would return this class loader. It overrides loadClass(), getResource() and getResources() as opposed to their findXYZ() equivalents so that the OSGi export control mechanism is enforced even for classes and resources available in the system/boot class loader.

Author:
Sanjeeb.Sahoo@Sun.COM

Constructor Summary
BundleClassLoader(org.osgi.framework.Bundle b)
           
 
Method Summary
 URL getResource(String name)
           
 Enumeration<URL> getResources(String name)
           
 Class<?> loadClass(String name, boolean resolve)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleClassLoader

public BundleClassLoader(org.osgi.framework.Bundle b)
Method Detail

loadClass

public Class<?> loadClass(String name,
                          boolean resolve)
                   throws ClassNotFoundException
Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)
Overrides:
getResource in class ClassLoader

getResources

public Enumeration<URL> getResources(String name)
                              throws IOException
Overrides:
getResources in class ClassLoader
Throws:
IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.