Class VersionInfo

java.lang.Object
org.craftercms.commons.monitoring.VersionInfo

public final class VersionInfo extends Object
Get's current version information about: 1. Current VM version runs current code. 2. Build Information from a given manifest file. 3. Name and version from a given manifest file.
Since:
3.0
Author:
Carlos Ortiz
  • Field Details

    • KEY_BUILD_ON

      public static final String KEY_BUILD_ON
      Manifest key for the date in ms when the package was build.
      See Also:
    • KEY_IMPLEMENTATION_TITLE

      public static final String KEY_IMPLEMENTATION_TITLE
      Manifest key for name of the Lib/app in the jar (usually maven name tag value).
      See Also:
    • KEY_IMPLEMENTATION_VERSION

      public static final String KEY_IMPLEMENTATION_VERSION
      Manifest key for VersionInfo of the code (usually matches Mvn packageVersion)
      See Also:
    • KEY_IMPLEMENTATION_BUILD

      public static final String KEY_IMPLEMENTATION_BUILD
      Manifest key for codebase packageVersion (usually git hash or svn id).
      See Also:
    • MANIFEST_PATH

      public static final String MANIFEST_PATH
      Manifest Default Path
      See Also:
    • WAR_PATH

      public static final String WAR_PATH
      The path for classes loaded from a WAR file
      See Also:
    • SPRING_PATH

      public static final String SPRING_PATH
      The path for classes loaded from a Spring Boot JAR file
      See Also:
  • Method Details

    • getVersion

      public static VersionInfo getVersion(Manifest manifest)
      Gets the current VersionInfo based on Manifest & current JVM information.
      Parameters:
      manifest - Manifest were to get the information.
      Returns:
      A VersionInfo pojo with information.
    • getVersion

      public static VersionInfo getVersion(Class clazz) throws IOException
      Gets the current VersionInfo base on a Class that will load it's manifest file.
      Parameters:
      clazz - Class that will load the manifest MF file
      Returns:
      A VersionInfo pojo with the information.
      Throws:
      IOException - If Unable to read the Manifest file.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getPackageName

      public String getPackageName()
    • getPackageVersion

      public String getPackageVersion()
    • getPackageBuild

      public String getPackageBuild()
    • getPackageBuildDate

      public String getPackageBuildDate()
    • getJavaVersion

      public String getJavaVersion()
    • getJavaVendor

      public String getJavaVendor()
    • getJavaVm

      public String getJavaVm()
    • getOsName

      public String getOsName()
    • getOsVersion

      public String getOsVersion()
    • getOsArch

      public String getOsArch()