com.atlassian.jira.util
Class BuildUtilsInfoImpl

java.lang.Object
  extended by com.atlassian.jira.util.BuildUtilsInfoImpl
All Implemented Interfaces:
BuildUtilsInfo

public class BuildUtilsInfoImpl
extends Object
implements BuildUtilsInfo

This class gives access to build-time properties at runtime. Its sources are the legacy BuildUtils class and the BuildUtilsInfo.properties file.

Since:
v4.0

Constructor Summary
BuildUtilsInfoImpl()
          Creates a new BuildUtilsInfoImpl, loading the properties from the '' file.
 
Method Summary
 int getApplicationBuildNumber()
          Gets the build number of this JIRA install.
 String getApplinksVersion()
          Returns the version of AppLinks that JIRA ships with.
 String getBuildInformation()
          Gets a build information summary as a String.
 String getBuildPartnerName()
          Gets the partner name of this JIRA build
 String getBuildProperty(String key)
           
 String getCommitId()
          Returns the id of the SCM commit that was used to make this build of JIRA.
 Date getCurrentBuildDate()
          Gets the date this version of JIRA was built on.
 String getCurrentBuildNumber()
          Gets the current build number of JIRA.
 int getDatabaseBuildNumber()
          Gets the build number of the database that this JIRA instance points to.
 int getDowngradeAllowedBuildNumber()
           
 int getDowngradeAllowedBuildNumberMax()
           
 String getDowngradeAllowedVersion()
           
 String getGuavaOsgiVersion()
           
 String getMinimumUpgradableBuildNumber()
          Gets the minimal build number that JIRA can upgrade from
 String getMinimumUpgradableVersion()
          Get the minimum version of JIRA that can be upgraded to this instance version.
 String getSalVersion()
          Returns the version of Atlassian SAL that JIRA exports into OSGI-land.
 String getSvnRevision()
          Deprecated. 
 Collection<Locale> getUnavailableLocales()
           
 String getVersion()
          Gets the current version of JIRA
 int[] getVersionNumbers()
          Gets the numerical components of the version.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BuildUtilsInfoImpl

public BuildUtilsInfoImpl()
Creates a new BuildUtilsInfoImpl, loading the properties from the '' file. file.

Method Detail

getVersion

public String getVersion()
Description copied from interface: BuildUtilsInfo
Gets the current version of JIRA

Specified by:
getVersion in interface BuildUtilsInfo
Returns:
the current version of JIRA

getVersionNumbers

