felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
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 GMT
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<Requirement> reqs = module.getRequirements();
                 for (Requirement req : reqs)
                 {
-                    Set<Capability> exporters = findExporters(req);
-                    if ((exporters.size() == 0) && !req.isOptional())
+                    Set<Capability> 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<Capability> exporters = candidateMap.get(req);
+                        Set<Capability> 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<Capability> itExporters = exporters.iterator();
-                        while ((selectedCandidate == null) && itExporters.hasNext())
+                        Iterator<Capability> 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<Capability> exporters = findExporters(req);
-                        if ((exporters.size() == 0) && !req.isOptional())
+                        Set<Capability> 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<Capability> exporters = candidateMap.get(req);
+                    Set<Capability> 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<Capability> itExporters = exporters.iterator();
-                    while ((selectedCandidate == null) && itExporters.hasNext())
+                    Iterator<Capability> 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<String, Blame> 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<Capability> findExporters(Requirement req)
+    private Set<Capability> findCandidates(Requirement req)
     {
         if (m_isInvokeCount)
         {
@@ -576,7 +576,7 @@
             {
                 Entry<String, Blame> 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<String, Blame> 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<String, Blame> 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<String> uses = current.m_exportedPackage.getUses();
+            List<String> 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<Module> m_blameModules;
-        public Blame(Capability exportedPackage, Module blameModule)
+        public Blame(Capability cap, Module blameModule)
         {
-            m_exportedPackage = exportedPackage;
+            m_capability = cap;
             m_blameModules = new ArrayList<Module>();
             m_blameModules.add(blameModule);
         }
 
         public String toString()
         {
-            return m_exportedPackage.getModule() + " {Blamed on " + m_blameModules + "}";
+            return m_capability.getModule() + " {Blamed on " + m_blameModules + "}";
         }
     }
 



Mime
View raw message