| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectohmm.Version
public class Version
Version utility.
This class provides several ways to determine version information for
 some particular codebase.  The version may have a number of components:
 svnVersion, earliestRevision, latestRevision, and
 versionDate; see which.  Any component(s) which cannot be
 determined are set to the value UNKNOWN.
The version info can either be taken from a version file which is
 read as a resouce associated with a particular version class, or it
 can be read from an SVN or CVS Id keyword expansion stored in a static field
 (SVN_ID_FIELD or CVS_ID_FIELD) of the version class.
If a version file is specified, or if DEFAULT_VERSION_FILE is
 implied, and the file is not present or there was a problem reading it then
 the version fields are left UNKNOWN.  Only in the case that the
 version file is explicitly specified as null is any attempt made to
 read the version info from an Id keyword field.
The format of the version file is an svn ID string in the format produced
 by the standard svnversion utility, followed by whitespace,
 followed by a date string, followed by whitespace.  Everything is optional
 and elements that are not present will be left as UNKNOWN.  The
 super-ninja makefile includes targets to auto-generate version files in this
 format.
Using a version file is generally better than relying on an Id keyword expansion, as the file can be generated to reflect the overall version of an entire svn tree, whereas the Id keyword only gives the version for that particular class.
| Field Summary | |
|---|---|
|  java.lang.String | classNameThe name of the class for which versioning was computed. | 
| static java.lang.String | CVS_ID_FIELDField name searched when attempting to read an SVN or CVS Id keyword expansion from a class. | 
| static java.lang.String | DEFAULT_VERSION_FILEthe name of the default version file, see class header doc | 
|  java.lang.String | earliestRevisionVersion string in the format produced by svnversion before any colon, or UNKNOWN. | 
|  java.lang.String | latestRevisionVersion string in the format produced by svnversion after any colon, or UNKNOWN. | 
| static java.lang.String | SVN_ID_FIELDField name searched when attempting to read an SVN or CVS Id keyword expansion from a class. | 
| private static java.lang.String | svnid | 
|  java.lang.String | svnVersionVersion string in the format produced by svnversion, or UNKNOWN. | 
| static java.lang.String | UNKNOWNunknown version fields are set to this value | 
|  java.lang.String | versionDateA string identifying the version by date or UNKNOWN. | 
|  java.lang.String | versionFileNameThe name of the file from which version info was read or null if version info was parsed from an SVN or CVS Id keyword expansion. | 
| Constructor Summary | |
|---|---|
| Version()Covers Version(Class, String), uses this class andDEFAULT_VERSION_FILE. | |
| Version(java.lang.Class clazz)Covers Version(Class, String), usesDEFAULT_VERSION_FILE. | |
| Version(java.lang.Class clazz,
        java.lang.String versionFileName)Parse version info. | |
| Version(java.lang.String versionFileName)Covers Version(Class, String), uses this class. | |
| Method Summary | |
|---|---|
|  void | dump()dump(PrintStream)toSystem.out | 
|  void | dump(java.io.PrintStream s)dumps all version info | 
| static void | main(java.lang.String[] arg)Test driver. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private static final java.lang.String svnid
public static final java.lang.String DEFAULT_VERSION_FILE
public static final java.lang.String UNKNOWN
public static final java.lang.String SVN_ID_FIELD
Field name searched when attempting to read an SVN or CVS Id keyword expansion from a class.
See header doc for details.
If such a field is found it will only be respected if it is a class field of type String.
public static final java.lang.String CVS_ID_FIELD
Field name searched when attempting to read an SVN or CVS Id keyword expansion from a class.
See header doc for details.
If such a field is found it will only be respected if it is a class field of type String.
public final java.lang.String svnVersion
Version string in the format produced by svnversion, or UNKNOWN.
public final java.lang.String earliestRevision
Version string in the format produced by svnversion before any
 colon, or UNKNOWN.
public final java.lang.String latestRevision
Version string in the format produced by svnversion after any
 colon, or UNKNOWN.
public final java.lang.String versionDate
A string identifying the version by date or UNKNOWN.
public final java.lang.String className
The name of the class for which versioning was computed.
In the case that the version info was read from a version file, this class was used as the reference to acquire the file as a resource.
In the case that the version info was read from a class field containing an SVN or CVS Id keyword expansion, this class was searched for the field.
public final java.lang.String versionFileName
The name of the file from which version info was read or null if version info was parsed from an SVN or CVS Id keyword expansion.
| Constructor Detail | 
|---|
public Version(java.lang.Class clazz,
               java.lang.String versionFileName)
Parse version info.
Specifying versionFileName other than null triggers version
 parsing from file.  If null version info is parsed from SVN_ID_FIELD or CVS_ID_FIELD, if present.
clazz - see className, not nullversionFileName - see versionFileNamepublic Version(java.lang.Class clazz)
Covers Version(Class, String), uses DEFAULT_VERSION_FILE.
public Version(java.lang.String versionFileName)
Covers Version(Class, String), uses this class.
public Version()
Covers Version(Class, String), uses this class and DEFAULT_VERSION_FILE.
| Method Detail | 
|---|
public void dump(java.io.PrintStream s)
public void dump()
dump(PrintStream) to System.out
public static void main(java.lang.String[] arg)
Test driver.
USAGE:
Version()Version(Class, String) with
 null versionFileNameVersion(Class,
 String)
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||