Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 24677 invoked from network); 8 Dec 2009 21:47:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Dec 2009 21:47:15 -0000 Received: (qmail 41252 invoked by uid 500); 8 Dec 2009 21:47:15 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 41211 invoked by uid 500); 8 Dec 2009 21:47:14 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 41202 invoked by uid 99); 8 Dec 2009 21:47:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 21:47:14 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Dec 2009 21:47:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 768382388996; Tue, 8 Dec 2009 21:46:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r888579 - /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java Date: Tue, 08 Dec 2009 21:46:33 -0000 To: commits@felix.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091208214649.768382388996@eris.apache.org> Author: rickhall Date: Tue Dec 8 21:46:09 2009 New Revision: 888579 URL: http://svn.apache.org/viewvc?rev=888579&view=rev Log: Some renaming. 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=888579&r1=888578&r2=888579&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 21:46:09 2009 @@ -133,15 +133,15 @@ List reqs = module.getRequirements(); for (Requirement req : reqs) { - Set exporters = findExporters(req); - if ((exporters.size() == 0) && !req.isOptional()) + Set candidates = findCandidates(req); + if ((candidates.size() == 0) && !req.isOptional()) { throw new RuntimeException("Unable to resolve " + module + ": missing requirement " + req); } - else if (exporters.size() > 0) + else if (candidates.size() > 0) { - candidateMap.put(req, exporters); + candidateMap.put(req, candidates); } } @@ -176,19 +176,19 @@ for (Requirement req : reqs) { // Get the current candidate capability for the current import. - Set exporters = candidateMap.get(req); + Set candidates = candidateMap.get(req); // Optional imports may not have any exporters. - if (exporters == null) + if (candidates == null) { continue; } // Find a consistent candidate. Capability selectedCandidate = null; - Iterator itExporters = exporters.iterator(); - while ((selectedCandidate == null) && itExporters.hasNext()) + Iterator itCandidates = candidates.iterator(); + while ((selectedCandidate == null) && itCandidates.hasNext()) { - Capability cap = itExporters.next(); + Capability cap = itCandidates.next(); //System.out.println("+++ RESOLVING " + cap + " FOR " + module); try { @@ -235,9 +235,9 @@ ex.printStackTrace(); //System.out.println("Current candidate map : " + candidateMap); // Remove offending candidate. - itExporters.remove(); + itCandidates.remove(); //System.out.println("Updated candidate map : " + candidateMap); - if (!itExporters.hasNext() && !req.isOptional()) + if (!itCandidates.hasNext() && !req.isOptional()) { candidateMap.remove(req); rethrow = new ResolveException("Unresolved constraint " @@ -339,15 +339,15 @@ // those instead, otherwise find the matching providers. if (candidateMap.get(req) == null) { - Set exporters = findExporters(req); - if ((exporters.size() == 0) && !req.isOptional()) + Set candidates = findCandidates(req); + if ((candidates.size() == 0) && !req.isOptional()) { throw new RuntimeException("Unable to resolve " + module + ": missing requirement " + req); } - else if (exporters.size() > 0) + else if (candidates.size() > 0) { - candidateMap.put(req, exporters); + candidateMap.put(req, candidates); } } } @@ -368,19 +368,19 @@ for (Requirement req : reqs) { // Get the current candidate capability for the current import. - Set exporters = candidateMap.get(req); + Set candidates = candidateMap.get(req); // Optional imports may not have any exporters. - if (exporters == null) + if (candidates == null) { continue; } // Find a consistent candidate. Capability selectedCandidate = null; - Iterator itExporters = exporters.iterator(); - while ((selectedCandidate == null) && itExporters.hasNext()) + Iterator itCandidates = candidates.iterator(); + while ((selectedCandidate == null) && itCandidates.hasNext()) { - Capability cap = itExporters.next(); + Capability cap = itCandidates.next(); //System.out.println("+++ RESOLVING " + cap + " FOR " + module); try { @@ -427,9 +427,9 @@ ex.printStackTrace(); //System.out.println("Current candidate map : " + candidateMap); // Remove offending candidate. - itExporters.remove(); + itCandidates.remove(); //System.out.println("Updated candidate map : " + candidateMap); - if (!itExporters.hasNext() && !req.isOptional()) + if (!itCandidates.hasNext() && !req.isOptional()) { candidateMap.remove(req); throw new ResolveException("Unresolved constraint " @@ -478,10 +478,10 @@ it.hasNext(); ) { Entry entry = it.next(); - if (entry.getValue().m_exportedPackage.getModule() == module) + if (entry.getValue().m_capability.getModule() == module) { constraintsCopy.put( - entry.getKey(), new Blame(entry.getValue().m_exportedPackage, blameModule)); + entry.getKey(), new Blame(entry.getValue().m_capability, blameModule)); } else { @@ -492,7 +492,7 @@ return constraintsCopy; } - private Set findExporters(Requirement req) + private Set findCandidates(Requirement req) { if (m_isInvokeCount) { @@ -576,7 +576,7 @@ { Entry entry = it.next(); constraintsCopy.put( - entry.getKey(), new Blame(entry.getValue().m_exportedPackage, blameModule)); + entry.getKey(), new Blame(entry.getValue().m_capability, blameModule)); } constraints = constraintsCopy; } @@ -629,11 +629,11 @@ Entry entry = it.next(); Blame current = currentConstraints.get(entry.getKey()); if ((current != null) - && !current.m_exportedPackage.equals(entry.getValue().m_exportedPackage)) + && !current.m_capability.equals(entry.getValue().m_capability)) { throw new ResolveConflictException("Unable to resolve " + blameModule + ": constraint conflict with '" - + current.m_exportedPackage.getAttribute(Capability.PACKAGE_ATTR).getValue() + + current.m_capability.getAttribute(Capability.PACKAGE_ATTR).getValue() + "' between " + current + " and " + entry.getValue()); } @@ -685,10 +685,10 @@ it.hasNext(); ) { Entry entry = it.next(); - if (entry.getValue().m_exportedPackage.getModule() == capTarget.getModule()) + if (entry.getValue().m_capability.getModule() == capTarget.getModule()) { constraintsCopy.put( - entry.getKey(), new Blame(entry.getValue().m_exportedPackage, blameModule)); + entry.getKey(), new Blame(entry.getValue().m_capability, blameModule)); } else { @@ -850,7 +850,7 @@ } if ((existing != null) - && !existing.m_exportedPackage.equals(current.m_exportedPackage)) + && !existing.m_capability.equals(current.m_capability)) { //System.out.println("Conflict: " + existing.m_exportedPackage + " WITH " + current.m_exportedPackage); //System.out.println("Blame: " + existing.m_blameModules + " AND " + current.m_blameModules); @@ -885,7 +885,7 @@ candidateMapCopy.get(blameImports.get(impIdx)).iterator(); cmIt.hasNext(); ) { - if (cmIt.next().getModule().equals(existing.m_exportedPackage.getModule())) + if (cmIt.next().getModule().equals(existing.m_capability.getModule())) { cmIt.remove(); modified = true; @@ -924,7 +924,7 @@ if (current != null) { - List uses = current.m_exportedPackage.getUses(); + List uses = current.m_capability.getUses(); for (int usesIdx = 0; usesIdx < uses.size(); usesIdx++) { verifyUses(targetModule, uses.get(usesIdx), candidateMap, @@ -1018,18 +1018,18 @@ public static class Blame { - public final Capability m_exportedPackage; + public final Capability m_capability; public final List m_blameModules; - public Blame(Capability exportedPackage, Module blameModule) + public Blame(Capability cap, Module blameModule) { - m_exportedPackage = exportedPackage; + m_capability = cap; m_blameModules = new ArrayList(); m_blameModules.add(blameModule); } public String toString() { - return m_exportedPackage.getModule() + " {Blamed on " + m_blameModules + "}"; + return m_capability.getModule() + " {Blamed on " + m_blameModules + "}"; } }