Class AbstractVersion

java.lang.Object
ch.autumo.commons.application.AbstractVersion
All Implemented Interfaces:
RegistrationVersion

public abstract class AbstractVersion extends Object implements RegistrationVersion
Abstract version for update/upgrade handling.
  • Constructor Details

    • AbstractVersion

      public AbstractVersion()
  • Method Details

    • getRegistrationVersion

      public abstract String getRegistrationVersion()
      Description copied from interface: RegistrationVersion
      Registration version ('x.y.z'), e.g. "1.0.0". Change this if you want to jump to a new license key (purchase necessary).
      Specified by:
      getRegistrationVersion in interface RegistrationVersion
      Returns:
      registration version
    • getRegistrationKey

      public abstract String getRegistrationKey()
      Description copied from interface: RegistrationVersion
      The registration key stays the same for the same product. Use different keys for different applications! (length = 25 characters)
      Specified by:
      getRegistrationKey in interface RegistrationVersion
      Returns:
      registration version
    • getKeyRegistrationVersion

      public final String getKeyRegistrationVersion()
      Description copied from interface: RegistrationVersion
      Return a compressed version string: E.g. "1.2.0" -> "120".
      Specified by:
      getKeyRegistrationVersion in interface RegistrationVersion
      Returns:
      registered key version representation.
    • getRegistrationSalt

      public final String getRegistrationSalt()
      Description copied from interface: RegistrationVersion
      Get the salt which is a combination of version and key.
      Specified by:
      getRegistrationSalt in interface RegistrationVersion
      Returns:
      registration version salt
    • load

      public void load(InputStreamReader reader)
      Load a version history file (XML).
      Parameters:
      reader - version file XML input stream reader
    • hasFreeUpgrade

      public AbstractVersion.VersionEntry hasFreeUpgrade(String appVersion)
      Check if a free upgrade is available based on loaded versions.
      Parameters:
      appVersion - app version "x.x.x"
      Returns:
      true if so
    • hasUpgrade

      public AbstractVersion.VersionEntry hasUpgrade(String appVersion)
      Check if an upgrade is available based on loaded versions.
      Parameters:
      appVersion - app version "x.x.x"
      Returns:
      true if so
    • getCurrentVersion

      public AbstractVersion.VersionEntry getCurrentVersion(String appVersion)
      Get current APP version from loaded versions, not registration version.
      Parameters:
      appVersion - app version "x.x.x"
      Returns:
      APP version.
    • getVersion

      public static double getVersion(String version)
      Get a version from string.
      Parameters:
      version - version string
      Returns:
      version value
    • isLoaded

      public boolean isLoaded()
      Are versions loaded from XML?
      Returns:
      true if so
    • toString

      public String toString()
      Get loaded versions.
      Overrides:
      toString in class Object