Package com.progress.open4gl.util
Class VersionFromManifestReader
java.lang.Object
com.progress.open4gl.util.VersionFromManifestReader
Reads the version from the manifest file. The build is expected to write
a META-INF/MANIFEST.MF into the .jar file with the correct headers. This requires
that "Bundle-Name: <some value>" and "Implementation-Version: <version>" attributes
be present in the file. if these cannot be reader, then the caller has to determine what to do,
as this will leave the major, minor, and maint version properties all at 999.
Version is expected to be in major.mainor.maint format, where each section is an integer.
Example:
12.3.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreturn build timestamp from manifest, as identified by the "Build-Timestamp" attributeint
Retrieve the maintenance version identified in the library manifest.int
Retrieve major version identified in the libray manifest.int
Retrieve minor version identified in the library manifest.Return the library version from the manifest, as identified by the "Implementation-Version" attibuteboolean
loadVersionFromManifest
(String bundleName) attempts to locate the manifest that contains the correct bundle information, and parses the implementation version information from the manifest.boolean
loadVersionFromStream
(String bundleName, InputStream in) tries to load the value of "Implementation-Version" from the stream which is assumed to be a manifest file.
-
Field Details
-
IMPLEMENTATION_VERSION
- See Also:
-
BUILD_TIMESTAMP
- See Also:
-
-
Constructor Details
-
VersionFromManifestReader
public VersionFromManifestReader()
-
-
Method Details
-
loadVersionFromManifest
attempts to locate the manifest that contains the correct bundle information, and parses the implementation version information from the manifest. UNFORUNATELY, java has no way to fetch the EXACT manifest from the correct file...so we have to look through all of them to find the right one...and we only know it is the right one because it has the bundle-name declared in it. We use gradle to write the manifest so it should always be there if using the .jar file- Throws:
IOException
-
loadVersionFromStream
tries to load the value of "Implementation-Version" from the stream which is assumed to be a manifest file. This is only loaded if the manifest has a property called "Bundle-Name" which contains the correct value.- Parameters:
in
-- Throws:
IOException
-
getMajorVersion
public int getMajorVersion()Retrieve major version identified in the libray manifest.- Returns:
-
getMinorVersion
public int getMinorVersion()Retrieve minor version identified in the library manifest.- Returns:
-
getMaintVersion
public int getMaintVersion()Retrieve the maintenance version identified in the library manifest.- Returns:
-
getRawVersion
Return the library version from the manifest, as identified by the "Implementation-Version" attibute- Returns:
-
getBuildTimestamp
return build timestamp from manifest, as identified by the "Build-Timestamp" attribute- Returns:
-