aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1097821 - in /aries/trunk/spi-fly: spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java spi-fly-dynamic-bundle/pom.xml
Date Fri, 29 Apr 2011 13:45:43 GMT
Author: davidb
Date: Fri Apr 29 13:45:43 2011
New Revision: 1097821

URL: http://svn.apache.org/viewvc?rev=1097821&view=rev
Log:
Bug fix in the code that finds the classloader for a bundle (which is pre-4.2 compliant).
Also fixed the BundleListener code.

Modified:
    aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
    aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java
    aries/trunk/spi-fly/spi-fly-dynamic-bundle/pom.xml

Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java?rev=1097821&r1=1097820&r2=1097821&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
(original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/BaseActivator.java
Fri Apr 29 13:45:43 2011
@@ -73,7 +73,7 @@ public abstract class BaseActivator impl
         providerBundleTracker.open();
 
         consumerBundleTracker = new BundleTracker(context,
-                Bundle.INSTALLED, new ConsumerBundleTrackerCustomizer(this, consumerHeaderName));
+                Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE, new
ConsumerBundleTrackerCustomizer(this, consumerHeaderName));
         consumerBundleTracker.open();
 
         for (Bundle bundle : context.getBundles()) {

Modified: aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java?rev=1097821&r1=1097820&r2=1097821&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java (original)
+++ aries/trunk/spi-fly/spi-fly-core/src/main/java/org/apache/aries/spifly/Util.java Fri Apr
29 13:45:43 2011
@@ -24,6 +24,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
 import java.util.ServiceLoader;
 
@@ -112,20 +113,30 @@ public class Util {
         // In 4.3 this can be done much easier by using the BundleWiring, but we want this
code to
         // be 4.2 compliant.
         // Here we're just finding any class in the bundle, load that and then use its classloader.
-        Enumeration<String> paths = b.getEntryPaths("/");
-        while(paths.hasMoreElements()) {
-            String path = paths.nextElement();
-            if (path.endsWith(".class")) {
-                String className = path.substring(0,path.length() - ".class".length());
-                if (className.startsWith("/"))
-                    className = className.substring(1);
-
-                className = className.replace('/', '.');
-                try {
-                    Class<?> cls = b.loadClass(className);
-                    return cls.getClassLoader();
-                } catch (ClassNotFoundException e) {
-                    // try the next class
+        
+        List<String> rootPaths = new ArrayList<String>();
+        rootPaths.add("/");
+        
+        while(rootPaths.size() > 0) {            
+            String rootPath = rootPaths.remove(0);
+            
+            Enumeration<String> paths = b.getEntryPaths(rootPath);
+            while(paths.hasMoreElements()) {
+                String path = paths.nextElement();
+                if (path.endsWith(".class")) {
+                    String className = path.substring(0,path.length() - ".class".length());
+                    if (className.startsWith("/"))
+                        className = className.substring(1);
+
+                    className = className.replace('/', '.');
+                    try {
+                        Class<?> cls = b.loadClass(className);
+                        return cls.getClassLoader();
+                    } catch (ClassNotFoundException e) {
+                        // try the next class
+                    }
+                } else if (path.endsWith("/")) {
+                    rootPaths.add(path);
                 }
             }
         }

Modified: aries/trunk/spi-fly/spi-fly-dynamic-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/spi-fly/spi-fly-dynamic-bundle/pom.xml?rev=1097821&r1=1097820&r2=1097821&view=diff
==============================================================================
--- aries/trunk/spi-fly/spi-fly-dynamic-bundle/pom.xml (original)
+++ aries/trunk/spi-fly/spi-fly-dynamic-bundle/pom.xml Fri Apr 29 13:45:43 2011
@@ -101,6 +101,7 @@ JRE through META-INF/services resources)
                         <Private-Package>
                             org.apache.aries.spifly.dynamic
                         </Private-Package>
+                        <Embed-Dependency>org.apache.aries.spifly.*;scope=compile;inline=true</Embed-Dependency>
                         <Bundle-Activator>org.apache.aries.spifly.dynamic.DynamicWeavingActivator</Bundle-Activator>
                     </instructions>
                 </configuration>



Mime
View raw message