felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r488409 - in /incubator/felix/trunk/framework/src/main/java/org/apache/felix: framework/ framework/cache/ framework/searchpolicy/ framework/util/ framework/util/manifestparser/ moduleloader/
Date Mon, 18 Dec 2006 20:47:57 GMT
Author: rickhall
Date: Mon Dec 18 12:47:55 2006
New Revision: 488409

URL: http://svn.apache.org/viewvc?view=rev&rev=488409
Log:
Some reorganization to get more manifest parsing functionality grouped
together. (FELIX-98)

Added:
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Attribute.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Directive.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Export.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Import.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryClause.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Package.java
      - copied, changed from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
Removed:
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Attribute.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Directive.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryClause.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java
Modified:
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
Mon Dec 18 12:47:55 2006
@@ -18,7 +18,7 @@
  */
 package org.apache.felix.framework;
 
-import org.apache.felix.framework.searchpolicy.R4Export;
+import org.apache.felix.framework.util.manifestparser.R4Export;
 import org.apache.felix.moduleloader.IModule;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Mon
Dec 18 12:47:55 2006
@@ -24,12 +24,15 @@
 import java.security.CodeSource;
 import java.security.ProtectionDomain;
 import java.util.*;
-
-import org.apache.felix.framework.cache.*;
+import org.apache.felix.framework.cache.BundleArchive;
+import org.apache.felix.framework.cache.BundleCache;
+import org.apache.felix.framework.cache.SystemBundleArchive;
 import org.apache.felix.framework.searchpolicy.*;
 import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.manifestparser.*;
 import org.apache.felix.moduleloader.*;
 import org.osgi.framework.*;
+
 import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.startlevel.StartLevel;
 

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
Mon Dec 18 12:47:55 2006
@@ -20,7 +20,7 @@
 
 import java.util.*;
 
-import org.apache.felix.framework.searchpolicy.VersionRange;
+import org.apache.felix.framework.util.VersionRange;
 import org.osgi.framework.*;
 import org.osgi.service.packageadmin.*;
 

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/SystemBundle.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
Mon Dec 18 12:47:55 2006
@@ -22,8 +22,10 @@
 import java.util.*;
 
 import org.apache.felix.framework.cache.SystemBundleArchive;
-import org.apache.felix.framework.searchpolicy.*;
-import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
+import org.apache.felix.framework.util.manifestparser.R4Export;
 import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.*;
 

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
Mon Dec 18 12:47:55 2006
@@ -24,7 +24,9 @@
 import java.util.jar.*;
 
 import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
 import org.apache.felix.moduleloader.*;
 
 /**
@@ -122,7 +124,7 @@
             ? null : (String) map.get(FelixConstants.BUNDLE_CLASSPATH);
 
         // Parse the class path into strings.
-        String[] classPathStrings = Util.parseDelimitedString(
+        String[] classPathStrings = ManifestParser.parseDelimitedString(
             classPath, FelixConstants.CLASS_PATH_SEPARATOR);
 
         if (classPathStrings == null)

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
Mon Dec 18 12:47:55 2006
@@ -28,7 +28,10 @@
 import java.util.zip.ZipEntry;
 
 import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.Util;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
 import org.apache.felix.moduleloader.*;
 
 /**
@@ -134,7 +137,7 @@
             ? null : (String) map.get(FelixConstants.BUNDLE_CLASSPATH);
 
         // Parse the class path into strings.
-        String[] classPathStrings = Util.parseDelimitedString(
+        String[] classPathStrings = ManifestParser.parseDelimitedString(
             classPath, FelixConstants.CLASS_PATH_SEPARATOR);
 
         if (classPathStrings == null)
@@ -357,7 +360,7 @@
                 ? null : (String) map.get(FelixConstants.BUNDLE_CLASSPATH);
 
             // Parse the class path into strings.
-            String[] classPathStrings = Util.parseDelimitedString(
+            String[] classPathStrings = ManifestParser.parseDelimitedString(
                 classPath, FelixConstants.CLASS_PATH_SEPARATOR);
 
             if (classPathStrings == null)

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
Mon Dec 18 12:47:55 2006
@@ -18,6 +18,9 @@
  */
 package org.apache.felix.framework.searchpolicy;
 
