Package org.eclipse.jetty.osgi.util
Class DefaultBundleClassLoaderHelper
java.lang.Object
org.eclipse.jetty.osgi.util.DefaultBundleClassLoaderHelper
- All Implemented Interfaces:
BundleClassLoaderHelper
DefaultBundleClassLoaderHelper
Default implementation of the BundleClassLoaderHelper that uses only standard OSGi specification API methods to provide a ClassLoader for a bundle, avoiding the use of reflection or container-specific internal APIs.
This implementation returns a BundleDelegatingClassLoader that
delegates class and resource loading to the bundle using the standard
OSGi API methods (Bundle.loadClass, Bundle.getResource, Bundle.getResources).
When the first class is loaded, it captures the real bundle classloader
from the loaded class for subsequent operations.
-
Field Summary
Fields inherited from interface org.eclipse.jetty.osgi.util.BundleClassLoaderHelper
CLASS_NAME, DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBundleClassLoader(org.osgi.framework.Bundle bundle) Returns a ClassLoader for the given bundle using only specification-compliant OSGi APIs.
-
Constructor Details
-
DefaultBundleClassLoaderHelper
public DefaultBundleClassLoaderHelper()
-
-
Method Details
-
getBundleClassLoader
Returns a ClassLoader for the given bundle using only specification-compliant OSGi APIs.- Specified by:
getBundleClassLoaderin interfaceBundleClassLoaderHelper- Parameters:
bundle- the bundle- Returns:
- a ClassLoader that delegates to the bundle's class and resource loading capabilities
-