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.context.support.internal.classloader
Class ChainedClassLoader

    java.lang.Object
      java.lang.ClassLoader
          org.eclipse.gemini.blueprint.context.support.internal.classloader.ChainedClassLoader

    public class ChainedClassLoader

extends ClassLoader

Chaining class loader implementation that delegates the resource and class loading to a number of class loaders passed in.

This class loader parent (by default the AppClassLoader) can be specified and will be added automatically as the last entry in the list.

Additionally, the class space of this class loader can be extended at runtime (by allowing more class loaders to be added). Note:non-OSGi class loaders are considered as special cases. As there are classes that are loaded by the Boot, Ext, App and Fwk ClassLoaders through boot delegation, this implementation tries to identify them and place them last in the chain. Otherwise, these loaders can pull in classes from outside OSGi causing `ClassCastException`s.

Author:
  Costin Leau

Constructor Summary
`ChainedClassLoader(ClassLoader[] loaders)` Constructs a new `ChainedClassLoader` instance.
`ChainedClassLoader(ClassLoader[] loaders, ClassLoader parent)` Constructs a new `ChainedClassLoader` instance.

Method Summary
`void` | `addClassLoader(Class<?> clazz)` Adds a class loader defining the given class, to the chained class loader space.
`void` | `addClassLoader(ClassLoader classLoader)` Adds the given class loader to the existing list.
`URL` | `getResource(String name)`
`Class<?>` | `loadClass(String name)`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, 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, toString, wait, wait, wait`

Constructor Detail

### ChainedClassLoader

    public ChainedClassLoader(ClassLoader[] loaders)

  Constructs a new `ChainedClassLoader` instance. Equivalent to `ChainedClassLoader(ClassLoader[], ClassLoader)` with the parent class loader initialized to the AppClassLoader (practically the system bundle class loader). Note that the AppClassLoader can be different then the `ClassLoader.getSystemClassLoader()`, used by `ChainedClassLoader(ClassLoader[], ClassLoader)` if no parent is specified.

  Parameters:
    `loaders` - array of non-null class loaders

### ChainedClassLoader

    public ChainedClassLoader(ClassLoader[] loaders,
                              ClassLoader parent)

  Constructs a new `ChainedClassLoader` instance.

  Parameters:
    `loaders` - array of non-null class loaders
    `parent` - parent class loader (can be null)

Method Detail

### getResource

    public URL getResource(String name)

  Overrides:
    `getResource` in class `ClassLoader`

### loadClass

    public Class<?> loadClass(String name)
                       throws ClassNotFoundException

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

### addClassLoader

    public void addClassLoader(Class<?> clazz)

  Adds a class loader defining the given class, to the chained class loader space.

  Parameters:
    `clazz` -

### addClassLoader

    public void addClassLoader(ClassLoader classLoader)

  Adds the given class loader to the existing list.

  Parameters:
    `classLoader` - class loader to load classes from

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-2013. All Rights Reserved.