Remove Activ libs and includes

This commit is contained in:
John Colvin committed 2023-12-15 13:15:08 -05:00
1 parent 28ed30c944
commit 4b718994be
10967 files changed
-2306716

No files matched your search

@@ -1,181 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/AgentApplication.h
*
* @brief Header file for agent application class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_AGENT_APPLICATION_H)
#define ACTIV_AGENT_APPLICATION_AGENT_APPLICATION_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivAgentApplication/TimerService.h"
#include "ActivMiddleware/ActivAgentApplication/LoggerService.h"
#include "ActivMiddleware/ActivAgentApplication/PubSubService.h"
#include "ActivMiddleware/ActivAgentApplication/MonitorService.h"
#include "ActivMiddleware/ActivAgentApplication/DirectoryService.h"
#include "ActivMiddleware/ActivAgentApplication/UiService.h"
#include "ActivMiddleware/ActivAgentApplication/LicenseService.h"
#include "ActivMiddleware/ActivBase/CommandLineParser.h"
#include "ActivMiddleware/ActivFramework/RouterService.h"
#include ACTIV_BOOST_INCLUDE(scoped_ptr.hpp)
//! Activ namespace.
namespace Activ
{
class UiMainComponent;
// ---------------------------------------------------------------------------------------------------------------------------------
/**
* @brief Agent application class.
*
* The AgentApplication class should be used when creating a shared memory system or stand alone process.
* It provides always on timer, logger, directory, router and pub-sub services.
*/
class AgentApplication : public Application
{
public:
//! Agent settings.
class Settings : public Application::Settings
{
public:
//! Default constructor.
ACTIV_AGENT_APPLICATION_API Settings();
//! Destructor.
ACTIV_AGENT_APPLICATION_API ~Settings();
/**
* @brief Read settings from an ini file.
*
* @param iniFileParser already parsed ini file to get settings from.
*
* @throw Exception
*/
ACTIV_AGENT_APPLICATION_API void Read(const IniFileParser &iniFileParser);
//! Modes for the UiService.
enum UiServiceMode
{
UI_SERVICE_MODE_OFF, ///< No UiService.
UI_SERVICE_MODE_NO_MENU, ///< On, but don't provide a main menu.
UI_SERVICE_MODE_EXTENDED_SHUTDOWN, ///< Regular main menu with shutdown validation.
UI_SERVICE_MODE_QUICK_SHUTDOWN, ///< Regular main menu with no shutdown validation.
UI_SERVICE_MODE_LITE ///< "Lite" main menu.
};
String m_systemVersion; ///< Optional version of the system.
IHeap::Settings m_systemHeapSettings; ///< Properties of the system heap.
String m_serviceLocationIniFile; ///< Service location ini file.
String m_processStartupIniFile; ///< Ini file for processes to launch.
bool m_createSystemLog; ///< Whether to create system log.
UInt m_maxTotalSizeOfBackupFiles; ///< Maximum total size of all system log backup files.
UInt m_systemLogSplitFileSize; ///< Position at which system log should split and move to new file.
UInt m_systemLogNumberOfBackups; ///< Number of past increments (days) for which to keep backup system log files.
bool m_enableTerminateProcessShutdown; ///< Initiate shutdown if SIGTERM/CTRL_CLOSE_EVENT received? Default: false.
UiServiceMode m_uiServiceMode; ///< Mode to run the UiService in.
bool m_isUiRestartEnabled; ///< Show restart option in ui.
// Core service settings.
TimerService::Settings m_timerServiceSettings; ///< Settings for timer service.
LoggerService::Settings m_loggerServiceSettings; ///< Settings for logger service.
RouterService::Settings m_routerServiceSettings; ///< Settings for router service.
PubSubService::Settings m_pubSubServiceSettings; ///< Pubsub service settings.
MonitorService::Settings m_monitorServiceSettings; ///< Monitor service settings.
DirectoryService::Settings m_directoryServiceSettings; ///< Settings for directory service.
UiService::Settings m_uiServiceSettings; ///< Settings for ui service.
LicenseService::Settings m_licenseServiceSettings; ///< Settings for license service.
};
//! Agent command line parser. Provides a common command line parser for ACTIV AgentApplications.
class AgentCommandLineParser : public CommandLineParser
{
public:
//! Default constructor.
ACTIV_AGENT_APPLICATION_API AgentCommandLineParser();
String m_iniFileName; ///< Default: <empty>. Configured file to use.
String m_userName; ///< Default: <empty>. Switch to this user context prior to constructing the AgentApplication (POSIX only).
String m_pidFile; ///< Default: <empty>. File to write the process pid to (POSIX ONLY).
bool m_isDaemon; ///< Default: false. If true start the process as a daemon (POSIX ONLY).
String m_cpuSet; ///< Default: "root". On start attempt to move the process to this cpuset.
bool m_isPrivate; ///< Default: false. If true use MEMORY_MODEL_PRIVATE instead of MEMORY_MODEL_SHARED.
bool m_shouldDisplayVersion; ///< Default: false. If true display ACTIV_MIDDLEWARE_VERSION_STRING and exit.
String m_startCommand; ///< Default: <empty>. The command to use to restart the process if requested.
String m_userContext; ///< Default: <empty>. Context string provided in the system ui field 'User context'.
size_t m_uptimeMilliseconds; ///< Default: 0. If non-zero, shutdown (or restart) the application after this time has elapsed.
String m_uiServiceUrl; ///< Default: UiService::Settings::defaultAccessPoint. The ui service access point to use.
bool m_isRestartEnabled; ///< Default: false. If true process will be restarted on exit.
};
/**
* @brief Create a system.
*
* @param settings agent settings.
* @param componentId the component id.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API AgentApplication(const Settings &settings = Settings(),
const String &componentId = defaultComponentId);
//! Destructor.
ACTIV_AGENT_APPLICATION_API virtual ~AgentApplication() ACTIV_OVERRIDE;
/**
* @brief Configure the default Agent settings used by ACTIV AgentApplications.
*
* @param settings agent settings.
* @param commandLineParser
*
* @throw Exception
* @throw std::exception
* @throw Boost::exception
*/
ACTIV_AGENT_APPLICATION_API static void ConfigureAgentSettings(Settings &settings,
const AgentCommandLineParser &commandLineParser);
/**
* @brief Configure Agent environment used by ACTIV AgentApplications.
*
* @param settings agent settings.
* @param commandLineParser
*
* @throw Exception
* @throw std::exception
* @throw Boost::exception
*/
ACTIV_AGENT_APPLICATION_API static void ConfigureAgentEnvironment(Settings &settings,
const AgentCommandLineParser &commandLineParser);
/**
* @brief Process Agent restart.
*
* @param isRestartEnabled
* @param restartCommand
*/
ACTIV_AGENT_APPLICATION_API static void ProcessAgentRestart(const bool isRestartEnabled, const String &restartCommand);
class Private;
protected:
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual void OnCtrlEvent(const CtrlHandler::EventType eventType) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual bool CanThreadExit() ACTIV_OVERRIDE;
private:
class UiFunctionality;
Boost::scoped_ptr<Private> m_pPrivate; ///< Hidden implementation details
friend class UiMainComponent;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_AGENT_APPLICATION_H)
@@ -1,110 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/DirectoryService.h
*
* @brief Header file for directory service class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_DIRECTORY_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_DIRECTORY_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivFramework/Service.h"
#include ACTIV_BOOST_INCLUDE(scoped_ptr.hpp)
//! Activ namespace.
namespace Activ
{
//! DirectoryService.
class DirectoryService : private ManagedEndPoint
{
public:
//! Settings.
class Settings
{
public:
//! Default constructor.
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 &sectionIterator);
bool m_shouldEnablePubSubMulticast; ///< Default: true. Whether pub-sub over multicast is enabled.
std::vector<String> m_pubSubMulticastAddressList; ///< Default: 233.58.54.255. Comma separated list of pub-sub multicast addresses.
IHeap::Settings m_heapSettings; ///< Heap properties for directory service, default buckets above.
ManagedEndPoint::Settings m_managedEndPointSettings;
String m_serviceAttributes; ///< Attributes for service when publishing existence of this DirectoryService.
std::vector<uint16_t> m_servicePortList; ///< List of TCP ports to attempt to listen on. The list will be randomized and then iterated until a free port is found.
// Discovery of other DirectoryServices.
std::vector<String> m_discoveryAttributeQueryList; ///< Only interested in other DirectoryServices which advertise with attributes that match one of these queries.
size_t m_cleanupServicesTimeout; ///< How long after the connection to a DirectoryService is lost to remove its services, in seconds.
size_t m_ttl; ///< TTL of discovery multicast. Default: 3.
ServiceInstanceList m_remoteDirectoryServiceInstanceList; ///< Configured list of remote directory services to add, pub-sub over multicast must be disabled.
// Conversion of hostnames in attributes.
std::vector<String> m_hostConversionAttributeKeyList; ///< List of attribute keys that might contain hostnames that need converting to ip addresses for remote directories.
std::vector<String> m_urlConversionAttributeKeyList; ///< List of attribute keys that might contain URLs that contain hostnames that need converting to ip addresses for remote directories.
};
//! Ui component.
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param directoryService object to show menu for.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(DirectoryService &directoryService, const String &uiServiceName);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
DirectoryService & m_directoryService;
// Last member.
Component::Enabler m_componentEnabler;
};
/**
* @brief Constructor.
*
* @param application Application object to attach to.
* @param serviceName name of the service.
* @param settings settings for directory service.
* @param serviceLocationIniFile filename of ini file containing static services.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API DirectoryService(Application &application, const String &serviceName, const Settings &settings,
const String &serviceLocationIniFile);
//! Destructor.
ACTIV_AGENT_APPLICATION_API ~DirectoryService();
class Impl;
private:
static CxxYZ::unique_ptr<DirectoryService::Impl> MakeImpl(DirectoryService &directoryService,
const String &serviceName, const Settings &settings, const String &serviceLocationIniFile);
CxxYZ::unique_ptr<Impl> m_pImpl;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_DIRECTORY_SERVICE_H)
@@ -1,20 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/External.h
*
* @brief Import rules for AgentApplication exports.
*/
#if (!defined ACTIV_AGENT_APPLICATION_EXTERNAL_H)
#define ACTIV_AGENT_APPLICATION_EXTERNAL_H
#if (!defined ACTIV_AGENT_APPLICATION_API)
# if (!defined ACTIV_STATIC)
# define ACTIV_AGENT_APPLICATION_API ACTIV_IMPORT_DLL
# else
# define ACTIV_AGENT_APPLICATION_API ACTIV_IMPORT_LIB
# endif // (!defined ACTIV_STATIC)
#endif // (!defined ACTIV_AGENT_APPLICATION_API)
#include "ActivMiddleware/ActivFramework/ActivFramework.h"
#endif // (!defined ACTIV_AGENT_APPLICATION_EXTERNAL_H)
@@ -1,116 +0,0 @@
/**
* @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 <set>
//! 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 &sectionIterator);
typedef std::set<String> SystemNameSet; ///< System name set type.
typedef std::set<String> MacAddressSet; ///< Mac address set type.
typedef std::set<String> 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;
Boost::scoped_ptr<Impl> m_pImpl;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_LICENSE_SERVICE_H)
@@ -1,112 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/LoggerService.h
*
* @brief Header file for the logger service class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_LOGGER_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_LOGGER_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
//! Activ namespace.
namespace Activ
{
/**
* @brief Logger service class.
*/
class LoggerService : private ManagedEndPoint, public Component
{
public:
using Component::GetApplication;
/**
* @brief Settings.
*/
class Settings
{
public:
/**
* @brief Default constructor.
*/
ACTIV_AGENT_APPLICATION_API Settings();
/**
* @brief 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 &sectionIterator);
IHeap::Settings m_heapSettings; ///< Heap properties for logger service, default buckets above.
ManagedEndPoint::Settings m_managedEndPointSettings;
String m_defaultLogDirectory; ///< Directory to put logs in if none specified, default current.
size_t m_systemLogHistorySize; ///< Number of system log entries to cache.
size_t m_numberOfInactiveDaysBeforeLogPurge; ///< Number of days before an inactive log is cleared.
std::vector<LogType> m_publishLogTypeList; ///< Publish log messages with any of these LogTypes.
};
/**
* @brief Logger service ui component.
*/
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param loggerService the logger service to have the ui.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(LoggerService &loggerService, const String &uiServiceName);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
LoggerService & m_loggerService;
// Last member.
Component::Enabler m_componentEnabler;
};
/**
* @brief Constructor.
*
* @param application the application the endpoint is running in.
* @param serviceName the name of the logger service.
* @param settings settings for the service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API LoggerService(Application &application, const String &serviceName, const Settings &settings);
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~LoggerService();
class Impl;
protected:
ACTIV_AGENT_APPLICATION_API virtual bool CanThreadExit() ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
private:
Boost::scoped_ptr<Impl> m_pImpl;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_LOGGER_SERVICE_H)
@@ -1,141 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/MonitorService.h
*
* @brief Header file for the monitor service class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_MONITOR_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_MONITOR_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include ACTIV_BOOST_INCLUDE(scoped_ptr.hpp)
//! Activ namespace.
namespace Activ
{
/**
* @brief Monitor service class.
*/
class MonitorService : private ManagedEndPoint, public Component
{
public:
using Component::GetApplication;
/**
* @brief Settings.
*/
class Settings
{
public:
/**
* @brief System monitor modes.
*/
enum SystemMonitorMode
{
SYSTEM_MONITOR_MODE_OFF, ///< Disable system monitor.
SYSTEM_MONITOR_MODE_ON, ///< Enable system monitor.
SYSTEM_MONITOR_MODE_ON_WITH_LOG ///< Enable system monitor & generate log file.
};
/**
* @brief Default constructor.
*/
ACTIV_AGENT_APPLICATION_API Settings();
/**
* @brief 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 &sectionIterator);
IHeap::Settings m_heapSettings; ///< Properties of heap to create for monitor service.
ManagedEndPoint::Settings m_managedEndPointSettings; ///< ManagedEndPoint settings for the main thread.
ManagedEndPoint::Settings m_pingerManagedEndPointSettings; ///< ManagedEndPoint settings for the pinger thread.
std::vector<String> m_diskMonitorList; ///< List of disks to monitor (default is disk containing working directory).
SystemMonitorMode m_systemMonitorMode; ///< Default: SYSTEM_MONITOR_MODE_ON.
bool m_enableHeapStatsLog; ///< Default: false.
bool m_enableDetailedHeapStatsLog; ///< Default: false. If true the heap stats log file will include bucket level stats.
bool m_enableEndPointStatsLog; ///< Default: false.
size_t m_systemStatsTimerInterval; ///< Default: 1000ms. How often to generate system / process stats.
size_t m_statsTimer; ///< Default: 5000ms. How often to generate endpoint / heap stats.
size_t m_threadStatsMonitorTimerInterval; ///< Default: 10000ms. How often to generate ThreadStatsMessages.
size_t m_endPointPingTimer; ///< Default: 2ms. Timer for dispatching endpoint pings which are sent in groups to cut down cpu spiking.
size_t m_endPointPingInterval; ///< Default: 50ms. How often to ping endpoints, in ms.
size_t m_endPointListUpdateInterval; ///< Default: 1000ms. How often to update the list of endpoint being pinged in ms.
size_t m_numberOfLogBackups; ///< Default: 40. Previous days logs to keep.
byte_t m_heapFreePublishPercent; ///< Default: 25. % free messages at which to publish heap stats.
byte_t m_totalHeapSizeAlertThresholdPercent; ///< Default: 88. 0 to disable. Generate an alert if total heap size / physical memory is greater than this threshold.
};
/**
* @brief Monitor service ui component.
*/
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param monitorService the monitor service to have the ui.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(MonitorService &monitorService, const String &uiServiceName);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
MonitorService & m_monitorService;
// Last member.
Component::Enabler m_componentEnabler;
};
/**
* @brief Constructor.
*
* @param application the application the service will be linked to.
* @param serviceName name of the service.
* @param settings settings for the service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API MonitorService(Application &application, const String &serviceName, const Settings &settings);
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~MonitorService();
/**
* @brief Get the number of processes being monitored.
*
* @return The number of processes.
*/
ACTIV_AGENT_APPLICATION_API size_t GetNumberOfProcesses() const;
protected:
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE;
private:
class Impl;
Boost::scoped_ptr<Impl> m_pImpl;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_MONITOR_SERVICE_H)
@@ -1,150 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/PubSubService.h
*
* @brief Header file for pubsub service.
*/
#if (!defined ACTIV_AGENT_APPLICATION_PUB_SUB_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_PUB_SUB_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivFramework/PubSubServiceApi.h"
#include <map>
//! Activ namespace.
namespace Activ
{
/**
* @brief Publish-subscribe service class.
*/
class PubSubService : private ManagedEndPoint, public Component
{
public:
using Component::GetApplication;
/**
* @brief Settings.
*/
class Settings
{
public:
/**
* @brief Republish settings.
*
* This describes a mapping from subject -> set of multicast outputs for that subject.
*/
class Republish
{
public:
typedef std::vector<String> MulticastNameList;
String m_subject; ///< (Partial) subject to match on
MulticastNameList m_multicastNameList; ///< List of multicast groups to output on
};
/**
* @brief Default constructor.
*/
ACTIV_AGENT_APPLICATION_API Settings();
/**
* @brief 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 &sectionIterator);
typedef std::map<String, PubSubServiceApi::Multicast> MulticastMap;
typedef std::vector<Republish> RepublishList;
IHeap::Settings m_heapSettings; ///< Properties of the service heap.
ManagedEndPoint::Settings m_managedEndPointSettings;
MulticastMap m_multicastMap; ///< Map of multicast outputs.
RepublishList m_republishList; ///< List of subjects to write to multicast outputs.
private:
/**
* @brief Process multicast section in the ini file.
*
* @param sectionIterator iterator to an ini file section.
*
* @throw Exception
*/
void ProcessMulticastSection(const IniFileParser::ConstSectionIterator &sectionIterator);
/**
* @brief Process republish section in the ini file.
*
* @param sectionIterator iterator to an ini file section.
*
* @throw Exception
*/
void ProcessRepublishSection(const IniFileParser::ConstSectionIterator &sectionIterator);
};
/**
* @brief Message broker service ui component.
*/
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param pubSubService service to show menu for.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(PubSubService &pubSubService, const String &uiServiceName);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
PubSubService & m_pubSubService;
// Last member.
Component::Enabler m_componentEnabler;
};
/**
* @brief Constructor.
*
* @param application the application the service will be linked to.
* @param serviceName name of the service.
* @param settings settings for the service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API PubSubService(Application &application, const String &serviceName, const Settings &settings);
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~PubSubService();
class Impl;
protected:
virtual bool CanThreadExit() ACTIV_OVERRIDE;
virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE;
virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
private:
const Boost::scoped_ptr<Impl> m_pImpl; ///< Implementation.
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_PUB_SUB_SERVICE_H)
@@ -1,138 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/TimerService.h
*
* @brief Header file for the timer service class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_TIMER_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_TIMER_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
//! Activ namespace.
namespace Activ
{
class TimerServiceImpl;
/**
* @brief Timer service class.
*/
class TimerService : private ManagedEndPoint, public Component
{
public:
using Component::GetApplication;
/**
* @brief Settings.
*/
class Settings
{
public:
/**
* @brief Default constructor.
*/
ACTIV_AGENT_APPLICATION_API Settings();
/**
* @brief 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 &sectionIterator);
/**
* @brief Heap properties for timer service, default buckets above.
*/
IHeap::Settings m_heapSettings;
/**
* @brief For TimerServiceApi::AdjustSystemTime(), threshold in milliseconds at which to set
* absolute time rather than adjust gradually. Default 60000.
*/
uint32_t m_adjustSystemTimeThreshold;
/**
* @brief Tick timeout; how often to check timers in microseconds.
*/
UInt m_tickTimeoutUs;
/**
* @brief Initial tick chime adjustment threshold; the threshold below which tick chimes will have a randomized start
* tick (milliseconds). Default 10000.
*/
uint64_t m_initialTickChimeAdjustmentThreshold;
/**
* @brief ManagedEndPoint settings for the service.
*/
ManagedEndPoint::Settings m_managedEndPointSettings;
};
/**
* @brief Timer service ui component.
*/
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param timerService the timer service to have the ui.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(TimerService &timerService, const String &uiServiceName);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
TimerService & m_timerService;
// 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 timer service.
* @param settings settings for the timer service.
*
* @throw Exception
*/
ACTIV_AGENT_APPLICATION_API TimerService(Application &application, const String &serviceName, const Settings &settings);
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~TimerService();
protected:
ACTIV_AGENT_APPLICATION_API virtual bool CanThreadExit() ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnRequest(HeapMessage &request) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
// ManagedEndPoint overrides
ACTIV_AGENT_APPLICATION_API virtual void Process() ACTIV_OVERRIDE;
private:
Boost::scoped_ptr<TimerServiceImpl> m_pImpl;
friend class TimerServiceImpl;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_TIMER_SERVICE_H)
@@ -1,63 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/UiLiteMainComponent.h
*
* @brief Header file for lite-style main ui component.
*/
#if (!defined ACTIV_AGENT_APPLICATION_UI_LITE_MAIN_COMPONENT_H)
#define ACTIV_AGENT_APPLICATION_UI_LITE_MAIN_COMPONENT_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivAgentApplication/UiMainComponent.h"
//! Activ namespace.
namespace Activ
{
/**
* @brief "Lite" main ui component.
*/
class UiLiteMainComponent : public UiMainComponent
{
public:
/**
* @brief Lite main menu.
*/
class UiMenu : public UiMainComponent::UiMenu
{
public:
/**
* @brief Constructor.
*
* @param uiComponent
* @param name
* @param uiUser
*/
ACTIV_AGENT_APPLICATION_API UiMenu(UiMainComponent &uiComponent, const String &name, UiUser &uiUser);
protected:
ACTIV_AGENT_APPLICATION_API virtual void DisplayTitle(const UiIo &uiIo) const ACTIV_OVERRIDE;
};
/**
* @brief Constructor.
*
* @param application AgentApplication to attach to.
* @param managedEndPoint endpoint to attach to - must be singly threaded.
* @param uiComponentName name of the ui component. This name is used to register the component with the main menu.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiLiteMainComponent(AgentApplication &application, ManagedEndPoint &managedEndPoint,
const String &uiComponentName, const String &uiServiceName = Application::GetUiServiceName());
ACTIV_AGENT_APPLICATION_API virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
protected:
ACTIV_AGENT_APPLICATION_API virtual bool IsValidRegistrationType(const UnderlyingType type) const ACTIV_OVERRIDE;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_UI_LITE_MAIN_COMPONENT_H)
@@ -1,276 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/UiMainComponent.h
*
* @brief Header file for the main ui component class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_UI_MAIN_COMPONENT_H)
#define ACTIV_AGENT_APPLICATION_UI_MAIN_COMPONENT_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivAgentApplication/AgentApplication.h"
#include "ActivMiddleware/ActivFramework/UiComponent.h"
#include "ActivMiddleware/ActivFramework/UiMenu.h"
#include ACTIV_BOOST_INCLUDE(scoped_ptr.hpp)
//! Activ namespace.
namespace Activ
{
class UiIo;
class UiComponentInfo;
// ---------------------------------------------------------------------------------------------------------------------------------
/**
* @brief Main ui component.
*
* The main ui component acts as the main, or master, menu of a ui service (the first menu clients will see).
* It also maintains a list of other ui components in the system that can be communicated with.
*/
class UiMainComponent : public UiComponent
{
public:
/**
* @brief Main menu.
*/
class UiMenu : public Activ::UiMenu
{
public:
/**
* @brief Constructor.
*
* @param uiComponent
* @param name
* @param uiUser
*/
ACTIV_AGENT_APPLICATION_API UiMenu(UiMainComponent &uiComponent, const String &name, UiUser &uiUser);
protected:
ACTIV_AGENT_APPLICATION_API virtual StatusCode GetOption(const UiIo &uiIo, const TimeoutPeriod timeoutPeriod,
String &optionString) const ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode ProcessOption(const UiIo &uiIo, const String &optionString) ACTIV_OVERRIDE;
/**
* @brief Display internal system menu.
*
* @param uiIo
*/
void DisplayInternalMenu(const UiIo &uiIo);
UiMainComponent &m_uiComponent;
};
/**
* @brief Constructor.
*
* @param application AgentApplication to attach to.
* @param managedEndPoint endpoint to attach to - must be singly threaded.
* @param uiComponentName name of the ui component. This name is used to register the component with the main menu.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiMainComponent(AgentApplication &application, ManagedEndPoint &managedEndPoint,
const String &uiComponentName, const String &uiServiceName = Application::GetUiServiceName());
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~UiMainComponent();
/**
* @brief Display system menu.
*
* @param uiIo
*/
ACTIV_AGENT_APPLICATION_API void UiDisplaySystemMenu(const UiIo &uiIo);
/**
* @brief Display process menu.
*
* @param uiIo
*/
ACTIV_AGENT_APPLICATION_API void UiDisplayProcessMenu(const UiIo &uiIo);
/**
* @brief Open command prompt within the ui session.
*
* @param uiIo for i/o with ui user.
*/
ACTIV_AGENT_APPLICATION_API void UiCommandPrompt(const UiIo &uiIo) const;
/**
* @brief Initiate system shutdown option.
*
* @param uiIo
*/
ACTIV_AGENT_APPLICATION_API void UiShutdownSystem(const UiIo &uiIo);
/**
* @brief Display ui components.
*
* @param uiIo for i/o with ui user.
*/
ACTIV_AGENT_APPLICATION_API void UiDisplayAvailableUiComponents(const UiIo &uiIo) const;
/**
* @brief Display ui components for middleware components only.
*
* @param uiIo for i/o with ui user.
*/
ACTIV_AGENT_APPLICATION_API void UiDisplayAvailableMiddlewareUiComponents(const UiIo &uiIo) const;
/**
* @brief Menu option to display list of available ui components.
*
* @param uiIo to read / write to / from the user.
* @param type type of ui component to display.
*/
ACTIV_AGENT_APPLICATION_API void UiDisplayAvailableUiComponentsByType(const UiIo &uiIo, const Type type) const;
/**
* @brief Display system info.
*
* @param uiIo for i/o with ui user.
*/
ACTIV_AGENT_APPLICATION_API void UiDisplaySystemInfo(const UiIo &uiIo) const;
protected:
ACTIV_AGENT_APPLICATION_API virtual bool IsValidRegistrationType(const UnderlyingType type) const ACTIV_OVERRIDE;
AgentApplication & m_agentApplication;
private:
/**
* @brief User has entered an option.
*
* @param uiIo to read / write to / from the user.
* @param optionString the option string.
*/
StatusCode OnOption(const UiIo &uiIo, const String &optionString);
// Display CPU topology.
void UiDisplayCpuTopology(const UiIo &uiIo) const;
/**
* @brief Display network interfaces.
*
* @param uiIo for i/o with ui user.
*/
static void UiDisplayNetworkInterfaces(const UiIo &uiIo);
/**
* @brief Display a network interface.
*
* @param uiIo for i/o with ui user.
* @param interfaceInfo
*/
static void UiDisplayNetworkInterfaceInfo(const UiIo &uiIo, const IpManager::InterfaceInfo &interfaceInfo);
/**
* @brief Display hosts file.
*
* @param uiIo for i/o with ui user.
*/
static void UiDisplayHostsFile(const UiIo &uiIo);
/**
* @brief Resolve hostname.
*
* @param uiIo for i/o with ui user.
*/
static void UiResolveHostname(const UiIo &uiIo);
/**
* @brief Display open processes' state.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayAllProcessesState(const UiIo &uiIo) const;
/**
* @brief Display open processes' context.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayAllProcessesContext(const UiIo &uiIo) const;
/**
* @brief Display process affinities.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayProcessAffinities(const UiIo &uiIo) const;
/**
* @brief Display more detailed info for a single process.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayProcess(const UiIo &uiIo) const;
/**
* @brief Watch summary endpoint stats.
*
* @param uiIo for i/o with ui user.
*/
void UiWatchEndPointStatsSummary(const UiIo &uiIo) const;
/**
* @brief Display components on an endpoint.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayComponents(const UiIo &uiIo) const;
/**
* @brief Reset endpoint high counts.
*
* @param uiIo for i/o with ui user.
*/
void UiResetEndPointHighs(const UiIo &uiIo);
/**
* @brief Watch summary heap stats.
*
* @param uiIo for i/o with ui user.
*/
void UiWatchHeapStatsSummary(const UiIo &uiIo) const;
/**
* @brief Reset heap stats.
*
* @param uiIo for i/o with ui user.
*/
void UiResetHeapStats(const UiIo &uiIo);
/**
* @brief Display heap request distribution.
*
* @param uiIo for i/o with ui user.
*/
void UiDisplayHeapRequestDistribution(const UiIo &uiIo);
/**
* @brief Force a dump file generation for a process.
*
* @param uiIo for i/o with ui user.
*/
void UiDumpProcess(const UiIo &uiIo) const;
/**
* @brief Shutdown a process cleanly.
*
* @param uiIo for i/o with ui user.
*/
void UiShutdownProcess(const UiIo &uiIo);
ScopedSubscription m_endPointSubject;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_UI_MAIN_COMPONENT_H)
@@ -1,164 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/UiService.h
*
* @brief Header file for the ui service class.
*/
#if (!defined ACTIV_AGENT_APPLICATION_UI_SERVICE_H)
#define ACTIV_AGENT_APPLICATION_UI_SERVICE_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include ACTIV_BOOST_INCLUDE(scoped_ptr.hpp)
#include <map>
//! Activ namespace.
namespace Activ
{
/**
* @brief Ui service class.
*
* A ui service requires the address of the ui component that is to act as the main menu of the service,
* which exists on a separate endpoint. A heap with the same name as this service must have been created
* before construction of this object.
*/
class UiService : private ManagedEndPoint, public Service
{
public:
using Service::GetApplication;
typedef String UserId; ///< Type of user id.
typedef String UserPassword; ///< Type of user password.
/**
* @brief User info.
*/
class UserInfo
{
public:
UserId m_id; ///< Id of user.
UserPassword m_password; ///< Password of user.
UiPermissions m_uiPermissions; ///< Ui permissions of user.
};
typedef std::map<UserId, UserInfo> UserInfoMap; ///< Type of user info map.
/**
* @brief Settings.
*/
class Settings
{
public:
/**
* @brief Default constructor.
*/
ACTIV_AGENT_APPLICATION_API Settings();
/**
* @brief 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 &sectionIterator);
//! Options for behavior of local console access to UiService.
enum ConsoleMode
{
CONSOLE_MODE_OFF, ///< No local console session to ui service.
CONSOLE_MODE_RESTART_TELNET_ON_CLOSE, ///< Local telnet session to ui service. Restart session if closed.
CONSOLE_MODE_SHUTDOWN_SYSTEM_ON_CLOSE ///< Local telnet session to ui service. Shutdown system if closed.
};
//! Settings for ui tunnelling.
class Tunnel
{
public:
String m_serviceId; ///< Service id for the tunnel service.
ServiceAccessPointList m_serviceAccessPointList; ///< Server-side access points. None by default.
String m_serviceAttributes; ///< Attributes for the tunnel service.
bool m_isClient; ///< Whether to attempt to connect to a tunnel service.
};
/**
* @brief Default UiService port. Append this to m_serviceAccessPointList if required.
*/
ACTIV_AGENT_APPLICATION_API static const ServiceAccessPoint defaultAccessPoint;
IHeap::Settings m_heapSettings; ///< Heap properties. Default buckets, see above.
ManagedEndPoint::Settings m_managedEndPointSettings;
ConsoleMode m_consoleMode; ///< Console client mode. Dflt CONSOLE_MODE_SHUTDOWN_SYSTEM_ON_CLOSE.
bool m_enableLogOutput; ///< Enable log output? Default == true.
bool m_enableAnonymousAccess; ///< Enable view-only anonymous user? Default == true.
UiPermissions m_anonymousAccessPermissions; ///< Anonymous access permissions.
ServiceAccessPointList m_serviceAccessPointList; ///< Access points. Default is empty; creates only a loopback server.
UserInfoMap m_userInfoMap; ///< Info about users.
Tunnel m_tunnel; ///< Tunnelling settings.
bool m_enableLog; ///< Log file to log user's input and output. Default == false.
};
/**
* @brief Ui service ui component.
*/
class UiComponent ACTIV_FINAL : public Activ::UiComponent
{
public:
/**
* @brief Constructor.
*
* @param uiService the ui service to have the ui.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiComponent(UiService &uiService);
private:
virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
UiService & m_uiService;
// Last member.
Component::Enabler m_componentEnabler;
};
/**
* @brief Constructor.
*
* @param application Application object to attach to.
* @param serviceName name of the service.
* @param settings settings for the service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiService(Application &application, const String &serviceName, const Settings &settings);
/**
* @brief Destructor.
*/
ACTIV_AGENT_APPLICATION_API ~UiService();
class Impl;
protected:
ACTIV_AGENT_APPLICATION_API virtual bool CanThreadExit() ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnMessage(HeapMessage &message) ACTIV_OVERRIDE;
ACTIV_AGENT_APPLICATION_API virtual StatusCode OnAccept(HeapMessage &acceptMessage) ACTIV_OVERRIDE;
private:
static const ServiceId m_serviceId; ///< Id of the ui service.
Boost::scoped_ptr<Impl> m_pImpl; ///< Implementation.
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_UI_SERVICE_H)
@@ -1,65 +0,0 @@
/**
* @file include/ActivMiddleware/ActivAgentApplication/UiStandardMainComponent.h
*
* @brief Header file for standard-style main ui component.
*/
#if (!defined ACTIV_AGENT_APPLICATION_UI_STANDARD_MAIN_COMPONENT_H)
#define ACTIV_AGENT_APPLICATION_UI_STANDARD_MAIN_COMPONENT_H
#include "ActivMiddleware/ActivAgentApplication/External.h"
#include "ActivMiddleware/ActivAgentApplication/UiMainComponent.h"
#include "ActivMiddleware/ActivAgentApplication/AgentApplication.h"
//! Activ namespace.
namespace Activ
{
/**
* @brief Standard main menu component.
*/
class UiStandardMainComponent : public Activ::UiMainComponent
{
public:
/**
* @brief Lite main menu.
*/
class UiMenu : public UiMainComponent::UiMenu
{
public:
/**
* @brief Constructor.
*
* @param uiComponent
* @param name
* @param uiUser
*/
ACTIV_AGENT_APPLICATION_API UiMenu(UiMainComponent &uiComponent, const String &name, UiUser &uiUser);
protected:
ACTIV_AGENT_APPLICATION_API virtual void DisplayFooter(const UiIo &uiIo) const ACTIV_OVERRIDE;
};
/**
* @brief Constructor.
*
* @param application AgentApplication to attach to.
* @param managedEndPoint endpoint to attach to - must be singly threaded.
* @param uiComponentName name of the ui component. This name is used to register the component with the main menu.
* @param uiServiceName name of the ui service.
*
* @throw Exception.
*/
ACTIV_AGENT_APPLICATION_API UiStandardMainComponent(AgentApplication &application, ManagedEndPoint &managedEndPoint,
const String &uiComponentName, const String &uiServiceName = Application::GetUiServiceName());
ACTIV_AGENT_APPLICATION_API virtual void Run(UiUser &uiUser) ACTIV_OVERRIDE;
protected:
ACTIV_AGENT_APPLICATION_API virtual bool IsValidRegistrationType(const UnderlyingType type) const ACTIV_OVERRIDE;
};
} // namespace Activ
#endif // (!defined ACTIV_AGENT_APPLICATION_UI_STANDARD_MAIN_COMPONENT_H)