felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r889684 - in /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver: manifestparser/Main.java prototype/ProtoResolver.java
Date Fri, 11 Dec 2009 16:23:03 GMT
Author: rickhall
Date: Fri Dec 11 16:23:02 2009
New Revision: 889684

URL: http://svn.apache.org/viewvc?rev=889684&view=rev
Log:
Use separate indices for package vs module capabilities.

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=889684&r1=889683&r2=889684&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
Fri Dec 11 16:23:02 2009
@@ -317,7 +317,7 @@
                     if (module != null)
                     {
                         moduleList.add(module);
-//                        dumpModule(module);
+                        dumpModule(module);
                     }
                 }
             }
@@ -400,9 +400,9 @@
 
     private static Module getTarget(List<Module> modules)
     {
-        return getTargetByUnresolved(modules);
+//        return getTargetByUnresolved(modules);
 //        return getTargetBySymbolicName(modules, "org.springframework.faces");
-//        return getTargetBySymbolicName(modules, "bundle1");
+        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=889684&r1=889683&r2=889684&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
Fri Dec 11 16:23:02 2009
@@ -38,6 +38,7 @@
 {
     private final List<Module> m_moduleList;
     private final CapabilitySet m_pkgCapSet;
+    private final CapabilitySet m_modCapSet;
     private final Map<Module, Map<String, Blame>> m_moduleConstraintCache =
         new HashMap<Module, Map<String, Blame>>();
     private final Map<Module, Map<String, Blame>> m_resolvingConstraintCache
=
@@ -55,15 +56,28 @@
     {
 System.out.println("+++ PROTO RESOLVER");
         m_moduleList = moduleList;
+
         List indices = new ArrayList();
-        indices.add("package");
+        indices.add(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE);
+        m_modCapSet = new CapabilitySet(indices);
+
+        indices = new ArrayList();
+        indices.add(Capability.PACKAGE_ATTR);
         m_pkgCapSet = new CapabilitySet(indices);
+
         for (int modIdx = 0; modIdx < m_moduleList.size(); modIdx++)
         {
-            List<Capability> exports = m_moduleList.get(modIdx).getCapabilities();
-            for (int expIdx = 0; expIdx < exports.size(); expIdx++)
+            List<Capability> caps = m_moduleList.get(modIdx).getCapabilities();
+            for (int capIdx = 0; capIdx < caps.size(); capIdx++)
             {
-                m_pkgCapSet.addCapability(exports.get(expIdx));
+                if (caps.get(capIdx).getNamespace().equals(Capability.MODULE_NAMESPACE))
+                {
+                    m_modCapSet.addCapability(caps.get(capIdx));
+                }
+                else if (caps.get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+                {
+                    m_pkgCapSet.addCapability(caps.get(capIdx));
+                }
             }
         }
 
@@ -557,7 +571,15 @@
                 }
             }
         });
-        result.addAll(m_pkgCapSet.match(req.getFilter()));
+
+        if (req.getNamespace().equals(Capability.MODULE_NAMESPACE))
+        {
+            result.addAll(m_modCapSet.match(req.getFilter()));
+        }
+        else if (req.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+        {
+            result.addAll(m_pkgCapSet.match(req.getFilter()));
+        }
         return result;
     }
 



Mime
View raw message