org.eclipse.gemini.blueprint.context.support.internal.classloader
Class ClassLoaderFactory

java.lang.Object
  extended by org.eclipse.gemini.blueprint.context.support.internal.classloader.ClassLoaderFactory

public abstract class ClassLoaderFactory
extends Object

Simple factory for generating Bundle/AOP-suitable class loaders used internally by Spring-DM for generating proxies. The factory acts as a generic facade for framework components hiding the implementation details (or the changes in strategy).

Internally the factory will try to use a cache to avoid creating unneeded class loader (even if lightweight) to avoid polluting the JDK/CGLIB class loader maps.

Author:
Costin Leau

Constructor Summary
ClassLoaderFactory()
           
 
Method Summary
static ChainedClassLoader getAopClassLoaderFor(ClassLoader classLoader)
          Returns the standard, extended AOP class loader based on the given class loader.
static ClassLoader getBundleClassLoaderFor(org.osgi.framework.Bundle bundle)
          Returns the wrapped class loader for the given bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderFactory

public ClassLoaderFactory()
Method Detail

getAopClassLoaderFor

public static ChainedClassLoader getAopClassLoaderFor(ClassLoader classLoader)
Returns the standard, extended AOP class loader based on the given class loader.

Parameters:
classLoader - base class loader
Returns:
AOP class loader created using the given argument

getBundleClassLoaderFor

public static ClassLoader getBundleClassLoaderFor(org.osgi.framework.Bundle bundle)
Returns the wrapped class loader for the given bundle.

This method is similar to getAopClassLoaderFor(ClassLoader) but considers the BundleDelegatingClassLoader associated with a bundle. Namely, the implementation will check if there is a wrapping class loader associated with the given bundle, creating one if none if found.

Useful when creating importers/exporters programmatically.

Parameters:
bundle - OSGi bundle
Returns:
associated wrapping class loader


Copyright © 2006-2013. All Rights Reserved.