sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1685850 - /sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java
Date Tue, 16 Jun 2015 14:36:43 GMT
Author: bdelacretaz
Date: Tue Jun 16 14:36:43 2015
New Revision: 1685850

URL: http://svn.apache.org/r1685850
Log:
SLING-4728 - do not start fragment bundles

Modified:
    sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java

Modified: sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java?rev=1685850&r1=1685849&r2=1685850&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java
(original)
+++ sling/trunk/contrib/crankstart/launcher/src/main/java/org/apache/sling/crankstart/launcher/FrameworkSetup.java
Tue Jun 16 14:36:43 2015
@@ -77,16 +77,25 @@ public class FrameworkSetup extends Hash
         int started = 0;
         int failed = 0;
         for(Bundle b : bundles) {
-            try {
-                b.start();
+            if(isFragment(b)) {
                 started++;
-            } catch(BundleException be) {
-                failed++;
-                log.warn("Error starting bundle " + b.getSymbolicName(), be);
+            } else {
+                try { 
+                    b.start();
+                    started++;
+                } catch(BundleException be) {
+                    failed++;
+                    log.warn("Error starting bundle " + b.getSymbolicName(), be);
+                }
             }
             cfg.maybeConfigure();
         }
-        log.info("{} bundles started, {} failed to start, total {}", started, failed, bundles.length);
+        
+        if(failed == 0) {
+            log.info("All {} bundles started.", started);
+        } else {
+            log.info("{} bundles started, {} failed to start, total {}", started, failed,
bundles.length);
+        }
         
         log.info("OSGi setup done, waiting for framework to stop");
         framework.waitForStop(0);
@@ -94,6 +103,10 @@ public class FrameworkSetup extends Hash
         return null;
     }
     
+    private boolean isFragment(Bundle b) {
+        return b.getHeaders().get("Fragment-Host") != null;
+    }
+    
     private void setShutdownHook(final Framework osgiFramework, final Closeable ... toClose)
{
         // Shutdown the framework when the JVM exits
         Runtime.getRuntime().addShutdownHook(new Thread() {



Mime
View raw message