Class AbstractVersion
java.lang.Object
ch.autumo.commons.application.AbstractVersion
- All Implemented Interfaces:
RegistrationVersion
Abstract base implementation of
RegistrationVersion for update/upgrade handling.
Loads a version history from an XML document (see load(java.io.InputStreamReader))
and answers upgrade queries against it. Subclasses supply the registration version and key.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classA version entry from the XML. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCurrentVersion(String appVersion) Get the version entry for the given application version from the loaded versions.final StringReturn a compressed version string: E.g.abstract StringThe registration key stays the same for the same product.final StringGet the salt which is a combination of version and key.abstract StringRegistration version ('x.y.z'), e.g.static doublegetVersion(String version) Get a version from string.hasFreeUpgrade(String appVersion) Check if a free upgrade is available based on the loaded versions.hasUpgrade(String appVersion) Check if a paid upgrade is available based on the loaded versions.booleanisLoaded()Are versions loaded from XML?voidload(InputStreamReader reader) Load a version history file (XML).toString()Returns an XML representation of all loaded version entries.
-
Constructor Details
-
AbstractVersion
protected AbstractVersion()Default constructor.
-
-
Method Details
-
getRegistrationVersion
Description copied from interface:RegistrationVersionRegistration 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:
getRegistrationVersionin interfaceRegistrationVersion- Returns:
- registration version
-
getRegistrationKey
Description copied from interface:RegistrationVersionThe registration key stays the same for the same product. Use different keys for different applications! (length = 25 characters)- Specified by:
getRegistrationKeyin interfaceRegistrationVersion- Returns:
- registration version
-
getKeyRegistrationVersion
Description copied from interface:RegistrationVersionReturn a compressed version string: E.g. "1.2.0" -> "120".- Specified by:
getKeyRegistrationVersionin interfaceRegistrationVersion- Returns:
- registered key version representation.
-
getRegistrationSalt
Description copied from interface:RegistrationVersionGet the salt which is a combination of version and key.- Specified by:
getRegistrationSaltin interfaceRegistrationVersion- Returns:
- registration version salt
-
load
Load a version history file (XML).- Parameters:
reader- version file XML input stream reader
-
hasFreeUpgrade
Check if a free upgrade is available based on the loaded versions.- Parameters:
appVersion- app version "x.x.x"- Returns:
- the available upgrade entry, or
nullif none is available
-
hasUpgrade
Check if a paid upgrade is available based on the loaded versions.- Parameters:
appVersion- app version "x.x.x"- Returns:
- the available upgrade entry, or
nullif none is available
-
getCurrentVersion
Get the version entry for the given application version from the loaded versions.- Parameters:
appVersion- app version "x.x.x"- Returns:
- the matching version entry, or
nullif not found
-
getVersion
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
-