Class PubServerVersion

java.lang.Object
com.priint.pubserver.util.PubServerVersion

public class PubServerVersion extends Object
PubServerVersion 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 Details

    • API_VERSION_PROPERTY

      public static final String API_VERSION_PROPERTY
      Property name for pubserver API version as used in MANIFEST.MF files.
      See Also:
    • IMPLEMENTATION_VERSION_PROPERTY

      public static final String IMPLEMENTATION_VERSION_PROPERTY
      Property name for application version as used in MANIFEST.MF files.
      See Also:
  • Constructor Details

    • PubServerVersion

      public PubServerVersion(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(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 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

      public final String getQualifier()
      Pubserver version qualifier.

      Version qualifier is an arbitrary string containing information from the build process.

      Returns:
      qualifier
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • getExtendedString

      public final 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(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(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
      This method actually implements the comparison, e.g. that micro version part is ignored whereas minor part is relevant (a plugin compiled against a higher minor version SDK as the running SDK can be rejected during deployment).
      Returns:
      compatibility flag
    • parse

      public final void parse(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"