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.
Author:
hmalphettes
  • Constructor Details

    • JRubyOSGiBundleClassLoader

      public JRubyOSGiBundleClassLoader()
    • JRubyOSGiBundleClassLoader

      public JRubyOSGiBundleClassLoader(org.osgi.framework.Bundle creator)
  • Method Details

    • addBundle

      public void addBundle(Class<?> classInOsgiBundle)
    • addBundle

      public boolean addBundle(org.osgi.framework.Bundle bundle)
    • removeBundle

      public boolean removeBundle(org.osgi.framework.Bundle bundle) throws IOException
      Parameters:
      bundle -
      Throws:
      IOException
    • getBundle

      public org.osgi.framework.Bundle getBundle()
      Returns the Bundle that defined this web-application.
      Specified by:
      getBundle in interface org.osgi.framework.BundleReference
      Returns:
      The Bundle object associated with this BundleReference.
    • getResources

      public Enumeration<URL> getResources(String name) throws IOException
      TODO: optimize: we should not have to look for the resources everywhere until called for it.
      Overrides:
      getResources in class ClassLoader
      Throws:
      IOException
    • getResource

      public URL getResource(String name)
      Overrides:
      getResource in class ClassLoader
    • findClass

      protected Class<?> findClass(String name) throws ClassNotFoundException
      Overrides:
      findClass in class ClassLoader
      Throws:
      ClassNotFoundException