You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2005/11/30 16:51:43 UTC

svn commit: r349969 - in /incubator/felix/trunk/framework/src/org/apache/felix/framework: BundleImpl.java Felix.java

Author: rickhall
Date: Wed Nov 30 07:51:41 2005
New Revision: 349969

URL: http://svn.apache.org/viewcvs?rev=349969&view=rev
Log:
Implementation of Bundle.loadClass() from OSGi R4.

Modified:
    incubator/felix/trunk/framework/src/org/apache/felix/framework/BundleImpl.java
    incubator/felix/trunk/framework/src/org/apache/felix/framework/Felix.java

Modified: incubator/felix/trunk/framework/src/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/framework/src/org/apache/felix/framework/BundleImpl.java?rev=349969&r1=349968&r2=349969&view=diff
==============================================================================
--- incubator/felix/trunk/framework/src/org/apache/felix/framework/BundleImpl.java (original)
+++ incubator/felix/trunk/framework/src/org/apache/felix/framework/BundleImpl.java Wed Nov 30 07:51:41 2005
@@ -149,8 +149,7 @@
 
     public Class loadClass(String name) throws ClassNotFoundException
     {
-        // TODO: Implement Bundle.loadClass()
-        return null;
+        return m_felix.loadBundleClass(this, name);
     }
 
     public Enumeration getResources(String name) throws IOException

Modified: incubator/felix/trunk/framework/src/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/framework/src/org/apache/felix/framework/Felix.java?rev=349969&r1=349968&r2=349969&view=diff
==============================================================================
--- incubator/felix/trunk/framework/src/org/apache/felix/framework/Felix.java (original)
+++ incubator/felix/trunk/framework/src/org/apache/felix/framework/Felix.java Wed Nov 30 07:51:41 2005
@@ -1140,6 +1140,25 @@
     }
 
     /**
+     * Implementation for Bundle.loadClass().
+    **/
+    protected Class loadBundleClass(BundleImpl bundle, String name) throws ClassNotFoundException
+    {
+        try
+        {
+            return bundle.getInfo().getCurrentModule().getClassLoader().loadClass(name);
+        }
+        catch (ClassNotFoundException ex)
+        {
+            // The spec says we must throw a framework error.
+            fireFrameworkEvent(
+                FrameworkEvent.ERROR, bundle,
+                new BundleException(ex.getMessage()));
+            throw ex;
+        }
+    }
+
+    /**
      * Implementation for Bundle.start().
     **/
     protected void startBundle(BundleImpl bundle, boolean record)