Licme
Loading...
Searching...
No Matches
licme::manager::LicenseManager Class Reference

Manages license loading/activation/deactivation processes. More...

#include <license_manager.h>

Public Member Functions

 LicenseManager (manager::Configuration configuration)
 Construct a new License Manager.
 
 LicenseManager (const LicenseManager &)=delete
 
 LicenseManager (LicenseManager &&)=delete
 
 ~LicenseManager ()
 Destroy the License Manager.
 
void Validate (std::string_view strFeature, bool bTryRenew=true)
 validates a licensed feature
 
std::string GetProperty (std::string_view strFeature, std::string_view strProperty) const
 returns properties of a feature
 
void ReleaseAll ()
 deactivates all licensed features
 
void Renew ()
 renews the current volume
 

Static Public Member Functions

static void ValidateProductFeature (const std::string &strProductName, const std::string &strFeature, bool bTryRenew=true)
 tries to validate the given feature for the given product
 

Detailed Description

Manages license loading/activation/deactivation processes.

This is an implementation of the license management flow as it is expected by ADTF. So this could be used as top level API to the license management, or you could also ignore this class and develop your own processes using class License directly.

Constructor & Destructor Documentation

◆ LicenseManager()

licme::manager::LicenseManager::LicenseManager ( manager::Configuration configuration)

Construct a new License Manager.

Creates an instance that will try to load a license file. If loading fails because the file is invalid (maybe even manipulated), it tries to read the license key from it. If the license key could be read successfully, it is attempted to contact the server and deactivate that license so it could be activated in the next steps. If license key cannot be read from file, deactivation is omitted and activation will be tried right after. If this activation succeeds, a new license file is saved. If activation fails... well, I guess you won't get a license then ;-)

Member Function Documentation

◆ GetProperty()

std::string licme::manager::LicenseManager::GetProperty ( std::string_view strFeature,
std::string_view strProperty ) const

returns properties of a feature

Parameters
strFeaturefeature's name
strPropertyproperty name
Returns
std::string as value for that property

◆ Validate()

void licme::manager::LicenseManager::Validate ( std::string_view strFeature,
bool bTryRenew = true )

validates a licensed feature

The feature is looked up in the read license file and checked for valid activation due date. Returns without if this date is valid. It will throw a ValidationException in case the file has been fiddled with or the due date has already expired.

Parameters
strFeaturename of the feature to check
bTryRenewenable automated renewal if feature is missing or invalid
Exceptions
ValidationExceptionin case license for this feature is invalid

◆ ValidateProductFeature()

static void licme::manager::LicenseManager::ValidateProductFeature ( const std::string & strProductName,
const std::string & strFeature,
bool bTryRenew = true )
static

tries to validate the given feature for the given product

This function also captures all log messages and attaches them to an exception.

Parameters
strProductNamethe Product's Name.
strFeaturethe feature's name
bTryRenewenable automated renewal if feature is missing or invalid

The documentation for this class was generated from the following file: