karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject karaf git commit: [KARAF-3102] Restore bundle state behaviour like in karaf 3
Date Mon, 13 Apr 2015 09:52:23 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 6ebd5cc94 -> 021458888


[KARAF-3102] Restore bundle state behaviour like in karaf 3


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

Branch: refs/heads/master
Commit: 0214588888ada69ab93dcf9f4a5bfa60b2374c56
Parents: 6ebd5cc
Author: Christian Schneider <chris@die-schneider.net>
Authored: Mon Apr 13 11:52:01 2015 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Mon Apr 13 11:52:01 2015 +0200

----------------------------------------------------------------------
 .../features/internal/service/Deployer.java     | 31 ++++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/02145888/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
index 3a13e8c..a9697d2 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
@@ -104,8 +104,6 @@ import static org.osgi.framework.Bundle.UNINSTALLED;
 import static org.osgi.framework.namespace.HostNamespace.HOST_NAMESPACE;
 import static org.osgi.framework.namespace.IdentityNamespace.IDENTITY_NAMESPACE;
 import static org.osgi.framework.namespace.IdentityNamespace.TYPE_BUNDLE;
-import static org.osgi.resource.Namespace.CAPABILITY_EFFECTIVE_DIRECTIVE;
-import static org.osgi.resource.Namespace.EFFECTIVE_ACTIVE;
 
 public class Deployer {
 
@@ -830,28 +828,29 @@ public class Deployer {
                 states.put(resource, reqState);
                 for (Wire wire : resolver.getWiring().get(resource)) {
                     Resource provider = wire.getProvider();
-                    FeatureState stateToMerge;
                     String region = resolver.getBundles().get(provider);
                     BundleInfo bi = region != null ? resolver.getBundleInfos().get(region).get(getUri(provider))
: null;
-                    if (reqState == FeatureState.Started) {
-                        String effective = wire.getCapability().getDirectives().get(CAPABILITY_EFFECTIVE_DIRECTIVE);
-                        // If there is an active effective capability or a requirement from
the feature
-                        // and if the bundle is flagged as to start, start it
-                        if ((EFFECTIVE_ACTIVE.equals(effective) || IDENTITY_NAMESPACE.equals(wire.getCapability().getNamespace()))
-                                && (bi == null || bi.isStart())) {
-                            stateToMerge = FeatureState.Started;
-                        } else {
-                            stateToMerge = FeatureState.Resolved;
-                        }
-                    } else {
-                        stateToMerge = reqState;
-                    }
+                    FeatureState stateToMerge = determineBundleState(reqState, wire, bi);
                     propagateState(states, provider, stateToMerge, resolver);
                 }
             }
         }
     }
 
+    private FeatureState determineBundleState(FeatureState reqState, Wire wire, BundleInfo
bi) {
+        if (reqState == FeatureState.Started) {
+            boolean isIdentity = IDENTITY_NAMESPACE.equals(wire.getCapability().getNamespace());
+            if (isIdentity && (bi != null && !bi.isStart())) {
+                // Always start bundles unless they are explicitly set to not start
+                return FeatureState.Resolved;
+            } else {
+                return FeatureState.Started; 
+            }
+        } else {
+            return reqState;
+        }
+    }
+    
     private boolean isSubsystem(Resource resource) {
         return TYPE_SUBSYSTEM.equals(getType(resource));
     }


Mime
View raw message