com.continuent.tungsten.common.utils
Class ManifestParser

java.lang.Object
  extended by com.continuent.tungsten.common.utils.ManifestParser

public class ManifestParser
extends java.lang.Object

Parses .manifest.json file and makes properties easily accessible.

Version:
1.0
Author:
Linas Virbalas

Constructor Summary
ManifestParser()
          Prepare JSONParser and find out the home folder.
 
Method Summary
 java.lang.String getBuildDate()
           
 java.lang.Number getHudsonBuildNumber()
          Returns Hudson's build number from the manifest.
 java.lang.String getHudsonSVNRevision()
          Returns Hudson's used SVN revision from the manifest.
 java.lang.String getManifestPath()
          Path to the manifest file.
 java.lang.String getProduct()
          Returns product name from the manifest.
 java.lang.String getReleaseWithBuildNumber()
          Returns a representative string of release name, version and build number.
 java.lang.String getVersionFull()
          Returns concatenated version in format: MAJOR.MINOR.REVISION
 java.lang.Number getVersionMajor()
          Returns major (first) number of the version.
 java.lang.Number getVersionMinor()
          Returns minor (middle) number of the version.
 java.lang.Number getVersionRevision()
          Returns revision (last) number of the version.
 boolean isFileParsed()
           
static void logReleaseWithBuildNumber(org.apache.log4j.Logger logger)
          Convenience method for a single line call to log a representative string of release name, version and build number.
 boolean parse()
          Read and parse manifest file.
static java.lang.String parseReleaseWithBuildNumber()
          Convenience method for a single line call to get a representative string of release name, version and build number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManifestParser

public ManifestParser()
Prepare JSONParser and find out the home folder. Call parse() afterwards.

See Also:
parse()
Method Detail

parse

public boolean parse()
Read and parse manifest file. No exceptions are thrown upon failure intentionally.

Returns:
true, if parsed successfully, otherwise false.
See Also:
isFileParsed(), getReleaseWithBuildNumber()

getManifestPath

public java.lang.String getManifestPath()
Path to the manifest file.


getProduct

public java.lang.String getProduct()
Returns product name from the manifest.


getVersionMajor

public java.lang.Number getVersionMajor()
Returns major (first) number of the version.


getVersionMinor

public java.lang.Number getVersionMinor()
Returns minor (middle) number of the version.


getVersionRevision

public java.lang.Number getVersionRevision()
Returns revision (last) number of the version.


getVersionFull

public java.lang.String getVersionFull()
Returns concatenated version in format: MAJOR.MINOR.REVISION

Returns:
a) Version in MAJOR.MINOR.REVISION format;
b) null if non of the major, minor or revision numbers are defined.
c) If only one or two numbers are missing, returns question mark (?) in place of it. Eg.: 1.3.?

getBuildDate

public java.lang.String getBuildDate()

getHudsonBuildNumber

public java.lang.Number getHudsonBuildNumber()
Returns Hudson's build number from the manifest.


getHudsonSVNRevision

public java.lang.String getHudsonSVNRevision()
Returns Hudson's used SVN revision from the manifest.


getReleaseWithBuildNumber

public java.lang.String getReleaseWithBuildNumber()
Returns a representative string of release name, version and build number. This is a safe method in a sense it will never return a null.

Returns:
Release and build number or an error message that manifest file couldn't be read.

parseReleaseWithBuildNumber

public static java.lang.String parseReleaseWithBuildNumber()
Convenience method for a single line call to get a representative string of release name, version and build number.


logReleaseWithBuildNumber

public static void logReleaseWithBuildNumber(org.apache.log4j.Logger logger)
Convenience method for a single line call to log a representative string of release name, version and build number.

Parameters:
logger - Logger to log into.

isFileParsed

public boolean isFileParsed()
Returns:
True, if manifest was successfully parsed.