Newer
Older
package dk.gov.oiosi.configuration;
/**
* Administrative class to keep track of the version number of the OIORASP release.
* This class is created to be similar to Version classes in Apache project, e.g. org.apache.xalan.Version, but naming is adopted from
* http://en.wikipedia.org/wiki/Software_versioning#Change_significance
* In future it can be used by configuration procedures to check proper library related environment update.
* Do not mix it with dk.gov.oiosi.common.Version, which is Version of server and contains another information.
*/
public class Version {
private static int major;
private static int minor;
private static int maintenance;
private static String revision;
* Get the basic version string for the current OIORASP release. Version String formatted like
* <p/>
* <CODE>"<B>OIORASP</B> <B>Java</B> v.r.d"</CODE>.
* <p/>
* where v - major version number, r - release number, d - maintenance version number
*
* @return String denoting our current version
*/
public static String getVersion() {
StringBuilder sb = new StringBuilder();
sb.append(getProduct());
sb.append(" ");
sb.append(getImplementationLanguage());
sb.append(" ");
sb.append(getMajorVersionNum());
sb.append(".");
sb.append(".");
sb.append(getMaintenanceVersionNum());
return sb.toString();
}
/**
* Print the processor version to the command line.
*
* @param argv command line arguments, unused.
*/
public static void main(String argv[]) {
System.out.println(getVersion());
}
/**
* @return Name of product: OIORASP.
*/
public static String getProduct() {
return "OIORASP";
}
/**
* @return Implementation Language: Java.
*/
public static String getImplementationLanguage() {
return "Java";
}
* @return Major version number. This changes only when there is a significant, externally apparent enhancement from the previous
* release. 'n' represents the n'th version.
* Clients should carefully consider the implications of new versions as external interfaces and behaviour may have changed.
*/
public static int getMajorVersionNum() {
* @return Minor number. This changes when: - a new set of functionality is to be added, eg, implementation of a new W3C specification.
* - API or behaviour change. - it's designated as a reference release.
public static int getMinorVersionNum() {
return minor;
* @return Maintenance Drop Number. This identifier is used to designate maintenance drop applied to a specific release and contains
* fixes for defects reported. It maintains compatibility with the release and contains no API changes.
*/
public static int getMaintenanceVersionNum() {
return maintenance;
}
/**
* @return Revision code. This identifier gets the SVN commit number from which this software is compiled.
*/
public static String getRevisionNum() {
return revision;
}
/**
* Load and parse the version number held by ConfigurationHandler.
*
* Method is designed to be called from dk.gov.oiosi.configuration.ConfigurationHandler#loadXMLConfiguration() to have inversion of control.
*/
static void initNumbering() {
if (ConfigurationHandler.getVersionNumber() != null) {
String[] a = ConfigurationHandler.getVersionNumber().split("\\.");
major = Integer.parseInt(a[0]);
minor = Integer.parseInt(a[1]);
maintenance = Integer.parseInt(a[2]);
revision = a[3];
}