/** * @file include/ActivMiddleware/ActivAgentApplication/LicenseService.h * * @brief Header file for the license service class. */ #if (!defined ACTIV_AGENT_APPLICATION_LICENSE_SERVICE_H) #define ACTIV_AGENT_APPLICATION_LICENSE_SERVICE_H #include "ActivMiddleware/ActivAgentApplication/External.h" #include //! Activ namespace. namespace Activ { //! License service class. class LicenseService : private ManagedEndPoint, public Component { public: using Component::GetApplication; //! Settings. class Settings { public: //! Default constructor. ACTIV_AGENT_APPLICATION_API Settings(); //! Destructor. ACTIV_AGENT_APPLICATION_API ~Settings(); /** * @brief Read settings from an ini file section. * * @param sectionIterator iterator to an ini file section. * * @throw Exception */ ACTIV_AGENT_APPLICATION_API void Read(const IniFileParser::ConstSectionIterator §ionIterator); typedef std::set SystemNameSet; ///< System name set type. typedef std::set MacAddressSet; ///< Mac address set type. typedef std::set ComponentLicenseIdFilterSet; ///< Component license id filter set type. ACTIV_AGENT_APPLICATION_API static const String defaultLicenseFileName; String m_licenseFileName; ///< License file name, if exists it is read and overrides all license settings. IHeap::Settings m_heapSettings; ///< Heap properties for service. ManagedEndPoint::Settings m_managedEndPointSettings; // License details, these will not be read from an ini file. They will be overridden if a license file is found. String m_licenseeName; ///< Licensee name. SystemNameSet m_systemNameSet; ///< system name set. MacAddressSet m_macAddressSet; ///< Mac address set. String m_ipAddress; ///< Ip address. String m_hostName; ///< Host name. String m_validFrom; ///< Valid from date. String m_validTo; ///< Valid to date. String m_maximumUpTime; ///< Maximum up time. String m_maximumUpTimeDays; ///< Maximum up time days. ComponentLicenseIdFilterSet m_componentLicenseIdFilterSet; ///< Component license id filter set. String m_signature; ///< Digital signature. }; //! License service ui component. class UiComponent ACTIV_FINAL : public Activ::UiComponent { public: /** * @brief Constructor. * * @param licenseService the license service to have the ui. * @param uiServiceName name of the ui service. * * @throw Exception. */ ACTIV_AGENT_APPLICATION_API UiComponent(LicenseService &licenseService, const String &uiServiceName); private: virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE; LicenseService & m_licenseService; ///< License service. // Last member. Component::Enabler m_componentEnabler; }; /** * @brief Constructor. * * The constructor creates an endpoint and heap in the system and runs a single thread. * * @param application the application the service is to run in. * @param serviceName the name of the license service. * @param settings settings for the license service. * * @throw Exception */ ACTIV_AGENT_APPLICATION_API LicenseService(Application &application, const String &serviceName, const Settings &settings); //! Destructor. ACTIV_AGENT_APPLICATION_API ~LicenseService(); class Impl; private: ACTIV_AGENT_APPLICATION_API virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE; ACTIV_AGENT_APPLICATION_API virtual StatusCode OnTimer(const Address &timerAddress, const DateTime &dateTime) ACTIV_OVERRIDE; Boost::scoped_ptr m_pImpl; }; } // namespace Activ #endif // (!defined ACTIV_AGENT_APPLICATION_LICENSE_SERVICE_H)