Interface BundleClassLoaderHelper

All Known Implementing Classes:
DefaultBundleClassLoaderHelper

public interface BundleClassLoaderHelper
BundleClassLoaderHelper

Is there a clean OSGi way to go from the Bundle object to the classloader of the Bundle ? You can certainly take a class inside the bundle and get the bundle's classloader that way. Getting the classloader directly from the bundle would be nice.

We could use fragments that are specific to each OSGi implementation. Using introspection here to keep packaging simple and avoid the multiplication of the jars.

The default implementation relies on introspection and supports equinox-3.5 and felix-2.0.0

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the custom implementation for this interface in a fragment.
    The default instance supports felix and equinox
  • Method Summary

    Modifier and Type
    Method
    Description
    getBundleClassLoader(org.osgi.framework.Bundle bundle)
     
  • Field Details

    • CLASS_NAME

      static final String CLASS_NAME
      The name of the custom implementation for this interface in a fragment.
      See Also:
    • DEFAULT

      static final BundleClassLoaderHelper DEFAULT
      The default instance supports felix and equinox
  • Method Details

    • getBundleClassLoader

      ClassLoader getBundleClassLoader(org.osgi.framework.Bundle bundle)
      Parameters:
      bundle - the bundle
      Returns:
      The classloader of a given bundle. Assuming the bundle is started.