incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r887014 - /sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java
Date Fri, 04 Dec 2009 00:28:07 GMT
Author: fmeschbe
Date: Fri Dec  4 00:28:06 2009
New Revision: 887014

URL: http://svn.apache.org/viewvc?rev=887014&view=rev
Log:
SLING-1210 Prevent fragment bundles from being started

Modified:
    sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java

Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java?rev=887014&r1=887013&r2=887014&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java
(original)
+++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java
Fri Dec  4 00:28:06 2009
@@ -28,6 +28,7 @@
 import java.io.OutputStream;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -253,7 +254,7 @@
 
                 // done with copying at this point
             }
-            
+
             // get the set of all existing (installed) bundles by symbolic name
             Bundle[] bundles = context.getBundles();
             Map<String, Bundle> bySymbolicName = new HashMap<String, Bundle>();
@@ -653,7 +654,9 @@
         // start all bundles
         for (Bundle bundle : bundles) {
             try {
-                bundle.start();
+                if (!isFragment(bundle)) {
+                    bundle.start();
+                }
             } catch (BundleException be) {
                 logger.log(Logger.LOG_ERROR, "Bundle "
                     + bundle.getSymbolicName() + " could not be started", be);
@@ -786,6 +789,15 @@
     }
 
     /**
+     * Returns <code>true</code> if the bundle must be assumed to be a fragment
+     * according to its <code>Fragment-Host</code> header.
+     */
+    private static boolean isFragment(Bundle bundle) {
+        Dictionary<?, ?> headerMap = bundle.getHeaders();
+        return headerMap.get(Constants.FRAGMENT_HOST) != null;
+    }
+
+    /**
      * Determine if the bundle containing the passed manfiest is a newer
      * SNAPSHOT than the already-installed bundle.
      *



Mime
View raw message