org.jruby.embed.osgi.internal
Class JRubyOSGiBundleClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.jruby.embed.osgi.internal.JRubyOSGiBundleClassLoader
All Implemented Interfaces:
org.osgi.framework.BundleReference

public class JRubyOSGiBundleClassLoader
extends java.lang.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 Summary
JRubyOSGiBundleClassLoader()
           
JRubyOSGiBundleClassLoader(org.osgi.framework.Bundle creator)
           
 
Method Summary
 boolean addBundle(org.osgi.framework.Bundle bundle)
           
 void addBundle(java.lang.Class<?> classInOsgiBundle)
           
protected  java.lang.Class<?> findClass(java.lang.String name)
           
 org.osgi.framework.Bundle getBundle()
          Returns the Bundle that defined this web-application.
 java.net.URL getResource(java.lang.String name)
           
 java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
          TODO: optimize: we should not have to look for the resources everywhere until called for it.
 boolean removeBundle(org.osgi.framework.Bundle bundle)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRubyOSGiBundleClassLoader

public JRubyOSGiBundleClassLoader()
Parameters:
-
Throws:
java.io.IOException

JRubyOSGiBundleClassLoader

public JRubyOSGiBundleClassLoader(org.osgi.framework.Bundle creator)
Parameters:
-
Throws:
java.io.IOException
Method Detail

addBundle

public void addBundle(java.lang.Class<?> classInOsgiBundle)
Parameters:
-
Throws:
java.io.IOException

addBundle

public boolean addBundle(org.osgi.framework.Bundle bundle)
Parameters:
parent - The parent classloader. In this case jrubyLoader
context - The WebAppContext
contributor - The bundle that defines this web-application.
Throws:
java.io.IOException

removeBundle

public boolean removeBundle(org.osgi.framework.Bundle bundle)
                     throws java.io.IOException
Parameters:
parent - The parent classloader. In this case jrubyLoader
context - The WebAppContext
contributor - The bundle that defines this web-application.
Throws:
java.io.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 java.util.Enumeration<java.net.URL> getResources(java.lang.String name)
                                                 throws java.io.IOException
TODO: optimize: we should not have to look for the resources everywhere until called for it.

Overrides:
getResources in class java.lang.ClassLoader
Throws:
java.io.IOException

getResource

public java.net.URL getResource(java.lang.String name)
Overrides:
getResource in class java.lang.ClassLoader

findClass

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


Copyright © 2002-2009 JRuby Team. All Rights Reserved.