Handling Product Versioning: Best Practices and Techniques

Published on: August 17, 2022
Last updated: July 6, 2023
LicenseSpring Guide
Table of Contents:

Product versioning allows vendors to release new versions of their licensed products and allows for more customization. This article will inform readers about defining and retrieving application versions, conditionally checking for updates using maintenance windows, verifying product versions on license check, and more.

  • Define and Retrieve Versions of an App on/after Installation
  • Conditionally Checking for Updates Using the Maintenance Window
  • Verify Product Version on License Check
  • Intermediate Updates, Channels, Minimum Required Version to Update, Maintenance Window, etc.
  • Comparing Versions

Define and Retrieve Versions of an App on/after Installation:

Current app version can be accessed after initializing our Configuration object as shown below:

cpp
1 std::string appVersion = pConfiguration->getAppVersion();

To set the application number, we adjust the fifth parameter of our Configuration constructor to reflect an appropriate version of the application being used:

Location of where App Version is Defined

To access a list of all available product versions, we use a method called getVersionList() that is called off the LicenseManager object. Acquiring a vector of strings containing all versions is done using the following lines:

cpp
1 std::vector<std::string> listVersions = licenseManager->getVersionList(licenseId);

Conditionally Checking for Updates Using the Maintenance Window:

The maintenance window feature is an effective way to check if there is an available update for a product. Since we have access to isMaintenancePeriodExpired(), which we can use as an indicator for when maintenance is finished. If this returns true, we receive the latest version of the product by running license->check() and can choose whether or not we update. Once we are informed of a maintenance period finishing, we can change this indicator to false so it does not consistently alert us that there is a new update.

Another way to check for new updates is to compare the version number of the installation file returned by license->check() to the current version being used. If they are not equal then there is an available update.

Verify Product Version on License Check:

To verify the most recently released product version on a license check, we will be creating an InstallationFile object to be equal to the return of license->check(). Since license->check() returns the most recent InstallationFile available for the license, we are then able to access the version by running

cpp
1 2 InstallationFile::ptr_t ins = license->check(); std::string version = ins->version();

The product version would then be stored as a string in “version”, prepared to be verified against the current license version being used.

Intermediate Updates and Required Version:

An intermediate update is an update that requires a certain version of the predict to be currently installed. The required version can be checked by using:

cpp
1 const std::string& requiredVersion() const {return m_requiredVersion;}

RequiredVersion() is a getter method for the InstallationFile object that allows for access to the stored required version necessary to install the version.

Channels:

An application channel is a logical communication link, used by applications to connect to a queue manager across a network. Channels are where the installation file is to be requested from, allowing the download of binaries for updates. For example, channels could be  "prod", "dev", etc. An empty string means it uses the default channel. Channels are a string that is stored within the InstallationFile object that can be accessed by calling:

cpp
1 const std::string& channel() const { return m_channel; } virtual bool

Maintenance Window:

A Maintenance window is a period of time designated in advance, during which preventive maintenance that could disrupt service may be performed. This maintenance time is added to a license during creation, or can be added to an existing license within the edit license page. Maintenance period duration can be checked by using:

cpp
1 virtual tm maintenancePeriod() const = 0;

To check whether the license is currently undergoing maintenance, we use:

cpp
1 isMaintenancePeriodExpired() const = 0;

Or to check number of days remaining:

cpp
1 virtual int maintenanceDaysRemaining() const = 0;

Comparing Versions:

When retrieving a version, they are returned as strings. This can make it appear difficult to compare versions, to see whether a new version is older or newer, whether a build is on a certain patch, etc. In the Version.h file, you will find the VersionBase class. You can convert strings into a VersionBase class, which will allow you to compare these versions, as well as update them precisely. You can then convert these VersionBase classes back into strings.

There is a strategy used in the version.cpp sample code for automatically checking if the device is running on the newest version. Since we can use a license check to get the most recently released version, we can compare this string to our application stored within the configuration object we created. If they are not equal, we know we are on an outdated version.

Kyle Brandon
Kyle BrandonSystems Engineer - LicenseSpring Software
Kyle Brandon is a Systems Engineer at LicenseSpring Software, based out of Vancouver, Canada. With over two years experience, Kyle helps current and prospective customers with ensuring successful implementation of all LicenseSpring has to offer. Specializing in Computing Science, Kyle uses that experience to assist with troubleshooting user-reported bugs and provide helpful guides.
0.O