Class VersionFromManifestReader

java.lang.Object
com.progress.open4gl.util.VersionFromManifestReader

public class VersionFromManifestReader extends Object
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 Details

  • Constructor Details

    • VersionFromManifestReader

      public VersionFromManifestReader()
  • Method Details

    • loadVersionFromManifest

      public boolean loadVersionFromManifest(String bundleName) throws IOException
      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

      public boolean loadVersionFromStream(String bundleName, InputStream in) throws IOException
      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

      public String getRawVersion()
      Return the library version from the manifest, as identified by the "Implementation-Version" attibute
      Returns:
    • getBuildTimestamp

      public String getBuildTimestamp()
      return build timestamp from manifest, as identified by the "Build-Timestamp" attribute
      Returns: