You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2019/02/14 08:48:28 UTC

[karaf] branch karaf-4.2.x updated: [KARAF-6157]ensure karaf-maven-plugin can honor start-level for bootBundles

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
     new 58eae75  [KARAF-6157]ensure karaf-maven-plugin can honor start-level for bootBundles
58eae75 is described below

commit 58eae75a40061e3ffb1606e5b0ac2c0b0b65346a
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Thu Feb 14 16:46:45 2019 +0800

    [KARAF-6157]ensure karaf-maven-plugin can honor start-level for bootBundles
    
    (cherry picked from commit b531a0dac6b85e7f559979db5d5b975d319462b4)
---
 .../java/org/apache/karaf/profile/assembly/Builder.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
index 00bbc0a..a48da2d 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
@@ -129,6 +129,7 @@ public class Builder {
     private static final String LIBRARY_CLAUSE_TYPE = "type";
     private static final String LIBRARY_CLAUSE_EXPORT = "export";
     private static final String LIBRARY_CLAUSE_DELEGATE = "delegate";
+    private static final String START_LEVEL = "start-level";
 
     public static final String ORG_OPS4J_PAX_URL_MVN_PID = "org.ops4j.pax.url.mvn";
 
@@ -1720,7 +1721,23 @@ public class Builder {
         // Add bundles
         for (String location : bootEffective.getBundles()) {
             location = location.replace("profile:", "file:etc/");
+            int intLevel = -100;
+            if (location.contains(START_LEVEL)) {
+                //extract start-level for this bundle
+                String level = location.substring(location.indexOf(START_LEVEL));
+                level = level.substring(START_LEVEL.length() + 1);
+                if (level.startsWith("\"")) {
+                    level = level.substring(1, level.length() - 1);
+                }
+                intLevel = Integer.valueOf(level);
+                LOGGER.debug("bundle start-level: " + level);
+                location = location.substring(0, location.indexOf(START_LEVEL) - 1);
+                LOGGER.debug("new bundle location after strip start-level: " + location);
+            }
             Bundle bun = new Bundle();
+            if (intLevel > 0) {
+                bun.setStartLevel(intLevel);
+            }
             bun.setLocation(location);
             generated.getBundle().add(bun);
         }