felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1177749 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: StatefulResolver.java resolver/Candidates.java
Date Fri, 30 Sep 2011 17:37:49 GMT
Author: rickhall
Date: Fri Sep 30 17:37:49 2011
New Revision: 1177749

URL: http://svn.apache.org/viewvc?rev=1177749&view=rev
Log:
Framework should filter removal-pending revisions for fragments,
not the resolver. (FELIX-3141)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java?rev=1177749&r1=1177748&r2=1177749&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java Fri
Sep 30 17:37:49 2011
@@ -1021,7 +1021,19 @@ class StatefulResolver
 
         synchronized Set<BundleRevision> getFragments()
         {
-            return new HashSet(m_fragments);
+            Set<BundleRevision> fragments = new HashSet(m_fragments);
+            // Filter out any fragments that are not the current revision.
+            for (Iterator<BundleRevision> it = fragments.iterator(); it.hasNext();
)
+            {
+                BundleRevision fragment = it.next();
+                BundleRevision currentFragmentRevision =
+                    fragment.getBundle().adapt(BundleRevision.class);
+                if (fragment != currentFragmentRevision)
+                {
+                    it.remove();
+                }
+            }
+            return fragments;
         }
 
         synchronized boolean isSelectedSingleton(BundleRevision br)
@@ -1278,12 +1290,16 @@ class StatefulResolver
 
                 // Find the matching candidates.
                 Set<BundleCapability> matches = capSet.match(sf, obeyMandatory);
+                // Filter matching candidates.
                 for (BundleCapability cap : matches)
                 {
+                    // Filter according to security.
                     if (filteredBySecurity(req, cap))
                     {
                         continue;
                     }
+                    // Filter already resolved hosts, since we don't support
+                    // dynamic attachment of fragments.
                     if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE)
                         && (cap.getRevision().getWiring() != null))
                     {
@@ -1331,7 +1347,8 @@ class StatefulResolver
             return result;
         }
 
-        private boolean filteredBySecurity(BundleRequirement req, BundleCapability cap) {
+        private boolean filteredBySecurity(BundleRequirement req, BundleCapability cap)
+        {
             if (System.getSecurityManager() != null)
             {
                 BundleRevisionImpl reqRevision = (BundleRevisionImpl) req.getRevision();

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java?rev=1177749&r1=1177748&r2=1177749&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
Fri Sep 30 17:37:49 2011
@@ -646,14 +646,10 @@ class Candidates
                 {
                     for (BundleRequirement hostReq : versionEntry.getValue())
                     {
-                        // Select the highest version of the fragment that
-                        // is not removal pending. If the fragment revision
-                        // is removal pending, then its current revision will
-                        // be null or won't match the existing revision.
-                        BundleRevision currentFragmentRevision =
-                            hostReq.getRevision().getBundle()
-                                .adapt(BundleRevision.class);
-                        if (isFirst && (currentFragmentRevision == hostReq.getRevision()))
+                        // Selecting the first fragment in each entry, which
+                        // is equivalent to selecting the highest version of
+                        // each fragment with a given symbolic name.
+                        if (isFirst)
                         {
                             selectedFragments.add(hostReq.getRevision());
                             isFirst = false;



Mime
View raw message