Author: rickhall
Date: Wed Dec 16 19:51:40 2009
New Revision: 891405
URL: http://svn.apache.org/viewvc?rev=891405&view=rev
Log:
Verify uses constraints for all required packages.
Modified:
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/prototype/ProtoResolver.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=891405&r1=891404&r2=891405&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
Wed Dec 16 19:51:40 2009
@@ -247,7 +247,7 @@
currentConstraintsCopy,
candidateConstraints);
// Finally, modify the original existing
constraints.
currentConstraints.putAll(currentConstraintsCopy);
-
+System.out.println("merged: " + currentConstraints);
// This candidate was consistent, so
select it.
selectedCandidate = cap;
}
@@ -435,6 +435,7 @@
currentConstraintsCopy, candidateConstraints);
// Finally, modify the original existing
constraints.
currentConstraints.putAll(currentConstraintsCopy);
+System.out.println("merged: " + currentConstraints);
// This candidate was consistent, so select it.
selectedCandidate = cap;
@@ -495,7 +496,9 @@
{
constraintsCopy.put(
entry.getKey(),
- new Blame(entry.getValue().m_capability, blameModule));
+ new Blame(
+ entry.getValue().m_capability,
+ blameModule));
}
else
{
@@ -611,7 +614,9 @@
{
constraints.put(
(String)
caps.get(i).getAttribute(Capability.PACKAGE_ATTR).getValue(),
- new Blame(caps.get(i), blameModule));
+ new Blame(
+ caps.get(i),
+ blameModule));
}
}
@@ -631,7 +636,9 @@
Entry<String, Blame> entry = it.next();
constraintsCopy.put(
entry.getKey(),
- new Blame(entry.getValue().m_capability, blameModule));
+ new Blame(
+ entry.getValue().m_capability,
+ blameModule));
}
constraints = constraintsCopy;
}
@@ -684,7 +691,9 @@
// The capability itself is a constraint, so add it.
constraints.put(
(String)
capTarget.getAttribute(Capability.PACKAGE_ATTR).getValue(),
- new Blame(capTarget, blameModule));
+ new Blame(
+ capTarget,
+ blameModule));
// Calculate implied constraints.
calculateResolvedUsesConstraints(
@@ -710,7 +719,9 @@
{
constraintsCopy.put(
entry.getKey(),
- new Blame(entry.getValue().m_capability, blameModule));
+ new Blame(
+ entry.getValue().m_capability,
+ blameModule));
}
else
{
@@ -778,7 +789,11 @@
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);
}
}
@@ -819,7 +834,8 @@
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.
+ // For an imported package, we must verify the uses constraints of the
+ // candidate exported package .
if ((capCandidate != null) &&
capCandidate.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
{
verifyUses(
@@ -831,8 +847,31 @@
candidateConstraints,
new HashMap<String, List<Module>>());
}
+ // For an required bundle, we must verify the uses constraints of each
+ // of the candidate module's exported packages.
+ else if ((capCandidate != null) &&
capCandidate.getNamespace().equals(Capability.MODULE_NAMESPACE))
+ {
+ for (Entry<String, Blame> entry : candidateConstraints.entrySet())
+ {
+ Capability candCap = entry.getValue().m_capability;
+ if ((candCap.getModule() == capCandidate.getModule())
+ &&
candCap.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+ {
+ verifyUses(
+ targetModule,
+ reqGoal,
+ (String)
candCap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
+ candidateMap,
+ currentConstraints,
+ candidateConstraints,
+ new HashMap<String, List<Module>>());
+ }
+ }
+ }
else
{
+// TODO: PROTO RESOLVER - We shouldn't do anything here, since only
Import-Package
+// and Require-Bundle impact uses constraints.
for (Iterator<Entry<String, Blame>> it =
candidateConstraints.entrySet().iterator();
it.hasNext(); )
{