FELIX-2113: update to latest OBR snapshot
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@918068 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/AddUrlCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/AddUrlCommand.java
index 00c8b03..3ccb1fe 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/AddUrlCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/AddUrlCommand.java
@@ -16,7 +16,6 @@
*/
package org.apache.felix.karaf.shell.obr;
-import java.net.URL;
import java.util.List;
import org.apache.felix.bundlerepository.RepositoryAdmin;
@@ -31,7 +30,7 @@
protected void doExecute(RepositoryAdmin admin) throws Exception {
for (String url : urls) {
- admin.addRepository(new URL(url));
+ admin.addRepository(url);
}
}
}
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ListUrlCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ListUrlCommand.java
index 7c74663..6dc9487 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ListUrlCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ListUrlCommand.java
@@ -27,7 +27,7 @@
Repository[] repos = admin.listRepositories();
if ((repos != null) && (repos.length > 0)) {
for (int i = 0; i < repos.length; i++) {
- System.out.println(repos[i].getURL());
+ System.out.println(repos[i].getURI());
}
} else {
System.out.println("No repository URLs are set.");
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ObrCommandSupport.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ObrCommandSupport.java
index eb59dc3..bed4a73 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ObrCommandSupport.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ObrCommandSupport.java
@@ -19,6 +19,7 @@
import java.io.PrintStream;
import java.util.List;
+import org.apache.felix.bundlerepository.Reason;
import org.apache.felix.bundlerepository.RepositoryAdmin;
import org.apache.felix.bundlerepository.Requirement;
import org.apache.felix.bundlerepository.Resolver;
@@ -57,7 +58,7 @@
protected abstract void doExecute(RepositoryAdmin admin) throws Exception;
- protected Resource[] searchRepository(RepositoryAdmin admin, String targetId, String targetVersion)
+ protected Resource[] searchRepository(RepositoryAdmin admin, String targetId, String targetVersion) throws InvalidSyntaxException
{
// Try to see if the targetId is a bundle ID.
try
@@ -186,7 +187,7 @@
try
{
System.out.print("\nDeploying...");
- resolver.deploy(start);
+ resolver.deploy(start ? Resolver.START : 0);
System.out.println("done.");
}
catch (IllegalStateException ex)
@@ -196,19 +197,15 @@
}
else
{
- Requirement[] reqs = resolver.getUnsatisfiedRequirements();
+ Reason[] reqs = resolver.getUnsatisfiedRequirements();
if ((reqs != null) && (reqs.length > 0))
{
System.out.println("Unsatisfied requirement(s):");
printUnderline(System.out, 27);
for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++)
{
- System.out.println(" " + reqs[reqIdx].getFilter());
- Resource[] resources = resolver.getResources(reqs[reqIdx]);
- for (int resIdx = 0; resIdx < resources.length; resIdx++)
- {
- System.out.println(" " + resources[resIdx].getPresentationName());
- }
+ System.out.println(" " + reqs[reqIdx].getRequirement().getFilter());
+ System.out.println(" " + reqs[reqIdx].getResource().getPresentationName());
}
}
else
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RefreshUrlCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RefreshUrlCommand.java
index f55f5b1..7509842 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RefreshUrlCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RefreshUrlCommand.java
@@ -16,7 +16,6 @@
*/
package org.apache.felix.karaf.shell.obr;
-import java.net.URL;
import java.util.List;
import org.apache.felix.bundlerepository.Repository;
@@ -33,15 +32,13 @@
protected void doExecute(RepositoryAdmin admin) throws Exception {
if (urls != null && !urls.isEmpty()) {
for (String url : urls) {
- admin.removeRepository(new URL(url));
- admin.addRepository(new URL(url));
+ admin.addRepository(url);
}
} else {
Repository[] repos = admin.listRepositories();
if ((repos != null) && (repos.length > 0)) {
for (int i = 0; i < repos.length; i++) {
- admin.removeRepository(repos[i].getURL());
- admin.addRepository(repos[i].getURL());
+ admin.addRepository(repos[i].getURI());
}
}
}
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RemoveUrlCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RemoveUrlCommand.java
index 123de1d..3ae7e4a 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RemoveUrlCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/RemoveUrlCommand.java
@@ -16,7 +16,6 @@
*/
package org.apache.felix.karaf.shell.obr;
-import java.net.URL;
import java.util.List;
import org.apache.felix.bundlerepository.RepositoryAdmin;
@@ -31,7 +30,7 @@
protected void doExecute(RepositoryAdmin admin) throws Exception {
for (String url : urls) {
- admin.removeRepository(new URL(url));
+ admin.removeRepository(url);
}
}
}
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ResolveCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ResolveCommand.java
index afe44a2..251f63f 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ResolveCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/ResolveCommand.java
@@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.List;
+import org.apache.felix.bundlerepository.Reason;
import org.apache.felix.bundlerepository.Repository;
import org.apache.felix.bundlerepository.RepositoryAdmin;
import org.apache.felix.bundlerepository.Requirement;
@@ -75,14 +76,14 @@
for (int resIdx = 0; resIdx < resources.length; resIdx++) {
System.out.println(" " + resources[resIdx].getPresentationName() + " (" + resources[resIdx].getVersion() + ")");
if (why) {
- Requirement[] req = resolver.getReason(resources[resIdx]);
+ Reason[] req = resolver.getReason(resources[resIdx]);
for (int reqIdx = 0; req != null && reqIdx < req.length; reqIdx++) {
- if (!req[reqIdx].isOptional()) {
+ if (!req[reqIdx].getRequirement().isOptional()) {
Resource r = req[reqIdx].getResource();
if (r != null) {
- System.out.println(" - " + r.getPresentationName() + " / " + req[reqIdx].getName() + ":" + req[reqIdx].getFilter());
+ System.out.println(" - " + r.getPresentationName() + " / " + req[reqIdx].getRequirement().getName() + ":" + req[reqIdx].getRequirement().getFilter());
} else {
- System.out.println(" - " + req[reqIdx].getName() + ":" + req[reqIdx].getFilter());
+ System.out.println(" - " + req[reqIdx].getRequirement().getName() + ":" + req[reqIdx].getRequirement().getFilter());
}
}
}
@@ -98,14 +99,14 @@
System.out.println(" " + resources[resIdx].getPresentationName()
+ " (" + resources[resIdx].getVersion() + ")");
if (why) {
- Requirement[] req = resolver.getReason(resources[resIdx]);
+ Reason[] req = resolver.getReason(resources[resIdx]);
for (int reqIdx = 0; req != null && reqIdx < req.length; reqIdx++) {
- if (!req[reqIdx].isOptional()) {
+ if (!req[reqIdx].getRequirement().isOptional()) {
Resource r = req[reqIdx].getResource();
if (r != null) {
- System.out.println(" - " + r.getPresentationName() + " / " + req[reqIdx].getName() + ":" + req[reqIdx].getFilter());
+ System.out.println(" - " + r.getPresentationName() + " / " + req[reqIdx].getRequirement().getName() + ":" + req[reqIdx].getRequirement().getFilter());
} else {
- System.out.println(" - " + req[reqIdx].getName() + ":" + req[reqIdx].getFilter());
+ System.out.println(" - " + req[reqIdx].getRequirement().getName() + ":" + req[reqIdx].getRequirement().getFilter());
}
}
}
@@ -116,7 +117,7 @@
try
{
System.out.print("\nDeploying...");
- resolver.deploy(start);
+ resolver.deploy(start ? Resolver.START : 0);
System.out.println("done.");
}
catch (IllegalStateException ex)
@@ -125,16 +126,13 @@
}
}
} else {
- Requirement[] reqs = resolver.getUnsatisfiedRequirements();
+ Reason[] reqs = resolver.getUnsatisfiedRequirements();
if ((reqs != null) && (reqs.length > 0)) {
System.out.println("Unsatisfied requirement(s):");
printUnderline(System.out, 27);
for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++) {
- System.out.println(" " + reqs[reqIdx].getName() + ":" + reqs[reqIdx].getFilter());
- Resource[] resources = resolver.getResources(reqs[reqIdx]);
- for (int resIdx = 0; resIdx < resources.length; resIdx++) {
- System.out.println(" " + resources[resIdx].getPresentationName());
- }
+ System.out.println(" " + reqs[reqIdx].getRequirement().getName() + ":" + reqs[reqIdx].getRequirement().getFilter());
+ System.out.println(" " +reqs[reqIdx].getResource().getPresentationName());
}
} else {
System.out.println("Could not resolve targets.");
diff --git a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/SourceCommand.java b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/SourceCommand.java
index 7bc4df4..403b05c 100644
--- a/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/SourceCommand.java
+++ b/karaf/shell/obr/src/main/java/org/apache/felix/karaf/shell/obr/SourceCommand.java
@@ -16,6 +16,7 @@
*/
package org.apache.felix.karaf.shell.obr;
+import java.net.URI;
import java.net.URL;
import java.util.List;
@@ -48,10 +49,10 @@
}
else
{
- URL srcURL = (URL) resource.getProperties().get(Resource.SOURCE_URL);
+ URI srcURL = (URI) resource.getProperties().get(Resource.SOURCE_URI);
if (srcURL != null)
{
- FileUtil.downloadSource(System.out, System.err, srcURL, localDir, extract);
+ FileUtil.downloadSource(System.out, System.err, srcURL.toURL(), localDir, extract);
}
else
{