You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/04/23 10:42:36 UTC
svn commit: r1589354 -
/sling/trunk/contrib/crankstart/core/src/main/java/org/apache/sling/crankstart/core/commands/StartBundles.java
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;
}
}