org.xlattice
Class Version

java.lang.Object
  extended by org.xlattice.Version
Direct Known Subclasses:
Version

public abstract class Version
extends java.lang.Object

This is a first step towards a standard approach to version management for all XLattice components. What's wanted is automatic versioning, with the build number incremented by Ant or Eclipse. There should be a subclass of Version in the main source directory of each XLattice component. For example, CoreXml has one as org.xlattice.corexml.Version. The source files for these should be automatically generated but are currently being manually updated. Together the major, minor, and optional decimal version number are construed as a single number, n.m[.d]. The build number is to be incremented on each build, with or without a change in version number. XLattice Version numbers are compatible with JNLP version numbers.

Author:
Jim Dixon

Constructor Summary
Version(java.lang.String pkg, int major, int minor, int build)
           
Version(java.lang.String pkg, int major, int minor, int decimal, int build)
           
 
Method Summary
 int getBuild()
          Returns the build number.
 int getDecimal()
          Returns the third part of the version number.
 int getMajor()
          Returns the first part of the version number.
 int getMinor()
          Returns the second part of the version number.
 java.lang.String getPackage()
          Returns the fully qualified package name in dotted form, such as "org.xlattice.util".
 java.lang.String getVersion()
          Returns the package name, version number, and the build number if it is non-zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Version

public Version(java.lang.String pkg,
               int major,
               int minor,
               int decimal,
               int build)
Parameters:
pkg - package name in dotted form (a.b.c.d)
major - major part of version number
minor - minor part of version number
decimal - decimal part of version number
build - build number

Version

public Version(java.lang.String pkg,
               int major,
               int minor,
               int build)
Method Detail

getVersion

public final java.lang.String getVersion()
Returns the package name, version number, and the build number if it is non-zero. The package name is in fully qualified dotted form. The version number is returned as a decimal number, "major.minor". If the decimal part is non-negative, the version number is construed as a number with three parts, M.m.d, "major.minor.decimal". If the build number is a positive integer, it is appended as "-NNNNN", where NNNNN represents the integer value, possibly padded with leading zeroes.

Returns:
formatted version number

getPackage

public java.lang.String getPackage()
Returns the fully qualified package name in dotted form, such as "org.xlattice.util".

Returns:
the fully qualified package name

getMajor

public int getMajor()
Returns the first part of the version number. This is a non-negative integer. All releases with the same major version number should be compatible, in the sense that releases with a higher version number should be backward compatible with those with a lower version number.

Returns:
the major part of the version number

getMinor

public int getMinor()
Returns the second part of the version number. This is a non-negative integer. If the major version number is the same, then releases with higher minor version numbers should be backward compatible with releases with lower version numbers. This specifically means that if the major version number is the same and N1 and N2 are minor release numbers, then if N2 is higher than N1, then all N1 unit tests should succeed with release N2 software.

Returns:
the minor part of the version number

getDecimal

public int getDecimal()
Returns the third part of the version number. This is a non-negative integer; if the decimal part is negative, it should be ignored. If the major and minor release numbers are the same, then decimal releases represent steps towards implementing the target M.m functionality. If d2 is greater than d1, then M.m.d1 unit tests should succeed with M.m.d2, at least to the degree that they succeeded with M.m.d1.


getBuild

public int getBuild()
Returns the build number. Build numbers increase with each release, and should increase by 1. When the major release number is incremented, the build number is also incremented. That is, if version 1.2 build 5001 is followed by version 2.0, the build number should be 5002, so the full version number will be "2.0-05002".

Returns:
the build part of the version number