Celartem
License System is a software license management system which is built into this library. This system limits several faetures of SDKs from abuses. For example, both of PixelLive and Secure DjVu has their own DRM (Digital Rights Management) system and its very important to verify every viewer correctly implements the DRM limitations (such as viewing, printing and exporting) thus we want to license the features only to the applications which are verified to confirm the DRM limitations.
The other reason is to protect against abuse of our software. We greatly appreciate your understanding of our SDK licensing policy.
The first thing to know is every thing related to license system is in
License namespace. So anyway what you have to do first is to do
"using namespace" this namespace or you have to add prefix
License:: on every call.
LicenseManager is the main interface to access the license system. As you already know, every sample contains the line of
LicenseManager::setLicenseScript. You have to do this before calls to the functions.
A license script identifies the product and its usage of SDK features. Specifically, a license script defines Product ID, Product Description and Feature Activation Schemata.
Product ID is a 128-bit identifier which uniquely identifies a product.
Product Description is human-readable string which briefly describes the product.
Feature Activation Schemata defines the usage of features. A feature is a function provided by the SDK and
Feature enumeration is used to describe them.
Each feature can be activated by one of the following schemata:
- Disabled
This scheme disables the feature. The user cannot use the feature. - Unlimited
This scheme allows the user to use the feature without any limitation. - Cartridge
This scheme consumes a cartridge when the user use the feature; cartridges should be installed before the usage. For more information about cartridges, see Cartridge System. - Development
This scheme is for development purpose and allow the user to use the feature 2 weeks after the build time of the application.
On the code, ActivationScheme enumeration is defined to describe the activation schemata.
By default, the library is initialized with a license script which enables development license for all features. So every feature can be used in 2 weeks after build. This license script is only for the development purpose and you must obtain a license script for your product when you release the product.
Cartridge system manages all the cartridges installed on a machine and it uses a centerized database. The database is initialized when some of the application firstly access to it and no formal installation, configuration and initialization is needed.
CartridgeManager is only the interface to access the cartridge system and you can get the global only one instance by calling
CartridgeManager::getCartridgeManager method.
On certain UNIX systems, because of some security system such as SELinux, the user sometimes need to specify a world-writable path for the database by calling CartridgeManager::setLicenseDbDirectory
Cartridge system manages all the products installed and activated on a machine. You can get the product IDs of these products by calling
CartridgeManager::getActivatedProducts method. The method returns an array of product IDs.
CartridgeManager& cm = CartridgeManager::getCartridgeManager();
SimpleArray<String> prodIds;
cm.getActivatedProducts(prodIds);
size_t count = prodIds.getSize();
for(size_t i = 0; i < count; i++)
{
printf("%u, %s\n", i, prodIds[i].c_str());
}
If you have a product ID, you can easily get the product status including how many cartridges currently installed on the machine.
ProductStatus structure is used to describe the status and the status is obtained by
CartridgeManager::getProductStatus method.
ProductStatus structure contains an array of
FeatureInfo structure. A
FeatureInfo entry describes activation scheme, remaining normal/trial cartridges and expiry for the trial cartridge.
A feature cartridge is consumed when the user uses the feature and the remaining cartridges actually means how many times the user can use the feature.
count member of
FeatureInfo structure is the number of the cartridge. There is also a special cartridge status; unlimited. If
count is equal to FeatureInfo::Unlimited, the cartridge is never consumed but it allows the user to use the feature unlimitedly.
Trial cartridges are the cartridges with expiry. The cartridges cannot be used after the expiry date-time.
altCount member of
FeatureInfo structure is the number of trial cartridges installed for a feature and the
expiry member is the expiry. The trial cartridge also have the unlimited status and if
altCount is equal to FeatureInfo::Unlimited, the trial cartridge is never consumed but it allows the user to use the feature unlimitedly until the expiry.