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/14 21:55:12 UTC

svn commit: r890475 - in /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver: manifestparser/Main.java prototype/ProtoResolver.java

Author: rickhall
Date: Mon Dec 14 20:54:44 2009
New Revision: 890475

URL: http://svn.apache.org/viewvc?rev=890475&view=rev
Log:
Minor reformatting.

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=890475&r1=890474&r2=890475&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 Mon Dec 14 20:54:44 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=890475&r1=890474&r2=890475&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 Mon Dec 14 20:54:44 2009
@@ -225,6 +225,7 @@
                                     // resolved, then just directly add it as a constraint.
                                     else if (cap.getModule().equals(module))
                                     {
+// TODO: PROTO RESOLVER - This only makes sense for package requirements.
                                         currentConstraintsCopy.put(
                                             (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
                                             new Blame(cap, module));
@@ -421,6 +422,7 @@
                             // resolved, then just directly add it as a constraint.
                             else if (cap.getModule().equals(module))
                             {
+// TODO: PROTO RESOLVER - This only makes sense for package requirements.
                                 currentConstraintsCopy.put(
                                     (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
                                     new Blame(cap, blameModule));
@@ -502,11 +504,13 @@
         for (Iterator<Map.Entry<String, Blame>> it = constraints.entrySet().iterator();
             it.hasNext(); )
         {
+// TODO: PROTO RESOLVER - Should blame modules be merged here?
             Entry<String, Blame> entry = it.next();
             if (entry.getValue().m_capability.getModule() == module)
             {
                 constraintsCopy.put(
-                    entry.getKey(), new Blame(entry.getValue().m_capability, blameModule));
+                    entry.getKey(),
+                    new Blame(entry.getValue().m_capability, blameModule));
             }
             else
             {
@@ -534,8 +538,9 @@
                 Capability cap2 = (Capability) arg2;
                 if (cap1.getNamespace().equals(Capability.MODULE_NAMESPACE))
                 {
-                    int c = ((Comparable) cap1.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE).getValue())
-                        .compareTo(cap2.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE).getValue());
+                    int c = ((Comparable) cap1.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
+                        .getValue()).compareTo(cap2.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
+                            .getValue());
                     if (c == 0)
                     {
                         Version v1 = (cap1.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE) == null)
@@ -633,13 +638,15 @@
         // blame module correctly.
         else
         {
+// TODO: PROTO RESOLVER - Should blame modules be merged here?
             HashMap<String, Blame> constraintsCopy = new HashMap<String, Blame>();
             for (Iterator<Map.Entry<String, Blame>> it = constraints.entrySet().iterator();
                 it.hasNext(); )
             {
                 Entry<String, Blame> entry = it.next();
                 constraintsCopy.put(
-                    entry.getKey(), new Blame(entry.getValue().m_capability, blameModule));
+                    entry.getKey(),
+                    new Blame(entry.getValue().m_capability, blameModule));
             }
             constraints = constraintsCopy;
         }
@@ -727,8 +734,10 @@
         {
             constraints = new HashMap<String, Blame>();
 
+// TODO: PROTO RESOLVER - This only makes sense for package capabilities.
             // The capability itself is a constraint, so add it.
-            constraints.put((String) capTarget.getAttribute(Capability.PACKAGE_ATTR).getValue(),
+            constraints.put(
+                (String) capTarget.getAttribute(Capability.PACKAGE_ATTR).getValue(),
                 new Blame(capTarget, blameModule));
 
             // Calculate implied constraints.
@@ -745,6 +754,7 @@
         // blame module correctly.
         else
         {
+// TODO: PROTO RESOLVER - Should blame modules be merged here?
             HashMap<String, Blame> constraintsCopy = new HashMap<String, Blame>();
             for (Iterator<Map.Entry<String, Blame>> it = constraints.entrySet().iterator();
                 it.hasNext(); )
@@ -753,7 +763,8 @@
                 if (entry.getValue().m_capability.getModule() == capTarget.getModule())
                 {
                     constraintsCopy.put(
-                        entry.getKey(), new Blame(entry.getValue().m_capability, blameModule));
+                        entry.getKey(),
+                        new Blame(entry.getValue().m_capability, blameModule));
                 }
                 else
                 {
@@ -810,7 +821,8 @@
                 (capSource == null) && (capIdx < capTarget.getModule().getCapabilities().size());
                 capIdx++)
             {
-                if (capTarget.getModule().getCapabilities().get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE)
+                if (capTarget.getModule().getCapabilities().get(capIdx).getNamespace()
+                        .equals(Capability.PACKAGE_NAMESPACE)
                     && capTarget.getModule().getCapabilities().get(capIdx)
                         .getAttribute(Capability.PACKAGE_ATTR).getValue().equals(uses.get(usesIdx)))
                 {
@@ -820,7 +832,8 @@
 
             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);
             }
         }
@@ -949,18 +962,22 @@
                     for (int impIdx = 0; impIdx < blameImports.size(); impIdx++)
                     {
                         // TODO: PROTO RESOLVER - Not efficient at all.
-                        // TODO: PROTO RESOLVER - This comment out part is too narrow, since it could
-                        // also check for other candidates that imply the conficting package.
+                        // TODO: PROTO RESOLVER - This comment out part is too narrow,
+                        // since it could also check for other candidates that imply the
+                        // conficting package.
                         // Works for scenario 9, but it fails for scenario 1.
 //                        if (blameImports.get(impIdx).getName().equals(pkgName)
-//                            && candidateMapCopy.get(blameImports.get(impIdx)).contains(existing.m_provider))
-                        // TODO: PROTO RESOLVER - This comment out part is too broad, since it removes
-                        // the conflicting module from all candidate lists.
+//                            && candidateMapCopy.get(blameImports.get(impIdx))
+//                                .contains(existing.m_provider))
+                        // TODO: PROTO RESOLVER - This comment out part is too broad,
+                        // since it removes the conflicting module from all candidate lists.
                         // Works for scenario 1, but fails for scenario 9.
-//System.out.println("CHECKING " + candidateMapCopy.get(blameImports.get(impIdx)) + " FOR " + existing.m_capability);
+//System.out.println("CHECKING " + candidateMapCopy.get(blameImports.get(impIdx))
+//    + " FOR " + existing.m_capability);
 //System.out.println("+++ candidateMapCopy " + candidateMapCopy);
 //System.out.println("+++ blameImports.get(impIdx) " + blameImports.get(impIdx));
-//System.out.println("+++ candidateMapCopy.get(blameImports.get(impIdx)) " + candidateMapCopy.get(blameImports.get(impIdx)));
+//System.out.println("+++ candidateMapCopy.get(blameImports.get(impIdx)) "
+//    + candidateMapCopy.get(blameImports.get(impIdx)));
                         Set<Capability> caps = candidateMapCopy.get(blameImports.get(impIdx));
                         if (caps != null)
                         {
@@ -1102,6 +1119,7 @@
     {
         public final Capability m_capability;
         public final List<Module> m_blameModules;
+
         public Blame(Capability cap, Module blameModule)
         {
             m_capability = cap;