Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.util
Class BundleDelegatingClassLoader

    java.lang.Object
      java.lang.ClassLoader
          org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader

    public class BundleDelegatingClassLoader

extends ClassLoader

ClassLoader backed by an OSGi bundle. Provides the ability to use a separate class loader as fall back. Contains facilities for tracing class loading behaviour so that issues can be easily resolved. For debugging please see `DebugUtils`.

Author:
  Adrian Colyer, Andy Piper, Costin Leau

Constructor Summary
`protected` | `BundleDelegatingClassLoader(org.osgi.framework.Bundle bundle, ClassLoader bridgeLoader)` Private constructor.

Method Summary
`static BundleDelegatingClassLoader` | `createBundleClassLoaderFor(org.osgi.framework.Bundle aBundle)` Factory method for creating a class loader over the given bundle.
`static BundleDelegatingClassLoader` | `createBundleClassLoaderFor(org.osgi.framework.Bundle bundle, ClassLoader bridge)` Factory method for creating a class loader over the given bundle and with a given class loader as fall-back.
`protected Class<?>` | `findClass(String name)`
`protected URL` | `findResource(String name)`
`protected Enumeration<URL>` | `findResources(String name)`
`org.osgi.framework.Bundle` | `getBundle()` Returns the bundle to which this class loader delegates calls to.
`URL` | `getResource(String name)`
`protected Class<?>` | `loadClass(String name, boolean resolve)`
`String` | `toString()`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

### BundleDelegatingClassLoader

    protected BundleDelegatingClassLoader(org.osgi.framework.Bundle bundle,
                                          ClassLoader bridgeLoader)

  Private constructor. Constructs a new `BundleDelegatingClassLoader` instance.

  Parameters:
    `bundle` -
    `bridgeLoader` -

Method Detail

### createBundleClassLoaderFor

    public static BundleDelegatingClassLoader createBundleClassLoaderFor(org.osgi.framework.Bundle aBundle)

  Factory method for creating a class loader over the given bundle.

  Parameters:
    `aBundle` - bundle to use for class loading and resource acquisition
  Returns:
    class loader adapter over the given bundle

### createBundleClassLoaderFor

    public static BundleDelegatingClassLoader createBundleClassLoaderFor(org.osgi.framework.Bundle bundle,
                                                                         ClassLoader bridge)

  Factory method for creating a class loader over the given bundle and with a given class loader as fall-back. In case the bundle cannot find a class or locate a resource, the given class loader will be used as fall back.

  Parameters:
    `bundle` - bundle used for class loading and resource acquisition
    `bridge` - class loader used as fall back in case the bundle cannot load a class or find a resource. Can be `null`
  Returns:
    class loader adapter over the given bundle and class loader

### findClass

    protected Class<?> findClass(String name)
                          throws ClassNotFoundException

  Overrides:
    `findClass` in class `ClassLoader`
  Throws:
    `ClassNotFoundException`

### findResource

    protected URL findResource(String name)

  Overrides:
    `findResource` in class `ClassLoader`

### findResources

    protected Enumeration<URL> findResources(String name)
                                      throws IOException

  Overrides:
    `findResources` in class `ClassLoader`
  Throws:
    `IOException`

### getResource

    public URL getResource(String name)

  Overrides:
    `getResource` in class `ClassLoader`

### loadClass

    protected Class<?> loadClass(String name,
                                 boolean resolve)
                          throws ClassNotFoundException

  Overrides:
    `loadClass` in class `ClassLoader`
  Throws:
    `ClassNotFoundException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getBundle

    public org.osgi.framework.Bundle getBundle()

  Returns the bundle to which this class loader delegates calls to.

  Returns:
    the backing bundle

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.