dca_interface  6.3.4
dca::License Class Reference

#include <base_classes.h>

Detailed Description

Use a License to initialize a classification package or a toolbox package.

See also
DcaInstance::createLicense()

Definition at line 559 of file base_classes.h.

Public Member Functions

bool isLicensed (DCA_MODULE_ID_TYPE id=0, bool force=false) const
 Checks whether the given License is valid for the given module id. More...
 
int getMaxSessions () const
 Returns the maximum allowed sessions associated with your ticket/license. More...
 
int getMaxUsers () const
 Returns the maximum allowed users associated with your ticket/license. More...
 
LogLevel setLogLevel (LogLevel newLevel)
 Sets the logging level for the given class instance. The old value will be returned. More...
 
std::string getTicket () const
 Returns the ticket of the license as string. More...
 
std::string getSession () const
 Returns the session of the license as string. More...
 
bool getCustomData (std::string &customData) const
 Returns CustomData as string if available. Whether custom data are available or not depends on your ticket. More...
 
time_t getExpirationDate () const
 Returns the expiration date of the license in UTC. More...
 
std::string getLastMessage () const
 Returns the last message received from our license server or if none available the last available message from the license component itself. More...
 

Member Function Documentation

◆ isLicensed()

bool dca::License::isLicensed ( DCA_MODULE_ID_TYPE  id = 0,
bool  force = false 
) const

Checks whether the given License is valid for the given module id.

If called with 0 as module id the overall license status will be returned.
You can use this e.g. with the UpdateModule::ID, UrlCustomDbModule::ID, TextClassification::ID,
UrlClassification::ID or ZlaClassification::ID to check     your license status for the specific module.

\param[in] id The module id to check
\param[in] force To force the license check to contact the license server set this parameter to true
\return true if still licensed, else false.

\note Normally the internally cached license status is returned. The license server
    is only contacted at license creation and at a fixed interval (every 23 hours). If the 
    license server is contacted the data stored in the license object (ie number of 
    sessions or users, custom data) can change.
    To force the license check to contact the server set the force parameter to true. Usually it is best 
    to set this parameter to false. Only in rare situations if you want to check for new 
    license data or your last license check failed set this parameter to true!
    If the license server is contacted and the session changes it is possible that running updates 
    are aborted!

◆ getMaxSessions()

int dca::License::getMaxSessions ( ) const

Returns the maximum allowed sessions associated with your ticket/license.

Returns
Numeric value, 0 if License is not valid or not assigned.

◆ getMaxUsers()

int dca::License::getMaxUsers ( ) const

Returns the maximum allowed users associated with your ticket/license.

Returns
Numeric value, 0 if License is not valid or not assigned.

◆ setLogLevel()

LogLevel dca::License::setLogLevel ( LogLevel  newLevel)

Sets the logging level for the given class instance. The old value will be returned.

Usually the logging level is set to LOG_Notice.

Parameters
[in]newLevelThe new LogLevel the class instance should use for logging
Returns
The old used logging level.

◆ getTicket()

std::string dca::License::getTicket ( ) const

Returns the ticket of the license as string.

Returns
The ticket of the license as string
Note
If the License is not correctly initialized an exception of type ExDca is thrown.

◆ getSession()

std::string dca::License::getSession ( ) const

Returns the session of the license as string.

Returns
The session of the license as string
Note
If the License is not correctly initialized an exception of type ExDca is thrown.

◆ getCustomData()

bool dca::License::getCustomData ( std::string &  customData) const

Returns CustomData as string if available. Whether custom data are available or not depends on your ticket.

Parameters
[out]customDataThe string representation of the custom data
Returns
Whether custom data are available or not.
Note
If the License is not correctly initialized an exception of type ExDca is thrown.

◆ getExpirationDate()

time_t dca::License::getExpirationDate ( ) const

Returns the expiration date of the license in UTC.

Returns
Returns the expiration date of the license.
Note
If the License is not correctly initialized an exception of type ExDca is thrown.

◆ getLastMessage()

std::string dca::License::getLastMessage ( ) const

Returns the last message received from our license server or if none available the last available message from the license component itself.

You may use the last message string for detailed descriptions of the last license operation or in case of error (see License::isLicensed()) for a detailed error description.

The returning string is in the format:

[server-message"|"server-rc] | [license component message]
Returns
The last server message and if not available the last message from the license component.

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