Update to latest refactored bndlib
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1362033 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
index 93d48ad..aeb4bbb 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
@@ -17,6 +17,10 @@
return digest;
}
+ public String asHex() {
+ return Hex.toHexString(digest());
+ }
+
@Override
public String toString() {
return String.format("%s(d=%s)", getAlgorithm(), Hex.toHexString(digest));
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java b/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
index 05a6bdd..a1a5a0a 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
@@ -35,4 +35,7 @@
return ALGORITHM;
}
+ public static MD5 digest(byte [] data) throws Exception {
+ return getDigester().digest(data);
+ }
}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
index d0a486c..c76f182 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
@@ -35,4 +35,7 @@
return ALGORITHM;
}
+ public static SHA1 digest(byte [] data) throws Exception {
+ return getDigester().digest(data);
+ }
}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
index b6eeacc..743a431 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
@@ -35,4 +35,7 @@
return ALGORITHM;
}
+ public static SHA256 digest(byte [] data) throws Exception {
+ return getDigester().digest(data);
+ }
}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java b/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java
deleted file mode 100644
index e278a74..0000000
--- a/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package aQute.libg.filerepo;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
-import aQute.libg.version.*;
-
-public class FileRepo {
- File root;
- Pattern REPO_FILE = Pattern.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+|latest)\\.(jar|lib)");
-
- public FileRepo(File root) {
- this.root = root;
- }
-
- /**
- * Get a list of URLs to bundles that are constrained by the bsn and
- * versionRange.
- */
- public File[] get(String bsn, final VersionRange versionRange) throws Exception {
-
- //
- // Check if the entry exists
- //
- File f = new File(root, bsn);
- if (!f.isDirectory())
- return null;
-
- //
- // Iterator over all the versions for this BSN.
- // Create a sorted map over the version as key
- // and the file as URL as value. Only versions
- // that match the desired range are included in
- // this list.
- //
- return f.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- Matcher m = REPO_FILE.matcher(name);
- if (!m.matches())
- return false;
- if (versionRange == null)
- return true;
-
- Version v = new Version(m.group(2));
- return versionRange.includes(v);
- }
- });
- }
-
- public List<String> list(String regex) throws Exception {
- if (regex == null)
- regex = ".*";
- final Pattern pattern = Pattern.compile(regex);
-
- String list[] = root.list(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- Matcher matcher = pattern.matcher(name);
- return matcher.matches();
- }
-
- });
- return Arrays.asList(list);
- }
-
- public List<Version> versions(String bsn) throws Exception {
- File dir = new File(root, bsn);
- final List<Version> versions = new ArrayList<Version>();
- dir.list(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- Matcher m = REPO_FILE.matcher(name);
- if (m.matches()) {
- versions.add(new Version(m.group(2)));
- return true;
- }
- return false;
- }
-
- });
- return versions;
- }
-
- public File get(String bsn, VersionRange range, int strategy) throws Exception {
- File[] files = get(bsn, range);
- if (files == null || files.length == 0)
- return null;
-
- if (files.length == 1)
- return files[0];
-
- if (strategy < 0) {
- return files[0];
- }
- return files[files.length - 1];
- }
-
- public File put(String bsn, Version version) {
- File dir = new File(root, bsn);
- dir.mkdirs();
- File file = new File(dir, bsn + "-" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro()
- + ".jar");
- return file;
- }
-
-}
diff --git a/bundleplugin/src/main/java/aQute/libg/filerepo/packageinfo b/bundleplugin/src/main/java/aQute/libg/filerepo/packageinfo
deleted file mode 100644
index 7c8de03..0000000
--- a/bundleplugin/src/main/java/aQute/libg/filerepo/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0
diff --git a/bundleplugin/src/main/java/aQute/libg/filters/LiteralFilter.java b/bundleplugin/src/main/java/aQute/libg/filters/LiteralFilter.java
new file mode 100644
index 0000000..ca09228
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/libg/filters/LiteralFilter.java
@@ -0,0 +1,16 @@
+package aQute.libg.filters;
+
+public class LiteralFilter extends Filter {
+
+ private String filterString;
+
+ public LiteralFilter(String filterString) {
+ this.filterString = filterString;
+ }
+
+ @Override
+ public void append(StringBuilder builder) {
+ builder.append(filterString);
+ }
+
+}
diff --git a/bundleplugin/src/main/java/aQute/libg/header/Attrs.java b/bundleplugin/src/main/java/aQute/libg/header/Attrs.java
deleted file mode 100644
index 40fefcc..0000000
--- a/bundleplugin/src/main/java/aQute/libg/header/Attrs.java
+++ /dev/null
@@ -1,312 +0,0 @@
-package aQute.libg.header;
-
-import java.util.*;
-import java.util.regex.*;
-
-import aQute.lib.collections.*;
-import aQute.libg.version.*;
-
-public class Attrs implements Map<String,String> {
- public enum Type {
- STRING(null), LONG(null), VERSION(null), DOUBLE(null), STRINGS(STRING), LONGS(LONG), VERSIONS(VERSION), DOUBLES(
- DOUBLE);
-
- Type sub;
-
- Type(Type sub) {
- this.sub = sub;
- }
-
- }
-
- /**
- * <pre>
- * Provide-Capability ::= capability ::=
- * name-space ::= typed-attr ::= type ::= scalar ::=
- * capability ( ',' capability )*
- * name-space
- * ( ’;’ directive | typed-attr )*
- * symbolic-name
- * extended ( ’:’ type ) ’=’ argument
- * scalar | list
- * ’String’ | ’Version’ | ’Long’
- * list ::=
- * ’List<’ scalar ’>’
- * </pre>
- */
- static String EXTENDED = "[\\-0-9a-zA-Z\\._]+";
- static String SCALAR = "String|Version|Long|Double";
- static String LIST = "List\\s*<\\s*(" + SCALAR + ")\\s*>";
- public static final Pattern TYPED = Pattern.compile("\\s*(" + EXTENDED + ")\\s*:\\s*(" + SCALAR
- + "|" + LIST + ")\\s*");
-
- private LinkedHashMap<String,String> map;
- private Map<String,Type> types;
- static Map<String,String> EMPTY = Collections.emptyMap();
-
- public Attrs(Attrs... attrs) {
- for (Attrs a : attrs) {
- if (a != null) {
- putAll(a);
- }
- }
- }
-
- public void clear() {
- map.clear();
- }
-
- public boolean containsKey(String name) {
- if (map == null)
- return false;
-
- return map.containsKey(name);
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public boolean containsKey(Object name) {
- assert name instanceof String;
- if (map == null)
- return false;
-
- return map.containsKey((String) name);
- }
-
- public boolean containsValue(String value) {
- if (map == null)
- return false;
-
- return map.containsValue(value);
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public boolean containsValue(Object value) {
- assert value instanceof String;
- if (map == null)
- return false;
-
- return map.containsValue((String) value);
- }
-
- public Set<java.util.Map.Entry<String,String>> entrySet() {
- if (map == null)
- return EMPTY.entrySet();
-
- return map.entrySet();
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public String get(Object key) {
- assert key instanceof String;
- if (map == null)
- return null;
-
- return map.get((String) key);
- }
-
- public String get(String key) {
- if (map == null)
- return null;
-
- return map.get(key);
- }
-
- public String get(String key, String deflt) {
- String s = get(key);
- if (s == null)
- return deflt;
- return s;
- }
-
- public boolean isEmpty() {
- return map == null || map.isEmpty();
- }
-
- public Set<String> keySet() {
- if (map == null)
- return EMPTY.keySet();
-
- return map.keySet();
- }
-
- public String put(String key, String value) {
- if (map == null)
- map = new LinkedHashMap<String,String>();
-
- Matcher m = TYPED.matcher(key);
- if (m.matches()) {
- key = m.group(1);
- String type = m.group(2);
- Type t = Type.STRING;
-
- if (type.startsWith("List")) {
- type = m.group(3);
- if ("String".equals(type))
- t = Type.STRINGS;
- else if ("Long".equals(type))
- t = Type.LONGS;
- else if ("Double".equals(type))
- t = Type.DOUBLES;
- else if ("Version".equals(type))
- t = Type.VERSIONS;
- } else {
- if ("String".equals(type))
- t = Type.STRING;
- else if ("Long".equals(type))
- t = Type.LONG;
- else if ("Double".equals(type))
- t = Type.DOUBLE;
- else if ("Version".equals(type))
- t = Type.VERSION;
- }
- if (types == null)
- types = new LinkedHashMap<String,Type>();
- types.put(key, t);
-
- // TODO verify value?
- }
-
- return map.put(key, value);
- }
-
- public Type getType(String key) {
- if (types == null)
- return Type.STRING;
- Type t = types.get(key);
- if (t == null)
- return Type.STRING;
- return t;
- }
-
- public void putAll(Map< ? extends String, ? extends String> map) {
- for (Map.Entry< ? extends String, ? extends String> e : map.entrySet())
- put(e.getKey(), e.getValue());
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public String remove(Object var0) {
- assert var0 instanceof String;
- if (map == null)
- return null;
-
- return map.remove((String) var0);
- }
-
- public String remove(String var0) {
- if (map == null)
- return null;
- return map.remove(var0);
- }
-
- public int size() {
- if (map == null)
- return 0;
- return map.size();
- }
-
- public Collection<String> values() {
- if (map == null)
- return EMPTY.values();
-
- return map.values();
- }
-
- public String getVersion() {
- return get("version");
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- append(sb);
- return sb.toString();
- }
-
- public void append(StringBuilder sb) {
- String del = "";
- for (Map.Entry<String,String> e : entrySet()) {
- sb.append(del);
- sb.append(e.getKey());
- sb.append("=");
- sb.append(e.getValue());
- del = ";";
- }
- }
-
- @Deprecated
- public boolean equals(Object other) {
- return super.equals(other);
- }
-
- @Deprecated
- public int hashCode() {
- return super.hashCode();
- }
-
- public boolean isEqual(Attrs o) {
- if (this == o)
- return true;
-
- Attrs other = o;
-
- if (size() != other.size())
- return false;
-
- if (isEmpty())
- return true;
-
- SortedList<String> l = new SortedList<String>(keySet());
- SortedList<String> lo = new SortedList<String>(other.keySet());
- if (!l.isEqual(lo))
- return false;
-
- for (String key : keySet()) {
- if (!get(key).equals(other.get(key)))
- return false;
- }
- return true;
-
- }
-
- public Object getTyped(String adname) {
- String s = get(adname);
- if (s == null)
- return null;
-
- Type t = getType(adname);
- return convert(t, s);
- }
-
- private Object convert(Type t, String s) {
- if (t.sub == null) {
- switch (t) {
- case STRING :
- return s;
- case LONG :
- return Long.parseLong(s.trim());
- case VERSION :
- return Version.parseVersion(s);
- case DOUBLE :
- return Double.parseDouble(s.trim());
-
- case DOUBLES :
- case LONGS :
- case STRINGS :
- case VERSIONS :
- // Cannot happen since the sub is null
- return null;
- }
- return null;
- }
- List<Object> list = new ArrayList<Object>();
- String split[] = s.split("\\s*\\(\\?!\\),\\s*");
- for (String p : split) {
- p = p.replaceAll("\\\\", "");
- list.add(convert(t.sub, p));
- }
- return list;
- }
-}
diff --git a/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java b/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java
deleted file mode 100755
index a372527..0000000
--- a/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package aQute.libg.header;
-
-import java.util.*;
-
-import aQute.libg.generics.*;
-import aQute.libg.qtokens.*;
-import aQute.service.reporter.*;
-
-public class OSGiHeader {
-
- static public Parameters parseHeader(String value) {
- return parseHeader(value, null);
- }
-
- /**
- * Standard OSGi header parser. This parser can handle the format clauses
- * ::= clause ( ',' clause ) + clause ::= name ( ';' name ) (';' key '='
- * value ) This is mapped to a Map { name => Map { attr|directive => value }
- * }
- *
- * @param value
- * A string
- * @return a Map<String,Map<String,String>>
- */
- static public Parameters parseHeader(String value, Reporter logger) {
- return parseHeader(value, logger, new Parameters());
- }
-
- static public Parameters parseHeader(String value, Reporter logger, Parameters result) {
- if (value == null || value.trim().length() == 0)
- return result;
-
- QuotedTokenizer qt = new QuotedTokenizer(value, ";=,");
- char del = 0;
- do {
- boolean hadAttribute = false;
- Attrs clause = new Attrs();
- List<String> aliases = Create.list();
- String name = qt.nextToken(",;");
-
- del = qt.getSeparator();
- if (name == null || name.length() == 0) {
- if (logger != null && logger.isPedantic()) {
- logger.warning("Empty clause, usually caused by repeating a comma without any name field or by having spaces after the backslash of a property file: "
- + value);
- }
- if (name == null)
- break;
- } else {
- name = name.trim();
-
- aliases.add(name);
- while (del == ';') {
- String adname = qt.nextToken();
- if ((del = qt.getSeparator()) != '=') {
- if (hadAttribute)
- if (logger != null) {
- logger.error("Header contains name field after attribute or directive: " + adname
- + " from " + value
- + ". Name fields must be consecutive, separated by a ';' like a;b;c;x=3;y=4");
- }
- if (adname != null && adname.length() > 0)
- aliases.add(adname.trim());
- } else {
- String advalue = qt.nextToken();
- if (clause.containsKey(adname)) {
- if (logger != null && logger.isPedantic())
- logger.warning("Duplicate attribute/directive name " + adname + " in " + value
- + ". This attribute/directive will be ignored");
- }
- if (advalue == null) {
- if (logger != null)
- logger.error("No value after '=' sign for attribute " + adname);
- advalue = "";
- }
- clause.put(adname.trim(), advalue.trim());
- del = qt.getSeparator();
- hadAttribute = true;
- }
- }
-
- // Check for duplicate names. The aliases list contains
- // the list of nams, for each check if it exists. If so,
- // add a number of "~" to make it unique.
- for (String clauseName : aliases) {
- if (result.containsKey(clauseName)) {
- if (logger != null && logger.isPedantic())
- logger.warning("Duplicate name "
- + clauseName
- + " used in header: '"
- + clauseName
- + "'. Duplicate names are specially marked in Bnd with a ~ at the end (which is stripped at printing time).");
- while (result.containsKey(clauseName))
- clauseName += "~";
- }
- result.put(clauseName, clause);
- }
- }
- } while (del == ',');
- return result;
- }
-
- public static Attrs parseProperties(String input) {
- return parseProperties(input, null);
- }
-
- public static Attrs parseProperties(String input, Reporter logger) {
- if (input == null || input.trim().length() == 0)
- return new Attrs();
-
- Attrs result = new Attrs();
- QuotedTokenizer qt = new QuotedTokenizer(input, "=,");
- char del = ',';
-
- while (del == ',') {
- String key = qt.nextToken(",=");
- String value = "";
- del = qt.getSeparator();
- if (del == '=') {
- value = qt.nextToken(",=");
- del = qt.getSeparator();
- }
- result.put(key, value);
- }
- if (del != 0) {
- if (logger == null)
- throw new IllegalArgumentException("Invalid syntax for properties: " + input);
- logger.error("Invalid syntax for properties: " + input);
- }
-
- return result;
- }
-
-}
diff --git a/bundleplugin/src/main/java/aQute/libg/header/Parameters.java b/bundleplugin/src/main/java/aQute/libg/header/Parameters.java
deleted file mode 100644
index 02e3463..0000000
--- a/bundleplugin/src/main/java/aQute/libg/header/Parameters.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package aQute.libg.header;
-
-import java.util.*;
-
-import aQute.lib.collections.*;
-import aQute.service.reporter.*;
-
-public class Parameters implements Map<String,Attrs> {
- private LinkedHashMap<String,Attrs> map;
- static Map<String,Attrs> EMPTY = Collections.emptyMap();
- String error;
-
- public Parameters() {}
-
- public Parameters(String header) {
- OSGiHeader.parseHeader(header, null, this);
- }
-
- public Parameters(String header, Reporter reporter) {
- OSGiHeader.parseHeader(header, reporter, this);
- }
-
- public void clear() {
- map.clear();
- }
-
- public boolean containsKey(final String name) {
- if (map == null)
- return false;
-
- return map.containsKey(name);
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public boolean containsKey(Object name) {
- assert name instanceof String;
- if (map == null)
- return false;
-
- return map.containsKey((String) name);
- }
-
- public boolean containsValue(Attrs value) {
- if (map == null)
- return false;
-
- return map.containsValue(value);
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public boolean containsValue(Object value) {
- assert value instanceof Attrs;
- if (map == null)
- return false;
-
- return map.containsValue((Attrs) value);
- }
-
- public Set<java.util.Map.Entry<String,Attrs>> entrySet() {
- if (map == null)
- return EMPTY.entrySet();
-
- return map.entrySet();
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public Attrs get(Object key) {
- assert key instanceof String;
- if (map == null)
- return null;
-
- return map.get((String) key);
- }
-
- public Attrs get(String key) {
- if (map == null)
- return null;
-
- return map.get(key);
- }
-
- public boolean isEmpty() {
- return map == null || map.isEmpty();
- }
-
- public Set<String> keySet() {
- if (map == null)
- return EMPTY.keySet();
-
- return map.keySet();
- }
-
- public Attrs put(String key, Attrs value) {
- assert key != null;
- assert value != null;
-
- if (map == null)
- map = new LinkedHashMap<String,Attrs>();
-
- return map.put(key, value);
- }
-
- public void putAll(Map< ? extends String, ? extends Attrs> map) {
- if (this.map == null) {
- if (map.isEmpty())
- return;
- this.map = new LinkedHashMap<String,Attrs>();
- }
- this.map.putAll(map);
- }
-
- public void putAllIfAbsent(Map<String, ? extends Attrs> map) {
- for (Map.Entry<String, ? extends Attrs> entry : map.entrySet()) {
- if (!containsKey(entry.getKey()))
- put(entry.getKey(), entry.getValue());
- }
- }
-
- @SuppressWarnings("cast")
- @Deprecated
- public Attrs remove(Object var0) {
- assert var0 instanceof String;
- if (map == null)
- return null;
-
- return map.remove((String) var0);
- }
-
- public Attrs remove(String var0) {
- if (map == null)
- return null;
- return map.remove(var0);
- }
-
- public int size() {
- if (map == null)
- return 0;
- return map.size();
- }
-
- public Collection<Attrs> values() {
- if (map == null)
- return EMPTY.values();
-
- return map.values();
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- append(sb);
- return sb.toString();
- }
-
- public void append(StringBuilder sb) {
- String del = "";
- for (Map.Entry<String,Attrs> s : entrySet()) {
- sb.append(del);
- sb.append(s.getKey());
- if (!s.getValue().isEmpty()) {
- sb.append(';');
- s.getValue().append(sb);
- }
-
- del = ",";
- }
- }
-
- @Deprecated
- public boolean equals(Object other) {
- return super.equals(other);
- }
-
- @Deprecated
- public int hashCode() {
- return super.hashCode();
- }
-
- public boolean isEqual(Parameters other) {
- if (this == other)
- return true;
-
- if (size() != other.size())
- return false;
-
- if (isEmpty())
- return true;
-
- SortedList<String> l = new SortedList<String>(keySet());
- SortedList<String> lo = new SortedList<String>(other.keySet());
- if (!l.isEqual(lo))
- return false;
-
- for (String key : keySet()) {
- if (!get(key).isEqual(other.get(key)))
- return false;
- }
- return true;
- }
-
- public Map<String, ? extends Map<String,String>> asMapMap() {
- return this;
- }
-}
diff --git a/bundleplugin/src/main/java/aQute/libg/header/packageinfo b/bundleplugin/src/main/java/aQute/libg/header/packageinfo
deleted file mode 100644
index e39f616..0000000
--- a/bundleplugin/src/main/java/aQute/libg/header/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.1.0
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
index 4ed2ff1..e08c569 100644
--- a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
@@ -10,7 +10,7 @@
/**
* Mainly used for testing where reporters are needed.
*/
-public class ReporterAdapter implements Reporter, Report {
+public class ReporterAdapter implements Reporter, Report, Runnable {
final List<String> errors = new ArrayList<String>();
final List<String> warnings = new ArrayList<String>();
final List<LocationImpl> locations = new ArrayList<LocationImpl>();
@@ -204,8 +204,9 @@
return true;
if (!missed.isEmpty())
- error("Missed the following patterns in the warnings or errors: %s", missed);
+ System.err.println("Missed the following patterns in the warnings or errors: " + missed);
+ report(System.err);
return false;
}
@@ -258,4 +259,19 @@
return null;
}
+ /**
+ * Handy routine that can be extended by subclasses
+ * so they can run inside the context
+ */
+ public void run() {
+ throw new UnsupportedOperationException("Must be implemented by subclass");
+ }
+
+ /**
+ * Return a messages object bound to this adapter
+ */
+
+ public <T> T getMessages(Class<T> c) {
+ return ReporterMessages.base(this, c);
+ }
}
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java
index 375dbc6..d2ca832 100644
--- a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java
@@ -10,7 +10,7 @@
public class ReporterMessages {
- static class WARNINGImpl implements ERROR {
+ static class WARNINGImpl implements WARNING {
Reporter.SetLocation loc;
public SetLocation file(String file) {
@@ -42,7 +42,7 @@
}
}
- static class ERRORImpl extends WARNINGImpl implements WARNING {
+ static class ERRORImpl extends WARNINGImpl implements ERROR {
public ERRORImpl(SetLocation e) {
super(e);
}
diff --git a/bundleplugin/src/main/java/aQute/libg/version/Version.java b/bundleplugin/src/main/java/aQute/libg/version/Version.java
deleted file mode 100755
index 77d21e4..0000000
--- a/bundleplugin/src/main/java/aQute/libg/version/Version.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package aQute.libg.version;
-
-import java.util.regex.*;
-
-public class Version implements Comparable<Version> {
- final int major;
- final int minor;
- final int micro;
- final String qualifier;
- public final static String VERSION_STRING = "(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.([-_\\da-zA-Z]+))?)?)?";
- public final static Pattern VERSION = Pattern.compile(VERSION_STRING);
- public final static Version LOWEST = new Version();
- public final static Version HIGHEST = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
- "\uFFFF");
-
- public static final Version emptyVersion = LOWEST;
- public static final Version ONE = new Version(1, 0, 0);
-
- public Version() {
- this(0);
- }
-
- public Version(int major, int minor, int micro, String qualifier) {
- this.major = major;
- this.minor = minor;
- this.micro = micro;
- this.qualifier = qualifier;
- }
-
- public Version(int major, int minor, int micro) {
- this(major, minor, micro, null);
- }
-
- public Version(int major, int minor) {
- this(major, minor, 0, null);
- }
-
- public Version(int major) {
- this(major, 0, 0, null);
- }
-
- public Version(String version) {
- version = version.trim();
- Matcher m = VERSION.matcher(version);
- if (!m.matches())
- throw new IllegalArgumentException("Invalid syntax for version: " + version);
-
- major = Integer.parseInt(m.group(1));
- if (m.group(3) != null)
- minor = Integer.parseInt(m.group(3));
- else
- minor = 0;
-
- if (m.group(5) != null)
- micro = Integer.parseInt(m.group(5));
- else
- micro = 0;
-
- qualifier = m.group(7);
- }
-
- public int getMajor() {
- return major;
- }
-
- public int getMinor() {
- return minor;
- }
-
- public int getMicro() {
- return micro;
- }
-
- public String getQualifier() {
- return qualifier;
- }
-
- public int compareTo(Version other) {
- if (other == this)
- return 0;
-
- Version o = other;
- if (major != o.major)
- return major - o.major;
-
- if (minor != o.minor)
- return minor - o.minor;
-
- if (micro != o.micro)
- return micro - o.micro;
-
- int c = 0;
- if (qualifier != null)
- c = 1;
- if (o.qualifier != null)
- c += 2;
-
- switch (c) {
- case 0 :
- return 0;
- case 1 :
- return 1;
- case 2 :
- return -1;
- }
- return qualifier.compareTo(o.qualifier);
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(major);
- sb.append(".");
- sb.append(minor);
- sb.append(".");
- sb.append(micro);
- if (qualifier != null) {
- sb.append(".");
- sb.append(qualifier);
- }
- return sb.toString();
- }
-
- public boolean equals(Object ot) {
- if (!(ot instanceof Version))
- return false;
-
- return compareTo((Version) ot) == 0;
- }
-
- public int hashCode() {
- return major * 97 ^ minor * 13 ^ micro + (qualifier == null ? 97 : qualifier.hashCode());
- }
-
- public int get(int i) {
- switch (i) {
- case 0 :
- return major;
- case 1 :
- return minor;
- case 2 :
- return micro;
- default :
- throw new IllegalArgumentException("Version can only get 0 (major), 1 (minor), or 2 (micro)");
- }
- }
-
- public static Version parseVersion(String version) {
- if (version == null) {
- return LOWEST;
- }
-
- version = version.trim();
- if (version.length() == 0) {
- return LOWEST;
- }
-
- return new Version(version);
-
- }
-
- public Version getWithoutQualifier() {
- return new Version(major, minor, micro);
- }
-}
diff --git a/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java b/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java
deleted file mode 100755
index 3e00c76..0000000
--- a/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package aQute.libg.version;
-
-import java.util.*;
-import java.util.regex.*;
-
-public class VersionRange {
- Version high;
- Version low;
- char start = '[';
- char end = ']';
-
- static Pattern RANGE = Pattern.compile("(\\(|\\[)\\s*(" + Version.VERSION_STRING + ")\\s*,\\s*("
- + Version.VERSION_STRING + ")\\s*(\\)|\\])");
-
- public VersionRange(String string) {
- string = string.trim();
- Matcher m = RANGE.matcher(string);
- if (m.matches()) {
- start = m.group(1).charAt(0);
- String v1 = m.group(2);
- String v2 = m.group(10);
- low = new Version(v1);
- high = new Version(v2);
- end = m.group(18).charAt(0);
- if (low.compareTo(high) > 0)
- throw new IllegalArgumentException("Low Range is higher than High Range: " + low + "-" + high);
-
- } else
- high = low = new Version(string);
- }
-
- public boolean isRange() {
- return high != low;
- }
-
- public boolean includeLow() {
- return start == '[';
- }
-
- public boolean includeHigh() {
- return end == ']';
- }
-
- public String toString() {
- if (high == low)
- return high.toString();
-
- StringBuilder sb = new StringBuilder();
- sb.append(start);
- sb.append(low);
- sb.append(',');
- sb.append(high);
- sb.append(end);
- return sb.toString();
- }
-
- public Version getLow() {
- return low;
- }
-
- public Version getHigh() {
- return high;
- }
-
- public boolean includes(Version v) {
- if (!isRange()) {
- return low.compareTo(v) <= 0;
- }
- if (includeLow()) {
- if (v.compareTo(low) < 0)
- return false;
- } else if (v.compareTo(low) <= 0)
- return false;
-
- if (includeHigh()) {
- if (v.compareTo(high) > 0)
- return false;
- } else if (v.compareTo(high) >= 0)
- return false;
-
- return true;
- }
-
- public Iterable<Version> filter(final Iterable<Version> versions) {
- List<Version> list = new ArrayList<Version>();
- for (Version v : versions) {
- if (includes(v))
- list.add(v);
- }
- return list;
- }
-
-}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/version/packageinfo b/bundleplugin/src/main/java/aQute/libg/version/packageinfo
deleted file mode 100644
index b3d1f97..0000000
--- a/bundleplugin/src/main/java/aQute/libg/version/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0.1