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 Summary
Fields Modifier and Type Field Description static String
KEY_BUILD_ON
Manifest key for the date in ms when the package was build.static String
KEY_IMPLEMENTATION_BUILD
Manifest key for codebase packageVersion (usually git hash or svn id).static String
KEY_IMPLEMENTATION_TITLE
Manifest key for name of the Lib/app in the jar (usually maven name tag value).static String
KEY_IMPLEMENTATION_VERSION
Manifest key for VersionInfo of the code (usually matches Mvn packageVersion)static String
MANIFEST_PATH
Manifest Default Pathstatic String
SPRING_PATH
The path for classes loaded from a Spring Boot JAR filestatic String
WAR_PATH
The path for classes loaded from a WAR file
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getJavaVendor()
String
getJavaVersion()
String
getJavaVm()
String
getOsArch()
String
getOsName()
String
getOsVersion()
String
getPackageBuild()
String
getPackageBuildDate()
String
getPackageName()
String
getPackageVersion()
static VersionInfo
getVersion(Class clazz)
Gets the current VersionInfo base on a Class that will load it's manifest file.static VersionInfo
getVersion(Manifest manifest)
Gets the current VersionInfo based on Manifest & current JVM information.String
toString()
-
-
-
Field Detail
-
KEY_BUILD_ON
public static final String KEY_BUILD_ON
Manifest key for the date in ms when the package was build.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
KEY_IMPLEMENTATION_VERSION
public static final String KEY_IMPLEMENTATION_VERSION
Manifest key for VersionInfo of the code (usually matches Mvn packageVersion)- See Also:
- Constant Field Values
-
KEY_IMPLEMENTATION_BUILD
public static final String KEY_IMPLEMENTATION_BUILD
Manifest key for codebase packageVersion (usually git hash or svn id).- See Also:
- Constant Field Values
-
MANIFEST_PATH
public static final String MANIFEST_PATH
Manifest Default Path- See Also:
- Constant Field Values
-
WAR_PATH
public static final String WAR_PATH
The path for classes loaded from a WAR file- See Also:
- Constant Field Values
-
SPRING_PATH
public static final String SPRING_PATH
The path for classes loaded from a Spring Boot JAR file- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
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()
-
-