277 lines
6.8 KiB
C++
277 lines
6.8 KiB
C++
/**
|
|
* @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)
|