incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1589354 - /sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
Date Wed, 23 Apr 2014 08:42:36 GMT
Author: bdelacretaz
Date: Wed Apr 23 08:42:36 2014
New Revision: 1589354

URL: http://svn.apache.org/r1589354
Log:
Don't try to start fragment bundles

Modified:
    sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java

Modified: sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java?rev=1589354&r1=1589353&r2=1589354&view=diff
==============================================================================
--- sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
(original)
+++ sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
Wed Apr 23 08:42:36 2014
@@ -36,13 +36,23 @@ public class StartBundles implements Cra
     public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception
{
         int count = 0;
         for (Bundle bundle : crankstartContext.getOsgiFramework().getBundleContext().getBundles())
{
-            log.info("Starting bundle {}", bundle.getSymbolicName());
-            bundle.start();
-            count++;
+            if(isFragment(bundle)) {
+                log.debug("Ignoring fragment bundle {}", bundle.getSymbolicName());
+                continue;
+            }
+            if(bundle.getState() != Bundle.ACTIVE) {
+                log.info("Starting bundle {}", bundle.getSymbolicName());
+                bundle.start();
+                count++;
+            } else {
+                log.debug("Bundle {} is already active", bundle.getSymbolicName());
+            }
         }
         
-        // TODO check that all bundles have started? 
-        // or use a crankstart instruction for that?
-        log.info("{} bundles processed", count);
+        log.info("{} bundles started", count);
+    }
+    
+    private boolean isFragment(Bundle b) {
+        return b.getHeaders().get("Fragment-Host") != null;
     }
 }



Mime
View raw message