FELIX-2404: Use felix utils instead of various classes from karaf
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@953588 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/shell/dev/pom.xml b/karaf/shell/dev/pom.xml
index 8781ff2..15a4ca2 100644
--- a/karaf/shell/dev/pom.xml
+++ b/karaf/shell/dev/pom.xml
@@ -37,11 +37,6 @@
</dependency>
<dependency>
- <groupId>org.apache.felix.karaf</groupId>
- <artifactId>org.apache.felix.karaf.commons</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-wrap</artifactId>
</dependency>
@@ -56,7 +51,13 @@
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.utils</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -75,7 +76,10 @@
org.apache.felix.karaf.shell.console,
*
</Import-Package>
- <Private-Package>!*</Private-Package>
+ <Private-Package>
+ org.apache.felix.utils.version,
+ !*
+ </Private-Package>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/ShowBundleTree.java b/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/ShowBundleTree.java
index c461274..5c2cbea 100644
--- a/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/ShowBundleTree.java
+++ b/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/ShowBundleTree.java
@@ -148,7 +148,7 @@
boolean foundMatch = false;
if (exporters != null) {
for (ExportedPackage ep : exporters) {
- if (i.getVersion().isInRange(ep.getVersion())) {
+ if (i.getVersion().contains(ep.getVersion())) {
if (bundle.equals(ep.getExportingBundle())) {
foundMatch = true;
} else {
diff --git a/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/util/Import.java b/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/util/Import.java
index 3215707..66ee9c4 100644
--- a/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/util/Import.java
+++ b/karaf/shell/dev/src/main/java/org/apache/felix/karaf/shell/dev/util/Import.java
@@ -19,7 +19,7 @@
import java.util.LinkedList;
import java.util.List;
-import org.apache.felix.karaf.commons.osgi.VersionRange;
+import org.apache.felix.utils.version.VersionRange;
/**
* Simple class to model an OSGi Import-Package
@@ -42,7 +42,7 @@
if (value.contains("version=")) {
this.version = extractVersion(value);
} else {
- this.version = VersionRange.infiniteRange;
+ this.version = VersionRange.ANY_VERSION;
}
}
@@ -53,9 +53,9 @@
int begin = value.indexOf("version=") + 8;
int end = value.indexOf(";", begin);
if (end < 0) {
- return VersionRange.parse(unquote(value.substring(begin)));
+ return VersionRange.parseVersionRange(unquote(value.substring(begin)));
} else {
- return VersionRange.parse(unquote(value.substring(begin, end)));
+ return VersionRange.parseVersionRange(unquote(value.substring(begin, end)));
}
}
diff --git a/karaf/shell/dev/src/test/java/org/apache/felix/karaf/shell/dev/util/ImportTest.java b/karaf/shell/dev/src/test/java/org/apache/felix/karaf/shell/dev/util/ImportTest.java
index 8a2aa14..f8edd13 100644
--- a/karaf/shell/dev/src/test/java/org/apache/felix/karaf/shell/dev/util/ImportTest.java
+++ b/karaf/shell/dev/src/test/java/org/apache/felix/karaf/shell/dev/util/ImportTest.java
@@ -21,7 +21,7 @@
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.apache.felix.karaf.commons.osgi.VersionRange;
+import org.apache.felix.utils.version.VersionRange;
import org.junit.Test;
/**
@@ -39,7 +39,7 @@
public void createWithPackageNameAndVersion() {
Import i = new Import("org.wip.bar;version=\"2.0.0\"");
assertEquals("org.wip.bar", i.getPackage());
- assertEquals(VersionRange.parse("2.0.0"), i.getVersion());
+ assertEquals(VersionRange.parseVersionRange("2.0.0"), i.getVersion());
}
@Test