felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r1829106 - in /felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework: ./ capabilityset/ util/ util/manifestparser/
Date Fri, 13 Apr 2018 21:20:53 GMT
Author: pauls
Date: Fri Apr 13 21:20:53 2018
New Revision: 1829106

URL: http://svn.apache.org/viewvc?rev=1829106&view=rev
Log:
FELIX-5824: Use VersionRange from OSGi and remove our own.

Removed:
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
Modified:
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/SimpleFilter.java
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
    felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java

Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java?rev=1829106&r1=1829105&r2=1829106&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
(original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
Fri Apr 13 21:20:53 2018
@@ -20,10 +20,10 @@ package org.apache.felix.framework;
 
 import java.util.*;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.util.VersionRange;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.VersionRange;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleRevisions;
 import org.osgi.framework.wiring.BundleWire;
@@ -75,7 +75,7 @@ public class PackageAdminImpl implements
     **/
     public Bundle[] getBundles(String symbolicName, String versionRange)
     {
-        VersionRange vr = (versionRange == null) ? null : VersionRange.parse(versionRange);
+        VersionRange vr = (versionRange == null) ? null : new VersionRange(versionRange);
         Bundle[] bundles = m_felix.getBundles();
         List list = new ArrayList();
         for (int i = 0; (bundles != null) && (i < bundles.length); i++)
@@ -84,7 +84,7 @@ public class PackageAdminImpl implements
             if ((sym != null) && sym.equals(symbolicName))
             {
                 Version v = bundles[i].adapt(BundleRevision.class).getVersion();
-                if ((vr == null) || vr.isInRange(v))
+                if ((vr == null) || vr.includes(v))
                 {
                     list.add(bundles[i]);
                 }

Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?rev=1829106&r1=1829105&r2=1829106&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
(original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
Fri Apr 13 21:20:53 2018
@@ -37,9 +37,9 @@ import java.util.concurrent.ConcurrentSk
 
 import org.apache.felix.framework.util.SecureAction;
 import org.apache.felix.framework.util.StringComparator;
-import org.apache.felix.framework.util.VersionRange;
 import org.apache.felix.framework.wiring.BundleCapabilityImpl;
 import org.osgi.framework.Version;
+import org.osgi.framework.VersionRange;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.resource.Capability;
 
@@ -409,7 +409,7 @@ public class CapabilitySet
 
             if(rhs != null && rhs instanceof VersionRange)
             {
-                return ((VersionRange)rhs).isInRange((Version)lhs);
+                return ((VersionRange)rhs).includes((Version)lhs);
             }
         }
 
@@ -595,7 +595,7 @@ public class CapabilitySet
             }
             else if(lhs instanceof Version && rhsString.indexOf(',') >= 0)
             {
-                rhs = VersionRange.parse(rhsString);
+                rhs = new VersionRange(rhsString);
             }
             else
             {

Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/SimpleFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/SimpleFilter.java?rev=1829106&r1=1829105&r2=1829106&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/SimpleFilter.java
(original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/capabilityset/SimpleFilter.java
Fri Apr 13 21:20:53 2018
@@ -18,11 +18,13 @@
  */
 package org.apache.felix.framework.capabilityset;
 
+import org.osgi.framework.Version;
+import org.osgi.framework.VersionRange;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import org.apache.felix.framework.util.VersionRange;
 
 public class SimpleFilter
 {
@@ -565,12 +567,12 @@ loop:   for (int i = 0; i < len; i++)
             if (entry.getValue() instanceof VersionRange)
             {
                 VersionRange vr = (VersionRange) entry.getValue();
-                if (vr.isFloorInclusive())
+                if (vr.getLeftType() == VersionRange.LEFT_CLOSED)
                 {
                     filters.add(
                         new SimpleFilter(
                             entry.getKey(),
-                            vr.getFloor().toString(),
+                            vr.getLeft().toString(),
                             SimpleFilter.GTE));
                 }
                 else
@@ -580,19 +582,19 @@ loop:   for (int i = 0; i < len; i++)
                     ((List) not.getValue()).add(
                         new SimpleFilter(
                             entry.getKey(),
-                            vr.getFloor().toString(),
+                            vr.getLeft().toString(),
                             SimpleFilter.LTE));
                     filters.add(not);
                 }
 
-                if (vr.getCeiling() != null)
+                if (vr.getRight() != null)
                 {
-                    if (vr.isCeilingInclusive())
+                    if (vr.getRightType() == VersionRange.RIGHT_CLOSED)
                     {
                         filters.add(
                             new SimpleFilter(
                                 entry.getKey(),
-                                vr.getCeiling().toString(),
+                                vr.getRight().toString(),
                                 SimpleFilter.LTE));
                     }
                     else
@@ -602,7 +604,7 @@ loop:   for (int i = 0; i < len; i++)
                         ((List) not.getValue()).add(
                             new SimpleFilter(
                                 entry.getKey(),
-                                vr.getCeiling().toString(),
+                                vr.getRight().toString(),
                                 SimpleFilter.GTE));
                         filters.add(not);
                     }

Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=1829106&r1=1829105&r2=1829106&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
(original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Fri Apr 13 21:20:53 2018
@@ -22,12 +22,12 @@ import org.apache.felix.framework.Bundle
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.capabilityset.SimpleFilter;
 import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.framework.util.VersionRange;
 import org.apache.felix.framework.wiring.BundleCapabilityImpl;
 import org.apache.felix.framework.wiring.BundleRequirementImpl;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.VersionRange;
 import org.osgi.framework.namespace.BundleNamespace;
 import org.osgi.framework.namespace.ExecutionEnvironmentNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
@@ -338,7 +338,7 @@ public class ManifestParser
                 v = (v == null) ? sv : v;
                 clause.m_attrs.put(
                     Constants.VERSION_ATTRIBUTE,
-                    VersionRange.parse(v.toString()));
+                    new VersionRange(v.toString()));
             }
 
             // If bundle version is specified, then convert its type to VersionRange.
@@ -347,7 +347,7 @@ public class ManifestParser
             {
                 clause.m_attrs.put(
                     Constants.BUNDLE_VERSION_ATTRIBUTE,
-                    VersionRange.parse(v.toString()));
+                    new VersionRange(v.toString()));
             }
 
             // Verify no duplicate imports.
@@ -396,7 +396,7 @@ public class ManifestParser
                     // R3 package requirements should only have version attributes.
                     Object pkgVersion = clause.m_attrs.get(BundleCapabilityImpl.VERSION_ATTR);
                     pkgVersion = (pkgVersion == null)
-                        ? new VersionRange(Version.emptyVersion, true, null, true)
+                        ? new VersionRange(VersionRange.LEFT_CLOSED, Version.emptyVersion,
null, VersionRange.RIGHT_CLOSED)
                         : pkgVersion;
                     for (Entry<String, Object> entry : clause.m_attrs.entrySet())
                     {
@@ -526,7 +526,7 @@ public class ManifestParser
                 v = (v == null) ? sv : v;
                 clause.m_attrs.put(
                     Constants.VERSION_ATTRIBUTE,
-                    VersionRange.parse(v.toString()));
+                    new VersionRange(v.toString()));
             }
 
             // If bundle version is specified, then convert its type to VersionRange.
@@ -535,7 +535,7 @@ public class ManifestParser
             {
                 clause.m_attrs.put(
                     Constants.BUNDLE_VERSION_ATTRIBUTE,
-                    VersionRange.parse(v.toString()));
+                    new VersionRange(v.toString()));
             }
 
             // Dynamic imports can have duplicates, verify that no partial package name wild
carding is used
@@ -1190,10 +1190,10 @@ public class ManifestParser
             }
             for (int k = 0; (osversions != null) && (k < osversions.length); k++)
             {
-                VersionRange range = VersionRange.parse(osversions[k]);
-                if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
+                VersionRange range = new VersionRange(osversions[k]);
+                if ((range.getLeft()).compareTo(osVersionRangeMaxFloor) >= 0)
                 {
-                    osVersionRangeMaxFloor = range.getFloor();
+                    osVersionRangeMaxFloor = range.getLeft();
                 }
             }
         }
