org.rhq.enterprise.agent
Class Version

java.lang.Object
  extended by org.rhq.enterprise.agent.Version

public class Version
extends Object

Utility that can be used to determine the version of the software.

Author:
John Mazzitelli

Field Summary
static String PROP_BUILD_DATE
          Version property whose value is the date when this version of the product was built.
static String PROP_BUILD_JDK_VENDOR
          Version property whose value is the vendor of the JDK that built this version of the product.
static String PROP_BUILD_JDK_VERSION
          Version property whose value is the version of the JDK that built this version of the product.
static String PROP_BUILD_NUMBER
          Version property whose value is the source code revision number used to make the build.
static String PROP_BUILD_OS_NAME
          Version property whose value identifies the build machine's operating system.
static String PROP_BUILD_OS_VERSION
          Version property whose value is the build machine's operating system version.
static String PROP_PRODUCT_NAME
          Version property whose value is the product name.
static String PROP_PRODUCT_VERSION
          Version property whose value is the product version.
 
Constructor Summary
Version()
           
 
Method Summary
static Date getBuildDate()
          Returns just the product build date.
static String getBuildNumber()
          Returns just the product build number.
static String getProductName()
          Returns just the product name.
static String getProductNameAndVersion()
          Returns the product name and its version string.
static String getProductVersion()
          Returns just the product version.
static Properties getVersionProperties()
          Returns a set of properties that can be used to identify this version of the product.
static String getVersionPropertiesAsString()
          Returns the version properties in a single string with all properties on a single line separated with a newline.
static Date getVersionPropertyAsDate(String date_string)
          When a version property represents a date, this method will take that date string and convert it to a java.util.Date object.
static void main(String[] args)
          A main method that can be used to determine the version information from a command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_PRODUCT_NAME

public static final String PROP_PRODUCT_NAME
Version property whose value is the product name.

See Also:
Constant Field Values

PROP_PRODUCT_VERSION

public static final String PROP_PRODUCT_VERSION
Version property whose value is the product version.

See Also:
Constant Field Values

PROP_BUILD_NUMBER

public static final String PROP_BUILD_NUMBER
Version property whose value is the source code revision number used to make the build.

See Also:
Constant Field Values

PROP_BUILD_DATE

public static final String PROP_BUILD_DATE
Version property whose value is the date when this version of the product was built.

See Also:
Constant Field Values

PROP_BUILD_JDK_VENDOR

public static final String PROP_BUILD_JDK_VENDOR
Version property whose value is the vendor of the JDK that built this version of the product.

See Also:
Constant Field Values

PROP_BUILD_JDK_VERSION

public static final String PROP_BUILD_JDK_VERSION
Version property whose value is the version of the JDK that built this version of the product.

See Also:
Constant Field Values

PROP_BUILD_OS_NAME

public static final String PROP_BUILD_OS_NAME
Version property whose value identifies the build machine's operating system.

See Also:
Constant Field Values

PROP_BUILD_OS_VERSION

public static final String PROP_BUILD_OS_VERSION
Version property whose value is the build machine's operating system version.

See Also:
Constant Field Values
Constructor Detail

Version

public Version()
Method Detail

main

public static void main(String[] args)
A main method that can be used to determine the version information from a command line.

Parameters:
args - the version properties to print to stdout; if no arguments are given then all version properties are printed

getProductNameAndVersion

public static String getProductNameAndVersion()
Returns the product name and its version string.

Returns:
"productName Version"

getProductName

public static String getProductName()
Returns just the product name.

Returns:
product name

getProductVersion

public static String getProductVersion()
Returns just the product version.

Returns:
product version

getBuildDate

public static Date getBuildDate()
Returns just the product build date.

Returns:
product build date, or null if the date could not be determined due to an invalid date format

getBuildNumber

public static String getBuildNumber()
Returns just the product build number.

Returns:
product build number

getVersionProperties

public static Properties getVersionProperties()
Returns a set of properties that can be used to identify this version of the product.

Returns:
properties identifying this version
Throws:
RuntimeException - if there is no VERSION file found in the current thread's class loader

getVersionPropertiesAsString

public static String getVersionPropertiesAsString()
Returns the version properties in a single string with all properties on a single line separated with a newline.

Returns:
the version properties in one big string

getVersionPropertyAsDate

public static Date getVersionPropertyAsDate(String date_string)
When a version property represents a date, this method will take that date string and convert it to a java.util.Date object.

Assumes the date string is in the en.US locale based form of dd.MMM.yyyy HH.mm.ss z

Parameters:
date_string - the version property date string to convert
Returns:
the converted dataString as a java.util.Date object or null if the date string was in an invalid format


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.