/** * Looks up the build number (typically an SCM revision) of the specified * class. This information is retrieved from the JAR manifest's * <code>Implementation-Build</code> entry, or null if no such value exists. * * @param c - Look up this class's build number * @return Build number of specified {@link Class} or null if not found. */ public static String getBuildNumber(final Class<?> c) { final Manifest m = Manifest.getManifest(c); return m == null ? null : m.getImplementationBuild(); }
private String getBaseVersion() { final String manifestVersion = getImplementationVersion(); if (manifestVersion != null) return manifestVersion; return getSpecificationVersion(); }
public String getCreatedBy() { return get("Created-By"); }
/** * Looks up the version of the specified class using a JAR manifest if * available, appending the build number to any {@code SNAPSHOT} version. * * @param c - Look up this class's version * @return Version of specified {@link Class} or null if not found. */ public static String getVersionFromManifest(final Class<?> c) { final Manifest m = Manifest.getManifest(c); return m == null ? null : m.getVersion(); }
@Override public Manifest getManifest() { if (manifest == null) { // load the manifest lazily manifest = Manifest.getManifest(getClass()); } return manifest; }
@Override public String getVersion() { final String v = getBaseVersion(); if (v == null || !v.endsWith("-SNAPSHOT")) return v; // append commit hash to differentiate between development versions final String buildNumber = getImplementationBuild(); return buildNumber == null ? v : v + "-" + buildNumber; }
@Override public String getVersion() { final Class<?> c = loadLegacyClass(); if (c == null) return "<unknown>"; final Manifest m = Manifest.getManifest(c); return m == null ? null : m.getImplementationVersion(); }
/** * Returns the paragraph of textual information to display over the backdrop * image. */ private List<String> getTextBlock() { final Manifest mft = getApp().getManifest(); final LinkedList<String> stringList = new LinkedList<>(); stringList.add("Version: " + getApp().getVersion()); if (mft != null) { final String build = mft.getImplementationBuild(); stringList.add("Build: " + (build == null || build.length() < 10 ? build : build.substring(0, 10))); stringList.add("Date: " + mft.getImplementationDate()); } stringList.add("Open source image processing software"); final int year = Calendar.getInstance().get(Calendar.YEAR); stringList.add("Copyright 2010 - " + year); stringList.add("http://imagej.net/Contributors"); stringList.addAll(attributionStrings); return stringList; }
private static Manifest getManifest(final URL jarURL) throws IOException { final JarURLConnection conn = (JarURLConnection) jarURL.openConnection(); return new Manifest(conn.getManifest()); }
public static String getManifestData(final Manifest manifest) { if (manifest == null) return null; return mapToString(manifest.getAll()); }
@Override public Manifest getManifest() { if (manifest == null) { // load the manifest lazily manifest = Manifest.getManifest(getClass()); } return manifest; }
@Override public String getVersion() { final String v = getBaseVersion(); if (v == null || !v.endsWith("-SNAPSHOT")) return v; // append commit hash to differentiate between development versions final String buildNumber = getImplementationBuild(); return buildNumber == null ? v : v + "-" + buildNumber; }
/** * Looks up the version of the specified class using a JAR manifest if * available, appending the build number to any {@code SNAPSHOT} version. * * @param c - Look up this class's version * @return Version of specified {@link Class} or null if not found. */ public static String getVersionFromManifest(final Class<?> c) { final Manifest m = Manifest.getManifest(c); return m == null ? null : m.getVersion(); }
private static Manifest getManifest(final URL jarURL) throws IOException { final JarURLConnection conn = (JarURLConnection) jarURL.openConnection(); return new Manifest(conn.getManifest()); }
/** * Looks up the build number (typically an SCM revision) of the specified * class. This information is retrieved from the JAR manifest's * <code>Implementation-Build</code> entry, or null if no such value exists. * * @param c - Look up this class's build number * @return Build number of specified {@link Class} or null if not found. */ public static String getBuildNumber(final Class<?> c) { final Manifest m = Manifest.getManifest(c); return m == null ? null : m.getImplementationBuild(); }
/** Gets the JAR manifest associated with the given JAR file. */ public static Manifest getManifest(final File jarFile) throws IOException { if (!jarFile.exists()) throw new FileNotFoundException(); return getManifest(new URL("jar:file:" + jarFile.getAbsolutePath() + "!/")); }
public String getImplementationTitle() { return get("Implementation-Title"); }
private String getBaseVersion() { final String manifestVersion = getImplementationVersion(); if (manifestVersion != null) return manifestVersion; return getSpecificationVersion(); }
"Weird SCM tag '" + scmTag + "'; using commit hash."); final Manifest m = Manifest.getManifest(c); tag = m == null ? null : m.getImplementationBuild(); if (tag == null) log.debug("No commit hash found.");
/** Gets the JAR manifest associated with the given JAR file. */ public static Manifest getManifest(final File jarFile) throws IOException { if (!jarFile.exists()) throw new FileNotFoundException(); return getManifest(new URL("jar:file:" + jarFile.getAbsolutePath() + "!/")); }