karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [2/2] karaf git commit: [KARAF-3524] Features on conditionals are not installed
Date Thu, 12 Feb 2015 17:22:26 GMT
[KARAF-3524] Features on conditionals are not installed

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/00743ee7
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/00743ee7
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/00743ee7

Branch: refs/heads/master
Commit: 00743ee769b6b70e655834d16e236c0a818cceaf
Parents: 8685407
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Thu Feb 12 18:22:11 2015 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Thu Feb 12 18:22:11 2015 +0100

----------------------------------------------------------------------
 .../features/internal/region/Subsystem.java      | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/00743ee7/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
b/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
index a958e8a..575bac7 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/Subsystem.java
@@ -258,8 +258,12 @@ public class Subsystem extends ResourceImpl {
 
     @SuppressWarnings("InfiniteLoopStatement")
     public void build(Collection<Feature> features) throws Exception {
+        doBuild(features, true);
+    }
+
+    private void doBuild(Collection<Feature> features, boolean mandatory) throws Exception
{
         for (Subsystem child : children) {
-            child.build(features);
+            child.doBuild(features, true);
         }
         if (feature != null) {
             for (Dependency dep : feature.getDependencies()) {
@@ -267,7 +271,18 @@ public class Subsystem extends ResourceImpl {
                 while (!ss.isAcceptDependencies()) {
                     ss = ss.getParent();
                 }
-                ss.requireFeature(dep.getName(), dep.getVersion(), !dep.isDependency());
+                ss.requireFeature(dep.getName(), dep.getVersion(), mandatory && !dep.isDependency());
+            }
+            for (Conditional cond : feature.getConditional()) {
+                Feature fcond = cond.asFeature(feature.getName(), feature.getVersion());
+                String ssName = this.name + "#" + (fcond.hasVersion() ? fcond.getName() +
"-" + fcond.getVersion() : fcond.getName());
+                Subsystem fs = getChild(ssName);
+                if (fs == null) {
+                    fs = new Subsystem(ssName, fcond, this);
+                    fs.doBuild(features, false);
+                    installable.add(fs);
+                    children.add(fs);
+                }
             }
         }
         List<Requirement> processed = new ArrayList<>();


Mime
View raw message