Package org.jruby.embed.osgi.internal
Class JRubyOSGiBundleClassLoader
java.lang.Object
java.lang.ClassLoader
org.jruby.embed.osgi.internal.JRubyOSGiBundleClassLoader
- All Implemented Interfaces:
org.osgi.framework.BundleReference
public class JRubyOSGiBundleClassLoader
extends ClassLoader
implements org.osgi.framework.BundleReference
Closest thing to JRubyClassLoader's addURL but for OSGi bundles.
Used as the parent classloader the usual jruby's bundle's classloader.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LinkedHashMap<org.osgi.framework.Bundle,ClassLoader> private final booleanlook in OSGi first? true by default for now.private static final IOSGiClassLoaderAdapterprivate static final Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanaddBundle(org.osgi.framework.Bundle bundle) protected Class<?>org.osgi.framework.BundleReturns theBundlethat defined this web-application.getResource(String name) getResources(String name) TODO: optimize: we should not have to look for the resources everywhere until called for it.booleanremoveBundle(org.osgi.framework.Bundle bundle) toList(List<Enumeration<URL>> l) Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
LOG
-
ADAPTER
-
_lookInOsgiFirst
private final boolean _lookInOsgiFirstlook in OSGi first? true by default for now. we could look in jruby first if that makes more sense.- See Also:
-
_libraries
-
-
Constructor Details
-
JRubyOSGiBundleClassLoader
public JRubyOSGiBundleClassLoader()- Throws:
IOException
-
JRubyOSGiBundleClassLoader
public JRubyOSGiBundleClassLoader(org.osgi.framework.Bundle creator) - Throws:
IOException
-
-
Method Details
-
addBundle
- Throws:
IOException
-
addBundle
public boolean addBundle(org.osgi.framework.Bundle bundle) - Parameters:
parent- The parent classloader. In this case jrubyLoadercontext- The WebAppContextcontributor- The bundle that defines this web-application.- Throws:
IOException
-
removeBundle
- Parameters:
parent- The parent classloader. In this case jrubyLoadercontext- The WebAppContextcontributor- The bundle that defines this web-application.- Throws:
IOException
-
getBundle
public org.osgi.framework.Bundle getBundle()Returns theBundlethat defined this web-application.- Specified by:
getBundlein interfaceorg.osgi.framework.BundleReference- Returns:
- The
Bundleobject associated with thisBundleReference.
-
getResources
TODO: optimize: we should not have to look for the resources everywhere until called for it.- Overrides:
getResourcesin classClassLoader- Throws:
IOException
-
getResource
- Overrides:
getResourcein classClassLoader
-
toList
-
findClass
- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-