issrg.utils
Class Version

java.lang.Object
  extended by issrg.utils.Version

public class Version
extends java.lang.Object

This class stores the version information about a given package. Use it to collect the version from a bundle.

Author:
A.Otenko

Field Summary
protected static java.lang.String DEFAULT_DATE_PATTERN
          The default date pattern, if the pattern is missing in the bundle: "yyyy/MM/dd HH:mm".
protected static java.lang.String RELEASE_DATE_PATTERN_PROPERTY
           
protected static java.lang.String RELEASE_DATE_PROPERTY
           
protected static java.lang.String VERSION_MAJOR_PROPERTY
           
protected static java.lang.String VERSION_MINOR_MINOR_PROPERTY
           
protected static java.lang.String VERSION_MINOR_PROPERTY
           
 
Constructor Summary
Version(java.lang.String bundle, java.lang.String pkg)
          This constructor builds a Version object given a resource bundle name and a package name.
 
Method Summary
 java.util.Date getReleaseDate()
          This method returns the date of releasing the package, as recorded in the resource bundle.
 java.lang.String getVersion()
          This method returns the version string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_MAJOR_PROPERTY

protected static final java.lang.String VERSION_MAJOR_PROPERTY
See Also:
Constant Field Values

VERSION_MINOR_PROPERTY

protected static final java.lang.String VERSION_MINOR_PROPERTY
See Also:
Constant Field Values

VERSION_MINOR_MINOR_PROPERTY

protected static final java.lang.String VERSION_MINOR_MINOR_PROPERTY
See Also:
Constant Field Values

RELEASE_DATE_PATTERN_PROPERTY

protected static final java.lang.String RELEASE_DATE_PATTERN_PROPERTY
See Also:
Constant Field Values

RELEASE_DATE_PROPERTY

protected static final java.lang.String RELEASE_DATE_PROPERTY
See Also:
Constant Field Values

DEFAULT_DATE_PATTERN

protected static final java.lang.String DEFAULT_DATE_PATTERN
The default date pattern, if the pattern is missing in the bundle: "yyyy/MM/dd HH:mm".

See Also:
Constant Field Values
Constructor Detail

Version

public Version(java.lang.String bundle,
               java.lang.String pkg)
This constructor builds a Version object given a resource bundle name and a package name. It assumes there are <pkg>.version.major, <pkg>.version.minor, <pkg>.release.date.pattern and <pkg>.release.date properties. If some are missing, or the pattern of the date does not let parse the release date, the corresponding values will be null. If the date pattern is not available, the DEFAULT_DATE_PATTERN is used.

Parameters:
bundle - - the bundle name
pkg - - the package name, which is the prefix used to get the version information properties in the bundle (e.g. "acm" is prefixed to get "version.major" for ACM)
Method Detail

getVersion

public java.lang.String getVersion()
This method returns the version string.

Returns:
version string in a form "major.minor", or null, if no version is available; if "minor" is not available, "0" will be displayed as the minor version

getReleaseDate

public java.util.Date getReleaseDate()
This method returns the date of releasing the package, as recorded in the resource bundle.

Returns:
the date, or null, if date was not available, or the pattern specified could not be applied