@@ -1214,8 +1214,8 @@ public class ManifestParser
                 String[] osversions = ((NativeLibraryClause) clauseList.get(index)).getOSVersions();
                 for (int k = 0; k < osversions.length; k++)
                 {
-                    VersionRange range = VersionRange.parse(osversions[k]);
-                    if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
+                    VersionRange range = new VersionRange(osversions[k]);
+                    if ((range.getLeft()).compareTo(osVersionRangeMaxFloor) >= 0)
                     {
                         selection.add("" + indexList.get(i));
                     }
@@ -1297,7 +1297,7 @@ public class ManifestParser
                 {
                     attrs.put(
                         Constants.VERSION_ATTRIBUTE,
-                        VersionRange.parse(version.toString()));
+                        new VersionRange(version.toString()));
                 }
 
                 List<String> paths = new ArrayList<String>();
@@ -1510,7 +1510,7 @@ public class ManifestParser
                 {
                     clauses.get(0).m_attrs.put(
                         Constants.BUNDLE_VERSION_ATTRIBUTE,
-                        VersionRange.parse(value.toString()));
+                        new VersionRange(value.toString()));
                 }
 
                 // Note that we use a linked hash map here to ensure the
@@ -1700,7 +1700,7 @@ public class ManifestParser
                 {
                     clause.m_attrs.put(
                         Constants.BUNDLE_VERSION_ATTRIBUTE,
-                        VersionRange.parse(value.toString()));
+                        new VersionRange(value.toString()));
                 }
             }
         }

Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java?rev=1829106&r1=1829105&r2=1829106&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
(original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
Fri Apr 13 21:20:53 2018
@@ -34,12 +34,12 @@ import java.util.regex.Pattern;
 
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.framework.util.VersionRange;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.Version;
+import org.osgi.framework.VersionRange;
 
 public class NativeLibraryClause
 {
@@ -123,7 +123,7 @@ public class NativeLibraryClause
     /**
      * Initialize the processor and os name aliases from Felix Config.
      *
-     * @param config
+     * @param configMap
      */
     public static synchronized void initializeNativeAliases(Map configMap)
     {
@@ -321,8 +321,8 @@ public class NativeLibraryClause
         {
             try
             {
-                VersionRange range = VersionRange.parse(osversions[i]);
-                if (range.isInRange(currentOSVersion))
+                VersionRange range = new VersionRange(osversions[i]);
+                if (range.includes(currentOSVersion))
                 {
                     return true;
                 }
@@ -755,8 +755,8 @@ public class NativeLibraryClause
                 String s = value.substring(1, value.length() - 1);
                 String vlo = s.substring(0, s.indexOf(',')).trim();
                 String vhi = s.substring(s.indexOf(',') + 1, s.length()).trim();
-                return new VersionRange(new Version(cleanupVersion(vlo)), (value.charAt(0)
== '['), new Version(
-                    cleanupVersion(vhi)), (value.charAt(value.length() - 1) == ']')).toString();
+                return new VersionRange(value.charAt(0), new Version(cleanupVersion(vlo)),
new Version(
+                    cleanupVersion(vhi)), value.charAt(value.length() - 1)).toString();
             }
 
             catch (Exception ex)



Mime
View raw message