Sync bndlib code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1381708 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
index b1bdc42..bf5e15c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
@@ -13,9 +13,9 @@
import aQute.bnd.maven.support.Pom.Scope;
import aQute.bnd.osgi.*;
import aQute.bnd.osgi.Descriptors.PackageRef;
-import aQute.bnd.settings.*;
import aQute.lib.collections.*;
import aQute.lib.io.*;
+import aQute.lib.settings.*;
import aQute.libg.command.*;
public class MavenCommand extends Processor {
@@ -185,7 +185,7 @@
}
if (developers.isEmpty()) {
- String email = settings.globalGet(Settings.EMAIL, null);
+ String email = settings.remove("email");
if (email == null)
error("No developer email set, you can set global default email with: bnd global email Peter.Kriens@aQute.biz");
else
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
index 33d21e0..d8d54e0 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
@@ -7,6 +7,7 @@
import aQute.bnd.osgi.*;
import aQute.bnd.service.*;
import aQute.bnd.version.*;
+import aQute.lib.collections.*;
import aQute.service.reporter.*;
public class MavenRepository implements RepositoryPlugin, Plugin, BsnToMavenPath {
@@ -114,10 +115,10 @@
}
public PutResult put(InputStream stream, PutOptions options) throws Exception {
- throw new IllegalStateException("Maven does not support the put command");
+ throw new UnsupportedOperationException("Maven does not support the put command");
}
- public List<Version> versions(String bsn) throws Exception {
+ public SortedSet<Version> versions(String bsn) throws Exception {
File files[] = get(bsn, null);
List<Version> versions = new ArrayList<Version>();
@@ -127,7 +128,10 @@
Version v = new Version(version);
versions.add(v);
}
- return versions;
+ if ( versions.isEmpty())
+ return SortedList.empty();
+
+ return new SortedList<Version>(versions);
}
public void setProperties(Map<String,String> map) {
@@ -201,4 +205,20 @@
public String getLocation() {
return root.toString();
}
+
+ public File get(String bsn, Version version, Map<String,String> properties, DownloadListener ... listeners) throws Exception {
+ File file = get(bsn, version.toString(), Strategy.EXACT, properties);
+ if ( file == null)
+ return null;
+
+ for (DownloadListener l : listeners) {
+ try {
+ l.success(file);
+ }
+ catch (Exception e) {
+ reporter.exception(e, "Download listener for %s", file);
+ }
+ }
+ return file;
+ }
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
index 4609e32..345d3eb 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
@@ -75,7 +75,7 @@
throw new UnsupportedOperationException("cannot do list");
}
- public List<Version> versions(String bsn) throws Exception {
+ public SortedSet<Version> versions(String bsn) throws Exception {
throw new UnsupportedOperationException("cannot do versions");
}
@@ -126,4 +126,21 @@
return Arrays.toString(repositories);
}
+
+ public File get(String bsn, Version version, Map<String,String> properties, DownloadListener ... listeners) throws Exception {
+ File f= get(bsn, version.toString(), Strategy.EXACT, properties);
+ if ( f == null)
+ return null;
+
+ for (DownloadListener l : listeners) {
+ try {
+ l.success(f);
+ }
+ catch (Exception e) {
+ reporter.exception(e, "Download listener for %s", f);
+ }
+ }
+ return f;
+ }
+
}