Author: jwross
Date: Thu Sep 27 20:52:12 2012
New Revision: 1391209

URL: http://svn.apache.org/viewvc?rev=1391209&view=rev
Log:
ARIES-927: Added an additional check for determining whether or not composite 
bundle support is available. The additional check is necessary because Equinox 
will register the CompositeBundleFactory service even though the 
org.osgi.service.framework package is not exported due to a strict resolution 
mode.

Modified:
    
aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java

Modified: 
aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java?rev=1391209&r1=1391208&r2=1391209&view=diff
==============================================================================
--- 
aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java
 (original)
+++ 
aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java
 Thu Sep 27 20:52:12 2012
@@ -77,8 +77,22 @@ public final class RecursiveBundleTracke
         this.tracker = tracker;
     }
 
+    /*
+     * Checks whether or not the framework supports composite bundles. The only
+     * known supporting framework is Equinox. When the Equinox specific
+     * framework property osgi.resolverMode is set to "strict", the
+     * CompositeBundleFactory service is registered, but the x-internal
+     * org.osgi.service.framework package is not exported, thus the need for
+     * the additional Class.forName check.
+     */
     private static boolean areMultipleFrameworksAvailable(BundleContext 
context) {
-        ServiceReference sr = 
context.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
+       String compositeBundleFactory = 
"org.osgi.service.framework.CompositeBundleFactory";
+       try {
+               Class.forName(compositeBundleFactory);
+       } catch (ClassNotFoundException e) {
+               return false;
+       }
+        ServiceReference sr = 
context.getServiceReference(compositeBundleFactory);
         return sr != null;
     }
 


Reply via email to