felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r905368 - in /felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework: ./ resolver/ util/ util/manifestparser/
Date Mon, 01 Feb 2010 18:59:02 GMT
Author: rickhall
Date: Mon Feb  1 18:59:01 2010
New Revision: 905368

URL: http://svn.apache.org/viewvc?rev=905368&view=rev
Log:
More fixes.

Modified:
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/BundleImpl.java
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/Util.java
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
    felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/BundleImpl.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/BundleImpl.java
Mon Feb  1 18:59:01 2010
@@ -470,7 +470,11 @@
         // Create a list of the module and any attached fragments.
         List result = new ArrayList();
         result.add(module);
-        result.add(module.getFragments());
+        List<Module> fragments = module.getFragments();
+        if (fragments != null)
+        {
+            result.addAll(fragments);
+        }
         return result;
     }
 

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
Mon Feb  1 18:59:01 2010
@@ -30,7 +30,7 @@
     private final List<Module> m_modules;
     private int m_moduleIndex = 0;
     private final String m_path;
-    private final String[] m_filePattern;
+    private final List<String> m_filePattern;
     private final boolean m_recurse;
     private Object m_next = null;
 

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/resolver/WireImpl.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
Mon Feb  1 18:59:01 2010
@@ -25,6 +25,7 @@
 import org.apache.felix.framework.capabilityset.Requirement;
 import org.apache.felix.framework.capabilityset.Wire;
 import org.apache.felix.framework.util.Util;
+import org.apache.felix.framework.util.manifestparser.CapabilityImpl;
 import org.apache.felix.moduleloader.ResourceNotFoundException;
 
 public class WireImpl implements Wire
@@ -96,8 +97,7 @@
             // to the exporting module, rather than its content, so it can
             // it can follow any internal wires it may have (e.g., if the
             // package has multiple sources).
-// TODO: FELIX3 - Implement package filter!
-//            if (m_cap.isIncluded(name))
+            if (((CapabilityImpl) m_cap).isIncluded(name))
             {
                 clazz = m_exporter.getClassByDelegation(name);
             }

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/Util.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/Util.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/Util.java
Mon Feb  1 18:59:01 2010
@@ -536,9 +536,9 @@
     // from the LDAP parser code.
     //
 
-    public static String[] parseSubstring(String target)
+    public static List<String> parseSubstring(String target)
     {
-        List pieces = new ArrayList();
+        ArrayList pieces = new ArrayList();
         StringBuffer ss = new StringBuffer();
         // int kind = SIMPLE; // assume until proven otherwise
         boolean wasStar = false; // indicates last piece was a star
@@ -610,10 +610,11 @@
                 pieces.add(0, "");
             }
         }
-        return (String[]) pieces.toArray(new String[pieces.size()]);
+        pieces.trimToSize();
+        return pieces;
     }
 
-    public static boolean checkSubstring(String[] pieces, String s)
+    public static boolean checkSubstring(List<String> pieces, String s)
     {
         // Walk the pieces to match the string
         // There are implicit stars between each piece,
@@ -622,11 +623,11 @@
         // minimal case is <string>*<string>
 
         boolean result = false;
-        int len = pieces.length;
+        int len = pieces.size();
 
 loop:   for (int i = 0; i < len; i++)
         {
-            String piece = pieces[i];
+            String piece = pieces.get(i);
             int index = 0;
             if (i == len - 1)
             {

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
Mon Feb  1 18:59:01 2010
@@ -83,13 +83,8 @@
 
                 for (int filterIdx = 0; filterIdx < filters.size(); filterIdx++)
                 {
-                    String[] substrings = Util.parseSubstring(filters.get(filterIdx));
-                    List<String> l = new ArrayList<String>(substrings.length);
-                    for (int subIdx = 0; subIdx < substrings.length; subIdx++)
-                    {
-                        l.add(substrings[subIdx]);
-                    }
-                    filterList.add(l);
+                    List<String> substrings = Util.parseSubstring(filters.get(filterIdx));
+                    filterList.add(substrings);
                 }
 
                 if (m_dirs.get(dirIdx).getName().equals(Constants.INCLUDE_DIRECTIVE))
@@ -186,6 +181,38 @@
         return m_uses;
     }
 
+    public boolean isIncluded(String name)
+    {
+        if ((m_includeFilter == null) && (m_excludeFilter == null))
+        {
+            return true;
+        }
+
+        // Get the class name portion of the target class.
+        String className = Util.getClassName(name);
+
+        // If there are no include filters then all classes are included
+        // by default, otherwise try to find one match.
+        boolean included = (m_includeFilter == null);
+        for (int i = 0;
+            (!included) && (m_includeFilter != null) && (i < m_includeFilter.size());
+            i++)
+        {
+            included = Util.checkSubstring(m_includeFilter.get(i), className);
+        }
+
+        // If there are no exclude filters then no classes are excluded
+        // by default, otherwise try to find one match.
+        boolean excluded = false;
+        for (int i = 0;
+            (!excluded) && (m_excludeFilter != null) && (i < m_excludeFilter.size());
+            i++)
+        {
+            excluded = Util.checkSubstring(m_excludeFilter.get(i), className);
+        }
+        return included && !excluded;
+    }
+
     public String toString()
     {
         if (m_module == null)

Modified: felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=905368&r1=905367&r2=905368&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
(original)
+++ felix/sandbox/rickhall/framework-proto/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Mon Feb  1 18:59:01 2010
@@ -340,9 +340,7 @@
                 // is required.
                 if (clauses.get(clauseIdx).m_attrs.size() != 0)
                 {
-                    // R3 package requirements should only have name and
-                    // version attributes.
-                    Attribute pkgName = null;
+                    // R3 package requirements should only have version attributes.
                     Attribute pkgVersion =
                         new Attribute(Capability.VERSION_ATTR,
                             new VersionRange(Version.emptyVersion, true, null, true), false);
@@ -351,11 +349,6 @@
                         attrIdx++)
                     {
                         if (clauses.get(clauseIdx).m_attrs.get(attrIdx)
-                            .getName().equals(Capability.PACKAGE_ATTR))
-                        {
-                            pkgName = clauses.get(clauseIdx).m_attrs.get(attrIdx);
-                        }
-                        else if (clauses.get(clauseIdx).m_attrs.get(attrIdx)
                           .getName().equals(Capability.VERSION_ATTR))
                         {
                             pkgVersion = clauses.get(clauseIdx).m_attrs.get(attrIdx);
@@ -370,8 +363,7 @@
 
                     // Recreate the import to remove any other attributes
                     // and add version if missing.
-                    ArrayList<Attribute> attrs = new ArrayList<Attribute>(2);
-                    attrs.add(pkgName);
+                    ArrayList<Attribute> attrs = new ArrayList<Attribute>(1);
                     attrs.add(pkgVersion);
                     clauses.set(clauseIdx, new ParsedHeaderClause(
                         clauses.get(clauseIdx).m_paths,



Mime
View raw message