Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE7BE10CA4 for ; Wed, 23 Apr 2014 08:43:08 +0000 (UTC) Received: (qmail 43782 invoked by uid 500); 23 Apr 2014 08:43:08 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 43681 invoked by uid 500); 23 Apr 2014 08:43:02 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 43653 invoked by uid 99); 23 Apr 2014 08:43:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2014 08:43:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2014 08:42:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C02C52388860; Wed, 23 Apr 2014 08:42:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@sling.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140423084236.C02C52388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; } }