X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fboot%2Fa2%2FA2Branch.java;fp=org.argeo.osgi.boot%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fboot%2Fa2%2FA2Branch.java;h=0000000000000000000000000000000000000000;hb=79e0a2a5d751c7c077e52f9ee54469656dc96a44;hp=9e3f81dec95cbfa5758d18c3ea34a55145cace05;hpb=c155192cfcd5ca355eb933fa3f55dbad6d01b958;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/A2Branch.java b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/A2Branch.java deleted file mode 100644 index 9e3f81dec..000000000 --- a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/A2Branch.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.argeo.osgi.boot.a2; - -import java.util.Collections; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.argeo.osgi.boot.OsgiBootUtils; -import org.osgi.framework.Version; - -/** - * A logical linear sequence of versions of a given {@link A2Component}. This is - * typically a combination of major and minor version, indicating backward - * compatibility. - */ -public class A2Branch implements Comparable { - private final A2Component component; - private final String id; - - final SortedMap modules = Collections.synchronizedSortedMap(new TreeMap<>()); - - public A2Branch(A2Component component, String id) { - this.component = component; - this.id = id; - component.branches.put(id, this); - } - - A2Module getOrAddModule(Version version, Object locator) { - if (modules.containsKey(version)) { - A2Module res = modules.get(version); - if (OsgiBootUtils.isDebug() && !res.getLocator().equals(locator)) { - OsgiBootUtils.debug("Inconsistent locator " + locator + " (registered: " + res.getLocator() + ")"); - } - return res; - } else - return new A2Module(this, version, locator); - } - - A2Module last() { - return modules.get(modules.lastKey()); - } - - A2Module first() { - return modules.get(modules.firstKey()); - } - - A2Component getComponent() { - return component; - } - - String getId() { - return id; - } - - @Override - public int compareTo(A2Branch o) { - return id.compareTo(id); - } - - @Override - public int hashCode() { - return id.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof A2Branch) { - A2Branch o = (A2Branch) obj; - return component.equals(o.component) && id.equals(o.id); - } else - return false; - } - - @Override - public String toString() { - return getCoordinates(); - } - - public String getCoordinates() { - return component + ":" + id; - } - - static String versionToBranchId(Version version) { - return version.getMajor() + "." + version.getMinor(); - } -}