Class PubServerVersion


  • public class PubServerVersion
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String API_VERSION_PROPERTY
      Property name for pubserver API version as used in MANIFEST.MF files.
      static java.lang.String IMPLEMENTATION_VERSION_PROPERTY
      Property 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
      int checkServerCompatibility()
      Compares the version to the version of the current server (sdk).
      static 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).
      static int checkServerCompatibility​(java.lang.String versionStringToCheck)
      Compares the provided string to the version of the current server (sdk).
      java.lang.String getExtendedString()
      returns the version in a normalized 12 char long string format with "0" padding, e.g.
      int getGeneration()
      Pubserver generation (currently "4").
      int getMajor()
      Pubserver internal major version.
      int getMicro()
      Pubserver micro version.
      int getMinor()
      Pubserver minor version.
      java.lang.String getQualifier()
      Pubserver version qualifier.
      static PubServerVersion getServerVersion()  
      void parse​(java.lang.String newVersionString)
      Parses a string as PubServerVersion.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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:
        toString in class java.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
        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​(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"