felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r890971 - in /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver: manifestparser/Main.java prototype/ProtoResolver.java
Date Tue, 15 Dec 2009 20:18:15 GMT
Author: rickhall
Date: Tue Dec 15 20:18:15 2009
New Revision: 890971

URL: http://svn.apache.org/viewvc?rev=890971&view=rev
Log:
Detect when merging for require-bundle is necessary.

Modified:
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/manifestparser/Main.java
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/manifestparser/Main.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/manifestparser/Main.java?rev=890971&r1=890970&r2=890971&view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/manifestparser/Main.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/manifestparser/Main.java
Tue Dec 15 20:18:15 2009
@@ -401,8 +401,8 @@
     private static Module getTarget(List<Module> modules)
     {
 //        return getTargetByUnresolved(modules);
-        return getTargetBySymbolicName(modules, "org.springframework.faces");
-//        return getTargetBySymbolicName(modules, "bundle1");
+//        return getTargetBySymbolicName(modules, "org.springframework.faces");
+        return getTargetBySymbolicName(modules, "bundle1");
     }
 
     private static Module getTargetByUnresolved(List<Module> modules)

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=890971&r1=890970&r2=890971&view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Tue Dec 15 20:18:15 2009
@@ -243,7 +243,7 @@
 //System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
 //System.out.println("+++ currentConstraints : " + currentConstraints);
                                     checkConsistency(
-                                        module, cap, candidateMap,
+                                        module, req, cap, candidateMap,
                                         currentConstraintsCopy, candidateConstraints);
                                     // Finally, modify the original existing constraints.
                                     currentConstraints.putAll(currentConstraintsCopy);
@@ -431,7 +431,7 @@
 //System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
 //System.out.println("+++ currentConstraints : " + currentConstraints);
                             checkConsistency(
-                                module, cap, candidateMap,
+                                module, req, cap, candidateMap,
                                 currentConstraintsCopy, candidateConstraints);
                             // Finally, modify the original existing constraints.
                             currentConstraints.putAll(currentConstraintsCopy);
@@ -778,8 +778,7 @@
 
             if (capSource != null)
             {
-                constraints.put(uses.get(usesIdx),
-                    new Blame(capSource, capTarget.getModule()));
+                constraints.put(uses.get(usesIdx), new Blame(capSource, capTarget.getModule()));
                 calculateResolvedUsesConstraints(capSource, constraints, cycleMap);
             }
         }
@@ -799,7 +798,8 @@
     }
 
     private void checkConsistency(
-        Module targetModule, Capability capGoal,
+        Module targetModule,
+        Requirement reqGoal, Capability capCandidate,
         Map<Requirement, Set<Capability>> candidateMap,
         Map<String, Blame> currentConstraints,
         Map<String, Blame> candidateConstraints)
@@ -814,17 +814,21 @@
             m_invokeCounts.put(methodName, count);
         }
 
-//System.out.println("Goal: " + capGoal);
-//System.out.println("Candidate map: " + candidateMap);
-//System.out.println(targetModule + " current   : " + currentConstraints);
-//System.out.println(spaces(targetModule.toString()) + " candidate : " + candidateConstraints);
+System.out.println("Goal         : " + reqGoal);
+System.out.println("Candidate    : " + capCandidate);
+System.out.println("Candidate map: " + candidateMap);
+System.out.println(targetModule + " current   : " + currentConstraints);
+System.out.println(spaces(targetModule.toString()) + " candidate : " + candidateConstraints);
         // Find matching providing for requirement.
-        if ((capGoal != null) && capGoal.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+        if ((capCandidate != null) && capCandidate.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
         {
             verifyUses(
                 targetModule,
-                (String) capGoal.getAttribute(Capability.PACKAGE_ATTR).getValue(),
-                candidateMap, currentConstraints, candidateConstraints,
+                reqGoal,
+                (String) capCandidate.getAttribute(Capability.PACKAGE_ATTR).getValue(),
+                candidateMap,
+                currentConstraints,
+                candidateConstraints,
                 new HashMap<String, List<Module>>());
         }
         else
@@ -833,8 +837,13 @@
                 it.hasNext(); )
             {
                 Entry<String, Blame> entry = it.next();
-                verifyUses(targetModule, entry.getKey(),
-                    candidateMap, currentConstraints, candidateConstraints,
+                verifyUses(
+                    targetModule,
+                    reqGoal,
+                    entry.getKey(),
+                    candidateMap,
+                    currentConstraints,
+                    candidateConstraints,
                     new HashMap<String, List<Module>>());
             }
         }
@@ -842,7 +851,8 @@
 //System.out.println(spaces(targetModule.toString()) + " -CONSISTENT-");
     }
 
-    private void verifyUses(Module targetModule, String pkgName,
+    private void verifyUses(Module targetModule,
+        Requirement reqGoal, String pkgName,
         Map<Requirement, Set<Capability>> candidateMap,
         Map<String, Blame> currentConstraints,
         Map<String, Blame> candidateConstraints, Map<String, List<Module>>
cycleMap)
@@ -889,6 +899,11 @@
         cycleMap.put(pkgName, list);
 
         if ((current != null)
+            && reqGoal.getNamespace().equals(Capability.MODULE_NAMESPACE))
+        {
+            System.out.println("+++ NEED TO MERGE: " + current + " AND " + candidate);
+        }
+        else if ((current != null)
             && !current.m_capability.equals(candidate.m_capability))
         {
 //System.out.println("Conflict: " + candidate.m_capability + " WITH " + curren.m_capability);
@@ -971,7 +986,7 @@
         List<String> uses = candidate.m_capability.getUses();
         for (int usesIdx = 0; usesIdx < uses.size(); usesIdx++)
         {
-            verifyUses(targetModule, uses.get(usesIdx), candidateMap,
+            verifyUses(targetModule, reqGoal, uses.get(usesIdx), candidateMap,
                 currentConstraints, candidateConstraints, cycleMap);
         }
         // Now we can merge constraints, since there was no issue.



Mime
View raw message