You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/12/08 17:34:58 UTC
svn commit: r888471 -
/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Author: rickhall
Date: Tue Dec 8 16:34:58 2009
New Revision: 888471
URL: http://svn.apache.org/viewvc?rev=888471&view=rev
Log:
More simplification of main resolver loop.
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=888471&r1=888470&r2=888471&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 8 16:34:58 2009
@@ -94,12 +94,7 @@
m_resolvedConstraintCache.clear();
m_verifyCache.clear();
Map<Requirement, Set<Capability>> candidateMap = resolveRoot(
- module,
- null,
- module,
- new HashMap<Requirement, Set<Capability>>(),
- new HashMap<String, Blame>(),
- new HashMap<Module, Boolean>());
+ module);
if (m_isInvokeCount)
{
@@ -108,11 +103,7 @@
return populateWireMap(module, candidateMap, new HashMap<Module, List<Wire>>());
}
- private Map<Requirement, Set<Capability>> resolveRoot(
- Module module, Capability capGoal, Module blameModule,
- Map<Requirement, Set<Capability>> candidateMap,
- Map<String, Blame> existingConstrains,
- Map<Module, Boolean> cycleMap)
+ private Map<Requirement, Set<Capability>> resolveRoot(Module module)
{
if (m_isInvokeCount)
{
@@ -124,16 +115,19 @@
try
{
+ Map<Requirement, Set<Capability>> candidateMap =
+ new HashMap<Requirement, Set<Capability>>();
+
// If the module is already resolved, then do nothing.
if (!module.isResolved())
{
// Copy the existing constraints, since we need to be able
// to freely modify them.
- Map<String, Blame> existingConstraintsCopy =
- new HashMap<String, Blame>(existingConstrains);
+ Map<String, Blame> existingConstraints = new HashMap<String, Blame>();
// Add the module to the cycle map; use Boolean.FALSE to
// mark it as in the process of being resolved.
+ Map<Module, Boolean> cycleMap = new HashMap<Module, Boolean>();
cycleMap.put(module, Boolean.FALSE);
m_rootModule = module;
@@ -157,7 +151,7 @@
// Calculate current package constraints for the target module.
Map<String, Blame> currentConstraints =
- calculateConstraints(module, blameModule);
+ calculateConstraints(module, module);
// Make copy of current package constraints, since we need to
// be able to freely modify, but we may need to revert if a
@@ -216,7 +210,7 @@
{
currentConstraintsCopy.put(
(String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
- new Blame(cap, blameModule));
+ new Blame(cap, module));
}
// If the current candidate is not resolved, then try to resolve
// it, which will also merge packages while verify constraints.
@@ -271,17 +265,12 @@
//System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
//System.out.println("+++ currentConstraints : " + currentConstraints);
checkConsistency(
- module, capGoal, candidateMap, existingConstraintsCopy, currentConstraintsCopy);
+ module, null, candidateMap, existingConstraints, currentConstraintsCopy);
// If we are here, then the candidates were consistent with
// existing constraints, so cache the result.
- m_resolvingConstraintCache.put(module, existingConstraintsCopy);
- // Finally, modify the original existing constraints.
- existingConstrains.putAll(existingConstraintsCopy);
+ m_resolvingConstraintCache.put(module, existingConstraints);
}
- // Update the cycle map to mark the module as finished.
- cycleMap.put(module, Boolean.TRUE);
-
// Return the updated candidate map.
return candidateMap;
}