public int[] getVersionNumbers()
Description copied from interface: BuildUtilsInfo
Gets the numerical components of the version.
    • "5.0" gives [5, 0, 0]
      "5.0.1" gives [5, 0, 1]
      "5.0-beta1" gives [5.0.0]
      "5.0.1-SNAPSHOT" gives [5.0.1]
  • The returned array is guarenteed to have at least 3 elements. Any non-numeric suffix in getVersion() is ignored.

    A simple way to use this information is with Guava's Ints.lexicographicalComparator():

      int[] v510 = {5, 1, 0};
      if (Ints.lexicographicalComparator().compare(buildUtils.getVersionNumbers(), v510) >= 0 ) { ...
     

    Specified by:
    getVersionNumbers in interface BuildUtilsInfo
    Returns:
    the leading numerical components of getVersion()

    getCurrentBuildNumber

    public String getCurrentBuildNumber()
    Description copied from interface: BuildUtilsInfo
    Gets the current build number of JIRA.

    This is the same value as BuildUtilsInfo.getApplicationBuildNumber() except it is returned as a String.

    Specified by:
    getCurrentBuildNumber in interface BuildUtilsInfo
    Returns:
    the current build number of JIRA
    See Also:
    BuildUtilsInfo.getDatabaseBuildNumber(), BuildUtilsInfo.getApplicationBuildNumber()

    getApplicationBuildNumber

    public int getApplicationBuildNumber()
    Description copied from interface: BuildUtilsInfo
    Gets the build number of this JIRA install.

    That is, the build number of the currently running installation files. The DB also stores a build number.

    Specified by:
    getApplicationBuildNumber in interface BuildUtilsInfo
    Returns:
    the build number of this JIRA install.
    See Also:
    BuildUtilsInfo.getDatabaseBuildNumber()

    getDatabaseBuildNumber

    public int getDatabaseBuildNumber()
    Description copied from interface: BuildUtilsInfo
    Gets the build number of the database that this JIRA instance points to.

    Under normal circumstances this will be the same as the build number of the JIRA installation. However, when you first upgrade a JIRA database or import data exported from an older JIRA, the existing database will start on the previous build number. JIRA will then run "Upgrade Tasks" to update the data in the DB.

    Specified by:
    getDatabaseBuildNumber in interface BuildUtilsInfo
    Returns:
    the build number of the database that JIRA points to.
    See Also:
    BuildUtilsInfo.getCurrentBuildNumber()

    getMinimumUpgradableBuildNumber

    public String getMinimumUpgradableBuildNumber()
    Description copied from interface: BuildUtilsInfo
    Gets the minimal build number that JIRA can upgrade from

    Specified by:
    getMinimumUpgradableBuildNumber in interface BuildUtilsInfo
    Returns:
    the minimal build number that JIRA can upgrade from

    getDowngradeAllowedBuildNumber

    public int getDowngradeAllowedBuildNumber()
    Specified by:
    getDowngradeAllowedBuildNumber in interface BuildUtilsInfo
    Returns:
    the build number from which this version of JIRA is capable of downgrading.

    getDowngradeAllowedBuildNumberMax

    public int getDowngradeAllowedBuildNumberMax()
    Specified by:
    getDowngradeAllowedBuildNumberMax in interface BuildUtilsInfo
    Returns:
    the maximum build number from which this version of JIRA is capable of downgrading.

    getDowngradeAllowedVersion

    public String getDowngradeAllowedVersion()
    Specified by:
    getDowngradeAllowedVersion in interface BuildUtilsInfo
    Returns:
    the version that this .

    getCurrentBuildDate

    public Date getCurrentBuildDate()
    Description copied from interface: BuildUtilsInfo
    Gets the date this version of JIRA was built on.

    Specified by:
    getCurrentBuildDate in interface BuildUtilsInfo
    Returns:
    the date this version of JIRA was built on

    getBuildPartnerName

    public String getBuildPartnerName()
    Description copied from interface: BuildUtilsInfo
    Gets the partner name of this JIRA build

    Specified by:
    getBuildPartnerName in interface BuildUtilsInfo
    Returns:
    the partner name of this JIRA build.

    getBuildInformation

    public String getBuildInformation()
    Description copied from interface: BuildUtilsInfo
    Gets a build information summary as a String.

    Specified by:
    getBuildInformation in interface BuildUtilsInfo
    Returns:
    a build information summary

    getSvnRevision

    @Deprecated
    public String getSvnRevision()
    Deprecated. 

    Description copied from interface: BuildUtilsInfo
    Returns the SCM commit id that was used to make this build of JIRA. This used to be an SVN revision, but is now a Git commit id (aka a SHA1). This method returns an empty string if JIRA was built from the source distribution.

    Specified by:
    getSvnRevision in interface BuildUtilsInfo
    Returns:
    a String containing the SCM commit id, or an empty String.

    getCommitId

    public String getCommitId()
    Description copied from interface: BuildUtilsInfo
    Returns the id of the SCM commit that was used to make this build of JIRA. This method returns an empty string if JIRA was built from the source distribution.

    Specified by:
    getCommitId in interface BuildUtilsInfo
    Returns:
    the SCM commit id that was used to make this build of JIRA.

    getMinimumUpgradableVersion

    public String getMinimumUpgradableVersion()
    Description copied from interface: BuildUtilsInfo
    Get the minimum version of JIRA that can be upgraded to this instance version.

    Specified by:
    getMinimumUpgradableVersion in interface BuildUtilsInfo
    Returns:
    the minimum version that can be upgraded.

    getUnavailableLocales

    public Collection<Locale> getUnavailableLocales()
    Specified by:
    getUnavailableLocales in interface BuildUtilsInfo

    getSalVersion

    public String getSalVersion()
    Returns the version of Atlassian SAL that JIRA exports into OSGI-land.

    Specified by:
    getSalVersion in interface BuildUtilsInfo
    Returns:
    the version of Atlassian SAL that JIRA exports

    getApplinksVersion

    public String getApplinksVersion()
    Returns the version of AppLinks that JIRA ships with.

    Specified by:
    getApplinksVersion in interface BuildUtilsInfo
    Returns:
    the version of AppLinks that JIRA ships with

    getGuavaOsgiVersion

    public String getGuavaOsgiVersion()
    Specified by:
    getGuavaOsgiVersion in interface BuildUtilsInfo
    Returns:
    the osgi version that Guava (com.google.common) shold be exported as

    getBuildProperty

    public String getBuildProperty(String key)
    Specified by:
    getBuildProperty in interface BuildUtilsInfo

    toString

    public String toString()
    Overrides:
    toString in class Object


    Copyright © 2002-2013 Atlassian. All Rights Reserved.