29package com.jogamp.common.util;
31import java.util.Iterator;
33import java.util.jar.Attributes;
34import java.util.jar.Manifest;
36import jogamp.common.os.AndroidUtils;
38import com.jogamp.common.os.Platform;
60 private static final String packageNameFAT =
"com.jogamp";
62 private final String packageName;
63 private final Manifest mf;
64 private final int hash;
65 private final Attributes mainAttributes;
66 private final Set<?> mainAttributeNames;
68 private final String androidPackageVersionName;
82 this.mf =
new Manifest();
83 this.packageName =
"unknown";
86 this.hash = this.mf.hashCode();
87 mainAttributes = this.mf.getMainAttributes();
88 mainAttributeNames = mainAttributes.keySet();
89 androidPackageVersionName = AndroidUtils.getPackageInfoVersionName(this.packageName);
98 public final boolean equals(
final Object o) {
113 public final String
getAttribute(
final Attributes.Name attributeName) {
114 return (
null != attributeName) ? (String) mainAttributes.get(attributeName) :
null;
122 for (
final Iterator<?> iter = mainAttributeNames.iterator(); iter.hasNext();) {
123 final Attributes.Name an = (Attributes.Name) iter.next();
124 if (an.toString().equals(attributeName)) {
135 return mainAttributeNames;
139 if(
null != androidPackageVersionName) {
142 return this.
getAttribute(Attributes.Name.EXTENSION_NAME);
202 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_TITLE);
206 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR);
210 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR_ID);
214 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_URL);
225 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_VERSION);
229 return androidPackageVersionName;
233 return this.
getAttribute(Attributes.Name.SPECIFICATION_TITLE);
237 return this.
getAttribute(Attributes.Name.SPECIFICATION_VENDOR);
241 return this.
getAttribute(Attributes.Name.SPECIFICATION_VERSION);
250 sb =
new StringBuilder();
275 private static interface TagProvider {
278 private static void addOptionalTag(
final StringBuilder sb,
final String title,
final TagProvider tag) {
279 final String tagName = tag.get();
280 if(
null != tagName ) {
281 sb.append(title+
": ").append(tagName).append(Platform.getNewline());
287 sb =
new StringBuilder();
final String getImplementationSHANatives()
Returns the SHA of all concatenated native library files of all build libs.
final StringBuilder getFullManifestInfo(final StringBuilder sb)
final String getImplementationVendorID()
final boolean equals(final Object o)
final String getImplementationBuild()
Returns the implementation build number, e.g.
final String getImplementationSHAClasses()
Returns the SHA of all concatenated class files of all build classes.
final String getAttribute(final String attributeName)
static final Attributes.Name IMPLEMENTATION_BUILD
See getImplementationBuild().
final String getAndroidPackageVersionName()
final Manifest getManifest()
final String getImplementationVersion()
Returns the IMPLEMENTATION_VERSION.
final String getImplementationURL()
static final Attributes.Name IMPLEMENTATION_BRANCH
See getImplementationBranch().
final String getImplementationVendor()
final Set<?> getAttributeNames()
final String getAttribute(final Attributes.Name attributeName)
final String getSpecificationVendor()
final String getImplementationSHASources()
Returns the SHA of all concatenated source files of the whole project.
StringBuilder getManifestInfo(StringBuilder sb)
static final Attributes.Name IMPLEMENTATION_SHA_SOURCES
See getImplementationSHASources().
final String getExtensionName()
static final Attributes.Name IMPLEMENTATION_SHA_CLASSES
See getImplementationSHAClasses().
final String getImplementationCommit()
Returns the SCM version of the last commit, e.g.
final String getImplementationSHANativesThis()
Returns the SHA of all concatenated native library files of the local (jar) package subset.
final String getImplementationSHAClassesThis()
Returns the SHA of all concatenated class files of the local (jar) package subset.
StringBuilder toString(StringBuilder sb)
final String getPackageName()
static final Attributes.Name IMPLEMENTATION_SHA_NATIVES
See getImplementationSHANatives().
static final Attributes.Name IMPLEMENTATION_SHA_CLASSES_THIS
See getImplementationSHAClassesThis().
final String getImplementationTitle()
JogampVersion(final Manifest mf)
static final Attributes.Name IMPLEMENTATION_SHA_NATIVES_THIS
See getImplementationSHANativesThis().
final String getImplementationBranch()
Returns the SCM branch name.
final String getSpecificationTitle()
static final Attributes.Name IMPLEMENTATION_COMMIT
See getImplementationCommit().
final String getSpecificationVersion()
final Attributes.Name getAttributeName(final String attributeName)
static final String SEPERATOR
static Manifest getManifest(final ClassLoader cl, final String extension)
Returns the manifest of the jar which contains the specified extension.
static String getExtensionName(final Manifest mf)
Returns the manifest's Attributes.Name.EXTENSION_NAME, i.e.
static StringBuilder getFullManifestInfo(final Manifest mf, StringBuilder sb)