Class PubServerVersion
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 -
Constructor Summary
ConstructorsConstructorDescriptionPubServerVersion(Class<?> clazz) Retrieves the manifest from the jar where the class is located and parses the version string into an PubServerVersion object.PubServerVersion(String versionString) Parses a string into a PubServerVersion objects and returns the object. -
Method Summary
Modifier and TypeMethodDescriptionfinal intCompares the version to the version of the current server (sdk).static final intcheckServerCompatibility(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 final intcheckServerCompatibility(String versionStringToCheck) Compares the provided string to the version of the current server (sdk).final Stringreturns the version in a normalized 12 char long string format with "0" padding, e.g.final intPubserver generation (currently "4").final intgetMajor()Pubserver internal major version.final intgetMicro()Pubserver micro version.final intgetMinor()Pubserver minor version.final StringPubserver version qualifier.static final PubServerVersionfinal voidParses a string as PubServerVersion.final StringtoString()
-
Field Details
-
API_VERSION_PROPERTY
Property name for pubserver API version as used in MANIFEST.MF files.- See Also:
-
IMPLEMENTATION_VERSION_PROPERTY
Property name for application version as used in MANIFEST.MF files.- See Also:
-
-
Constructor Details
-
PubServerVersion
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
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 Details
-
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
Pubserver version qualifier.Version qualifier is an arbitrary string containing information from the build process.
- Returns:
- qualifier
-
toString
-
getExtendedString
returns the version in a normalized 12 char long string format with "0" padding, e.g. "4.12.34.5678".- Returns:
- version
-
checkServerCompatibility
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
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
- 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
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"
-