Repository: karaf
Updated Branches:
  refs/heads/master 0cb8c9133 -> 93ed3f5f1


[KARAF-2888] Respect start attribute on feature bundle informations


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

Branch: refs/heads/master
Commit: 93ed3f5f1bf1cdd5adc0907adb177144102865cd
Parents: 1b1b676
Author: Guillaume Nodet <gno...@gmail.com>
Authored: Tue Apr 22 14:30:57 2014 +0200
Committer: Guillaume Nodet <gno...@gmail.com>
Committed: Tue Apr 22 14:31:49 2014 +0200

----------------------------------------------------------------------
 .../internal/service/FeaturesServiceImpl.java   | 21 ++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/93ed3f5f/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
 
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
index d228632..a8ccd0a 100644
--- 
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
+++ 
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
@@ -895,8 +895,6 @@ public class FeaturesServiceImpl implements FeaturesService 
{
             }
         }
 
-        // TODO: handle bundleInfo.isStart()
-
         // Get all resources that will be used to satisfy the old features set
         Set<Resource> resourceLinkedToOldFeatures = new HashSet<Resource>();
         if (noStart) {
@@ -1188,9 +1186,6 @@ public class FeaturesServiceImpl implements 
FeaturesService {
                         bundle = region.installBundle(uri, is);
                     }
                     addToMapSet(managed, name, bundle.getBundleId());
-                    if (!noStart || 
resourceLinkedToOldFeatures.contains(resource)) {
-                        toStart.add(bundle);
-                    }
                     deployment.resToBnd.put(resource, bundle);
                     // save a checksum of installed snapshot bundle
                     if (UPDATE_SNAPSHOTS_CRC.equals(updateSnaphots)
@@ -1201,6 +1196,13 @@ public class FeaturesServiceImpl implements 
FeaturesService {
                     if (bi != null && bi.getStartLevel() > 0) {
                         
bundle.adapt(BundleStartLevel.class).setStartLevel(bi.getStartLevel());
                     }
+                    if (resourceLinkedToOldFeatures.contains(resource)) {
+                        toStart.add(bundle);
+                    } else if (!noStart) {
+                        if (bi == null || bi.isStart()) {
+                            toStart.add(bundle);
+                        }
+                    }
                 }
             }
         }
@@ -1306,9 +1308,12 @@ public class FeaturesServiceImpl implements 
FeaturesService {
         }
     }
 
-    protected BundleInfo mergeBundleInfo(BundleInfo bi, BundleInfo oldBi) {
-        // TODO: we need a proper merge strategy when a bundle
-        // TODO: comes from different features
+    protected BundleInfo mergeBundleInfo(BundleInfo bi1, BundleInfo bi2) {
+        org.apache.karaf.features.internal.model.Bundle bi = new 
org.apache.karaf.features.internal.model.Bundle();
+        bi.setLocation(bi1.getLocation());
+        bi.setDependency(bi1.isDependency() && bi2.isDependency());
+        bi.setStart(bi1.isStart() || bi2.isStart());
+        bi.setStartLevel(Math.min(bi1.getStartLevel(), bi2.getStartLevel()));
         return bi;
     }
 

Reply via email to