Class PubServerVersion
- java.lang.Object
-
- com.priint.pubserver.util.PubServerVersion
-
public class PubServerVersion extends java.lang.ObjectPubServerVersion holds a parsed representation of a pubserver version string.
Use the constructor to parse a version string.
Use the static serverVersion property to get the version of the underlying server itself (i.e. the PubServerSDK library).
Use one of the checkServerCompatibility methods to compare the parsed version to the serverVersion.Version strings contain at least major, minor and micro part. They can be prefixed by the priint generation number and suffixed by a qualifier string. E.g. "4.0.15.231.b12_r4533" may stand for a PubServer 4.0 plugin compatible to PubServerSDK library versions 15 or higher and patch level 231. We have generation=4, major=0, minor=15, micro=231, build-system-no=12, source-control-no=4533.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPI_VERSION_PROPERTYProperty name for pubserver API version as used in MANIFEST.MF files.static java.lang.StringIMPLEMENTATION_VERSION_PROPERTYProperty name for application version as used in MANIFEST.MF files.
-
Constructor Summary
Constructors Constructor Description PubServerVersion(java.lang.Class<?> clazz)Retrieves the manifest from the jar where the class is located and parses the version string into an PubServerVersion object.PubServerVersion(java.lang.String versionString)Parses a string into a PubServerVersion objects and returns the object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcheckServerCompatibility()Compares the version to the version of the current server (sdk).static intcheckServerCompatibility(java.lang.Class<?> clazz)Retrieves the manifest from the jar where the class is located and compares the version string to the version of the current server (sdk).static intcheckServerCompatibility(java.lang.String versionStringToCheck)Compares the provided string to the version of the current server (sdk).java.lang.StringgetExtendedString()returns the version in a normalized 12 char long string format with "0" padding, e.g.intgetGeneration()Pubserver generation (currently "4").intgetMajor()Pubserver internal major version.intgetMicro()Pubserver micro version.intgetMinor()Pubserver minor version.java.lang.StringgetQualifier()Pubserver version qualifier.static PubServerVersiongetServerVersion()voidparse(java.lang.String newVersionString)Parses a string as PubServerVersion.java.lang.StringtoString()
-
-
-
Field Detail
-
API_VERSION_PROPERTY
public static final java.lang.String API_VERSION_PROPERTY
Property name for pubserver API version as used in MANIFEST.MF files.- See Also:
- Constant Field Values
-
IMPLEMENTATION_VERSION_PROPERTY
public static final java.lang.String IMPLEMENTATION_VERSION_PROPERTY
Property name for application version as used in MANIFEST.MF files.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PubServerVersion
public PubServerVersion(java.lang.String versionString)
Parses a string into a PubServerVersion objects and returns the object.Throws IllegalArgumentException if string is null or if string cannot be matched by VERSION_PATTERN.
- Parameters:
versionString- e.g. "4.0.12.34" or "0.12.34+r456_b98"
-
PubServerVersion
public PubServerVersion(java.lang.Class<?> clazz)
Retrieves the manifest from the jar where the class is located and parses the version string into an PubServerVersion object.Throws IllegalArgumentException if version string in the manifest cannot be matched by VERSION_PATTERN.
- Parameters:
clazz-
-
-
Method Detail
-
getGeneration
public final int getGeneration()
Pubserver generation (currently "4").- Returns:
- generation
-
getMajor
public final int getMajor()
Pubserver internal major version.Products with different major versions are not compatible.
- Returns:
- major version
-
getMinor
public final int getMinor()
Pubserver minor version.Products with higher minor versions than the server version are incompatible. I.e. newer server and sdk versions are backward compatible within minor versions.
- Returns:
- minor version
-
getMicro
public final int getMicro()
Pubserver micro version.Different micro versions of some minor version are always compatible.
- Returns:
- micro
-
getQualifier
public final java.lang.String getQualifier()
Pubserver version qualifier.Version qualifier is an arbitrary string containing information from the build process.
- Returns:
- qualifier
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getExtendedString
public final java.lang.String getExtendedString()
returns the version in a normalized 12 char long string format with "0" padding, e.g. "4.12.34.5678".- Returns:
- version
-
checkServerCompatibility
public static final int checkServerCompatibility(java.lang.String versionStringToCheck)
Compares the provided string to the version of the current server (sdk).- returns 0 if the versions are compatible
- returns -1 if the version needs an older sdk
- returns +1 if the version needs a newer sdk
- Parameters:
versionStringToCheck-- Returns:
- compatibility flag
-
checkServerCompatibility
public static final int checkServerCompatibility(java.lang.Class<?> clazz)
Retrieves the manifest from the jar where the class is located and compares the version string to the version of the current server (sdk).- returns 0 if the versions are compatible
- returns -1 if the version needs an older sdk
- returns +1 if the version needs a newer sdk
- Parameters:
clazz-- Returns:
- compatibility flag
-
getServerVersion
public static final PubServerVersion getServerVersion()
- Returns:
- PubServerVersion of the underlying server itself (i.e. the PubServerSDK library).
-
checkServerCompatibility
public final int checkServerCompatibility()
Compares the version to the version of the current server (sdk).- returns 0 if the versions are compatible
- returns -1 if the version needs an older sdk
- returns +1 if the version needs a newer sdk
- Returns:
- compatibility flag
-
parse
public final void parse(java.lang.String newVersionString)
Parses a string as PubServerVersion.Throws IllegalArgumentException if string is null or if string cannot be matched by VERSION_PATTERN.
- Parameters:
newVersionString- e.g. "4.0.12.34" or "0.12.34+r456_b98"
-
-