+import org.apache.felix.framework.util.manifestparser.R4Export;
+import org.apache.felix.framework.util.manifestparser.R4Import;
+import org.apache.felix.framework.util.manifestparser.R4Library;
 import org.apache.felix.moduleloader.IModuleDefinition;
 
 public class ModuleDefinition implements IModuleDefinition

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Mon Dec 18 12:47:55 2006
@@ -25,6 +25,7 @@
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.manifestparser.*;
 import org.apache.felix.moduleloader.*;
 import org.osgi.framework.*;
 

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
Mon Dec 18 12:47:55 2006
@@ -22,6 +22,7 @@
 import java.util.Enumeration;
 
 import org.apache.felix.framework.util.Util;
+import org.apache.felix.framework.util.manifestparser.R4Export;
 import org.apache.felix.moduleloader.*;
 
 public class R4Wire implements IWire

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
Mon Dec 18 12:47:55 2006
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.framework.searchpolicy;
 
+import org.apache.felix.framework.util.manifestparser.R4Package;
 import org.apache.felix.moduleloader.IModule;
 
 /**

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
Mon Dec 18 12:47:55 2006
@@ -24,6 +24,9 @@
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.framework.util.manifestparser.R4Export;
+import org.apache.felix.framework.util.manifestparser.R4Import;
+import org.apache.felix.framework.util.manifestparser.R4LibraryClause;
 import org.apache.felix.moduleloader.IModule;
 import org.apache.felix.moduleloader.IWire;
 
@@ -228,100 +231,6 @@
             }
         }
         return null;
-    }
-
-    /**
-     * Parses delimited string and returns an array containing the tokens. This
-     * parser obeys quotes, so the delimiter character will be ignored if it is
-     * inside of a quote. This method assumes that the quote character is not
-     * included in the set of delimiter characters.
-     * @param value the delimited string to parse.
-     * @param delim the characters delimiting the tokens.
-     * @return an array of string tokens or null if there were no tokens.
-    **/
-    public static String[] parseDelimitedString(String value, String delim)
-    {
-        if (value == null)
-        {
-           value = "";
-        }
-
-        List list = new ArrayList();
-
-        int CHAR = 1;
-        int DELIMITER = 2;
-        int STARTQUOTE = 4;
-        int ENDQUOTE = 8;
-
-        StringBuffer sb = new StringBuffer();
-
-        int expecting = (CHAR | DELIMITER | STARTQUOTE);
-        
-        for (int i = 0; i < value.length(); i++)
-        {
-            char c = value.charAt(i);
-
-            boolean isDelimiter = (delim.indexOf(c) >= 0);
-            boolean isQuote = (c == '"');
-
-            if (isDelimiter && ((expecting & DELIMITER) > 0))
-            {
-                list.add(sb.toString().trim());
-                sb.delete(0, sb.length());
-                expecting = (CHAR | DELIMITER | STARTQUOTE);
-            }
-            else if (isQuote && ((expecting & STARTQUOTE) > 0))
-            {
-                sb.append(c);
-                expecting = CHAR | ENDQUOTE;
-            }
-            else if (isQuote && ((expecting & ENDQUOTE) > 0))
-            {
-                sb.append(c);
-                expecting = (CHAR | STARTQUOTE | DELIMITER);
-            }
-            else if ((expecting & CHAR) > 0)
-            {
-                sb.append(c);
-            }
-            else
-            {
-                throw new IllegalArgumentException("Invalid delimited string: " + value);
-            }
-        }
-
-        if (sb.length() > 0)
-        {
-            list.add(sb.toString().trim());
-        }
-
-        return (String[]) list.toArray(new String[list.size()]);
-    }
-
-    /**
-     * Parses native code manifest headers.
-     * @param libStrs an array of native library manifest header
-     *        strings from the bundle manifest.
-     * @return an array of <tt>LibraryInfo</tt> objects for the
-     *         passed in strings.
-    **/
-    public static R4LibraryClause[] parseLibraryStrings(Logger logger, String[] libStrs)
-        throws IllegalArgumentException
-    {
-        if (libStrs == null)
-        {
-            return new R4LibraryClause[0];
-        }
-
-        List libList = new ArrayList();
-
-        for (int i = 0; i < libStrs.length; i++)
-        {
-            R4LibraryClause clause = R4LibraryClause.parse(logger, libStrs[i]);
-            libList.add(clause);
-        }
-
-        return (R4LibraryClause[]) libList.toArray(new R4LibraryClause[libList.size()]);
     }
 
     private static final byte encTab[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
Mon Dec 18 12:47:55 2006
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util;
 
 import org.osgi.framework.Version;
 

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Mon Dec 18 12:47:55 2006
@@ -16,13 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.util;
+package org.apache.felix.framework.util.manifestparser;
 
 import java.util.*;
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.cache.BundleRevision;
 import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.framework.util.*;
 import org.osgi.framework.*;
 
 public class ManifestParser
@@ -224,9 +225,9 @@
 
         // Get native library entry names for module library sources.
         m_libraryHeaders =
-            Util.parseLibraryStrings(
+            parseLibraryStrings(
                 m_logger,
-                Util.parseDelimitedString((String) m_headerMap.get(Constants.BUNDLE_NATIVECODE),
","));
+                parseDelimitedString((String) m_headerMap.get(Constants.BUNDLE_NATIVECODE),
","));
 
         // Check to see if there was an optional native library clause, which is
         // represented by a null library header; if so, record it and remove it.
@@ -808,7 +809,7 @@
                     "A header cannot be an empty string.");
             }
 
