JHotDraw 6.0b1

org.jhotdraw.util
Class VersionManagement

java.lang.Object
  extended by org.jhotdraw.util.VersionManagement

public class VersionManagement
extends java.lang.Object

Collection of utility methods that are useful for dealing with version information retrieved from reading jar files or package loaded by the class manager. Some methods also help comparing version information. The method getJHotDrawVersion() can be used to retrieve the current version of JHotDraw as loaded by the class manager.


Field Summary
static java.lang.String JHOTDRAW_COMPONENT
           
static java.lang.String JHOTDRAW_JAR
           
static java.lang.Package[] packages
           
 
Constructor Summary
VersionManagement()
           
 
Method Summary
static java.lang.String extractVersionInfo(java.lang.String versionString)
          Get the version information specified in a jar manifest file without any leading or trailing "\"".
static java.lang.String getJHotDrawVersion()
          Return the version of the main package of the framework.
protected static java.lang.String getNextPackage(java.lang.String searchPackage)
          Get the super package of a package specifier.
static java.lang.String getPackageVersion(java.lang.Package lookupPackage)
           
static boolean isCompatibleVersion(java.lang.String compareVersionString)
          Check whether a given application version is compatible with the version of JHotDraw currently loaded in the Java VM.
static java.lang.String normalizePackageName(java.lang.String toBeNormalized)
          A package name is normalized by replacing all path delimiters by "." to retrieve a valid standardized package specifier used in package declarations in Java source files.
static java.lang.String readVersionFromFile(java.lang.String applicationName, java.lang.String versionFileName)
          Read the version information from a file with a given file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JHOTDRAW_COMPONENT

public static java.lang.String JHOTDRAW_COMPONENT

JHOTDRAW_JAR

public static java.lang.String JHOTDRAW_JAR

packages

public static java.lang.Package[] packages
Constructor Detail

VersionManagement

public VersionManagement()
Method Detail

getJHotDrawVersion

public static java.lang.String getJHotDrawVersion()
Return the version of the main package of the framework. A version number is available if there is a corresponding version entry in the JHotDraw jar file for the framework package.


getPackageVersion

public static java.lang.String getPackageVersion(java.lang.Package lookupPackage)

isCompatibleVersion

public static boolean isCompatibleVersion(java.lang.String compareVersionString)
Check whether a given application version is compatible with the version of JHotDraw currently loaded in the Java VM. A version number is available if there is a corresponding version entry in the JHotDraw jar file for the framework package.


readVersionFromFile

public static java.lang.String readVersionFromFile(java.lang.String applicationName,
                                                   java.lang.String versionFileName)
Read the version information from a file with a given file name. The file must be a jar manifest file and all its entries are searched for package names and their specification version information. All information is collected in a map for later lookup of package names and their versions.

Parameters:
versionFileName - name of the jar file containing version information

getNextPackage

protected static java.lang.String getNextPackage(java.lang.String searchPackage)
Get the super package of a package specifier. The super package is the package specifier without the latest package name, e.g. the next package for "org.jhotdraw.tools" would be "org.jhotdraw".

Parameters:
searchPackage - package specifier
Returns:
next package if one is available, null otherwise

normalizePackageName

public static java.lang.String normalizePackageName(java.lang.String toBeNormalized)
A package name is normalized by replacing all path delimiters by "." to retrieve a valid standardized package specifier used in package declarations in Java source files.

Parameters:
toBeNormalized - package name to be normalized
Returns:
normalized package name

extractVersionInfo

public static java.lang.String extractVersionInfo(java.lang.String versionString)
Get the version information specified in a jar manifest file without any leading or trailing "\"".

Parameters:
versionString - a version string with possibly leading or trailing "\""
Returns:
stripped version information

JHotDraw 6.0b1