-            String[] clauseStrings = Util.parseDelimitedString(
+            String[] clauseStrings = parseDelimitedString(
                 header, FelixConstants.CLASS_PATH_SEPARATOR);
 
             List completeList = new ArrayList();
@@ -827,7 +828,7 @@
         throws IllegalArgumentException
     {
         // Break string into semi-colon delimited pieces.
-        String[] pieces = Util.parseDelimitedString(
+        String[] pieces = parseDelimitedString(
             clauseString, FelixConstants.PACKAGE_SEPARATOR);
 
         // Count the number of different paths; paths
@@ -925,5 +926,99 @@
         clause[CLAUSE_ATTRIBUTES_INDEX] = attrs;
 
         return clause;
+    }
+
+    /**
+     * Parses delimited string and returns an array containing the tokens. This
+     * parser obeys quotes, so the delimiter character will be ignored if it is
+     * inside of a quote. This method assumes that the quote character is not
+     * included in the set of delimiter characters.
+     * @param value the delimited string to parse.
+     * @param delim the characters delimiting the tokens.
+     * @return an array of string tokens or null if there were no tokens.
+    **/
+    public static String[] parseDelimitedString(String value, String delim)
+    {
+        if (value == null)
+        {
+           value = "";
+        }
+
+        List list = new ArrayList();
+
+        int CHAR = 1;
+        int DELIMITER = 2;
+        int STARTQUOTE = 4;
+        int ENDQUOTE = 8;
+
+        StringBuffer sb = new StringBuffer();
+
+        int expecting = (CHAR | DELIMITER | STARTQUOTE);
+        
+        for (int i = 0; i < value.length(); i++)
+        {
+            char c = value.charAt(i);
+
+            boolean isDelimiter = (delim.indexOf(c) >= 0);
+            boolean isQuote = (c == '"');
+
+            if (isDelimiter && ((expecting & DELIMITER) > 0))
+            {
+                list.add(sb.toString().trim());
+                sb.delete(0, sb.length());
+                expecting = (CHAR | DELIMITER | STARTQUOTE);
+            }
+            else if (isQuote && ((expecting & STARTQUOTE) > 0))
+            {
+                sb.append(c);
+                expecting = CHAR | ENDQUOTE;
+            }
+            else if (isQuote && ((expecting & ENDQUOTE) > 0))
+            {
+                sb.append(c);
+                expecting = (CHAR | STARTQUOTE | DELIMITER);
+            }
+            else if ((expecting & CHAR) > 0)
+            {
+                sb.append(c);
+            }
+            else
+            {
+                throw new IllegalArgumentException("Invalid delimited string: " + value);
+            }
+        }
+
+        if (sb.length() > 0)
+        {
+            list.add(sb.toString().trim());
+        }
+
+        return (String[]) list.toArray(new String[list.size()]);
+    }
+
+    /**
+     * Parses native code manifest headers.
+     * @param libStrs an array of native library manifest header
+     *        strings from the bundle manifest.
+     * @return an array of <tt>LibraryInfo</tt> objects for the
+     *         passed in strings.
+    **/
+    public static R4LibraryClause[] parseLibraryStrings(Logger logger, String[] libStrs)
+        throws IllegalArgumentException
+    {
+        if (libStrs == null)
+        {
+            return new R4LibraryClause[0];
+        }
+
+        List libList = new ArrayList();
+
+        for (int i = 0; i < libStrs.length; i++)
+        {
+            R4LibraryClause clause = R4LibraryClause.parse(logger, libStrs[i]);
+            libList.add(clause);
+        }
+
+        return (R4LibraryClause[]) libList.toArray(new R4LibraryClause[libList.size()]);
     }
 }

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Attribute.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Attribute.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Attribute.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Attribute.java
Mon Dec 18 12:47:55 2006
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 public class R4Attribute
 {

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Directive.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Directive.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Directive.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Directive.java
Mon Dec 18 12:47:55 2006
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 public class R4Directive
 {

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Export.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Export.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Export.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Export.java
Mon Dec 18 12:47:55 2006
@@ -16,10 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 import java.util.*;
-
 import org.apache.felix.framework.util.Util;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
@@ -48,7 +47,7 @@
             }
             else if (m_directives[i].getName().equals(Constants.INCLUDE_DIRECTIVE))
             {
-                String[] ss = Util.parseDelimitedString(m_directives[i].getValue(), ",");
+                String[] ss = ManifestParser.parseDelimitedString(m_directives[i].getValue(),
",");
                 m_includeFilter = new String[ss.length][];
                 for (int filterIdx = 0; filterIdx < ss.length; filterIdx++)
                 {
@@ -57,7 +56,7 @@
             }
             else if (m_directives[i].getName().equals(Constants.EXCLUDE_DIRECTIVE))
             {
-                String[] ss = Util.parseDelimitedString(m_directives[i].getValue(), ",");
+                String[] ss = ManifestParser.parseDelimitedString(m_directives[i].getValue(),
",");
                 m_excludeFilter = new String[ss.length][];
                 for (int filterIdx = 0; filterIdx < ss.length; filterIdx++)
                 {

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Import.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Import.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Import.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Import.java
Mon Dec 18 12:47:55 2006
@@ -16,8 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
+import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.framework.util.VersionRange;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
Mon Dec 18 12:47:55 2006
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.cache.BundleRevision;

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryClause.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryClause.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryClause.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
Mon Dec 18 12:47:55 2006
@@ -16,14 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 import java.util.*;
-
 import org.apache.felix.framework.FilterImpl;
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.PropertyResolver;
+
+import org.apache.felix.framework.util.VersionRange;
 import org.osgi.framework.*;
 
 public class R4LibraryClause

Copied: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Package.java
(from r488323, incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java)
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Package.java?view=diff&rev=488409&p1=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java&r1=488323&p2=incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Package.java&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Package.java
Mon Dec 18 12:47:55 2006
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.searchpolicy;
+package org.apache.felix.framework.util.manifestparser;
 
 import org.osgi.framework.Version;
 

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java
Mon Dec 18 12:47:55 2006
@@ -18,6 +18,9 @@
  */
 package org.apache.felix.moduleloader;
 
+import org.apache.felix.framework.util.manifestparser.R4Import;
+import org.apache.felix.framework.util.manifestparser.R4Export;
+import org.apache.felix.framework.util.manifestparser.R4Library;
 import org.apache.felix.framework.searchpolicy.*;
 
 public interface IModuleDefinition

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java?view=diff&rev=488409&r1=488408&r2=488409
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IWire.java
Mon Dec 18 12:47:55 2006
@@ -21,7 +21,7 @@
 import java.net.URL;
 import java.util.Enumeration;
 
-import org.apache.felix.framework.searchpolicy.R4Export;
+import org.apache.felix.framework.util.manifestparser.R4Export;
 
 public interface IWire
 {



Mime
View raw message