12#ifndef RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMONIMPL_HPP
13#define RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMONIMPL_HPP
15#include "deploymentDaemonEvents.rad.hpp"
30namespace cfw = rtctk::componentFramework;
37 static void Register(cfw::CommandReplier& replier, cfw::StateMachineEngine& engine) {
38 std::shared_ptr<elt::mal::rr::RrEntity> rr_service =
39 std::make_shared<DeploymentCmdsImpl>(engine);
40 replier.RegisterService<rtctkif::AsyncDeploymentCmds>(
"DeploymentCmds", rr_service);
44 : m_logger(cfw::
GetLogger(
"rtctk")), m_engine(engine) {
47 ::elt::mal::future<std::string>
Deploy(
const std::string& deploy_set)
override {
48 LOG4CPLUS_TRACE(m_logger,
"Received command 'Deploy' with deploy_set '" + deploy_set);
49 auto ev = std::make_shared<deployment_daemon_events::Deploy>(deploy_set);
50 auto f = ev->GetPayload().GetReplyFuture();
51 m_engine.PostEvent(ev);
55 ::elt::mal::future<std::string>
Undeploy()
override {
56 LOG4CPLUS_TRACE(m_logger,
"Received command 'Undeploy'");
57 auto ev = std::make_shared<deployment_daemon_events::Undeploy>();
58 auto f = ev->GetPayload().GetReplyFuture();
59 m_engine.PostEvent(ev);
64 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveDeployment'");
65 return cfw::InjectReqRepEvent<deployment_daemon_events::GetActiveDeployment>(m_engine);
69 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetDescription'");
70 return cfw::InjectReqRepEvent<deployment_daemon_events::GetDescription>(m_engine);
74 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetDeploymentSets'");
75 auto ev = std::make_shared<deployment_daemon_events::GetDeploymentSets>();
76 auto f = ev->GetPayload().GetReplyFuture();
77 m_engine.PostEvent(ev);
82 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetComponents'");
83 auto ev = std::make_shared<deployment_daemon_events::GetComponents>();
84 auto f = ev->GetPayload().GetReplyFuture();
85 m_engine.PostEvent(ev);
90 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveComponents'");
91 auto ev = std::make_shared<deployment_daemon_events::GetActiveComponents>();
92 auto f = ev->GetPayload().GetReplyFuture();
93 m_engine.PostEvent(ev);
97 ::elt::mal::future<std::string>
StartComponent(
const std::string& component_name)
override {
98 LOG4CPLUS_TRACE(m_logger,
99 "Received command 'StartComponent' with component_name'" + component_name);
100 auto ev = std::make_shared<deployment_daemon_events::StartComponent>(component_name);
101 auto f = ev->GetPayload().GetReplyFuture();
102 m_engine.PostEvent(ev);
106 ::elt::mal::future<std::string>
StopComponent(
const std::string& component_name)
override {
107 LOG4CPLUS_TRACE(m_logger,
108 "Received command 'StopComponent' with component_name'" + component_name);
109 auto ev = std::make_shared<deployment_daemon_events::StopComponent>(component_name);
110 auto f = ev->GetPayload().GetReplyFuture();
111 m_engine.PostEvent(ev);
115 ::elt::mal::future<std::vector<std::string>>
GetServices()
override {
116 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetServices'");
117 auto ev = std::make_shared<deployment_daemon_events::GetServices>();
118 auto f = ev->GetPayload().GetReplyFuture();
119 m_engine.PostEvent(ev);
124 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveServices'");
125 auto ev = std::make_shared<deployment_daemon_events::GetActiveServices>();
126 auto f = ev->GetPayload().GetReplyFuture();
127 m_engine.PostEvent(ev);
131 ::elt::mal::future<std::string>
GetState()
override {
132 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetState'");
133 return cfw::InjectReqRepEvent<deployment_daemon_events::GetState>(m_engine);
136 ::elt::mal::future<std::string>
Reset()
override {
137 LOG4CPLUS_TRACE(m_logger,
"Received command 'Reset'");
138 return cfw::InjectReqRepEvent<deployment_daemon_events::Reset>(m_engine);
141 ::elt::mal::future<std::string>
Exit()
override {
142 LOG4CPLUS_TRACE(m_logger,
"Received command 'Exit'");
143 return cfw::InjectReqRepEvent<deployment_daemon_events::Exit>(m_engine);
146 ::elt::mal::future<std::string>
147 SetLogLevel(
const std::shared_ptr<rtctkif::LogInfo>& info)
override {
148 LOG4CPLUS_TRACE(m_logger,
149 "Received command 'SetLogLevel' with logger '" + info->getLogger() +
150 "' and level '" + info->getLevel() +
"'");
151 auto ev = std::make_shared<deployment_daemon_events::SetLogLevel>(info->clone());
152 auto f = ev->GetPayload().GetReplyFuture();
153 m_engine.PostEvent(ev);
158 log4cplus::Logger& m_logger;
159 cfw::StateMachineEngine& m_engine;
::elt::mal::future< std::vector< std::string > > GetServices() override
Definition deploymentDaemonCmdsImpl.hpp:115
::elt::mal::future< std::string > GetState() override
Definition deploymentDaemonCmdsImpl.hpp:131
::elt::mal::future< std::string > GetActiveDeployment() override
Definition deploymentDaemonCmdsImpl.hpp:63
::elt::mal::future< std::vector< std::string > > GetActiveServices() override
Definition deploymentDaemonCmdsImpl.hpp:123
static void Register(cfw::CommandReplier &replier, cfw::StateMachineEngine &engine)
Definition deploymentDaemonCmdsImpl.hpp:37
::elt::mal::future< std::vector< std::string > > GetComponents() override
Definition deploymentDaemonCmdsImpl.hpp:81
::elt::mal::future< std::string > Exit() override
Definition deploymentDaemonCmdsImpl.hpp:141
::elt::mal::future< std::string > StopComponent(const std::string &component_name) override
Definition deploymentDaemonCmdsImpl.hpp:106
::elt::mal::future< std::string > SetLogLevel(const std::shared_ptr< rtctkif::LogInfo > &info) override
Definition deploymentDaemonCmdsImpl.hpp:147
::elt::mal::future< std::string > Reset() override
Definition deploymentDaemonCmdsImpl.hpp:136
::elt::mal::future< std::string > Deploy(const std::string &deploy_set) override
Definition deploymentDaemonCmdsImpl.hpp:47
::elt::mal::future< std::string > Undeploy() override
Definition deploymentDaemonCmdsImpl.hpp:55
::elt::mal::future< std::vector< std::string > > GetDeploymentSets() override
Definition deploymentDaemonCmdsImpl.hpp:73
::elt::mal::future< std::string > StartComponent(const std::string &component_name) override
Definition deploymentDaemonCmdsImpl.hpp:97
::elt::mal::future< std::string > GetDescription() override
Definition deploymentDaemonCmdsImpl.hpp:68
::elt::mal::future< std::vector< std::string > > GetActiveComponents() override
Definition deploymentDaemonCmdsImpl.hpp:89
DeploymentCmdsImpl(cfw::StateMachineEngine &engine)
Definition deploymentDaemonCmdsImpl.hpp:43
Receive commands via MAL.
log4cplus::Logger & GetLogger(const std::string &name="app")
Get handle to a specific logger.
Definition logger.cpp:191
Logging Support Library based on log4cplus.
Provides core functionality of an RTC Component.
Definition commandReplier.cpp:21
Definition deploymentDaemonBusinessLogic.cpp:34
Wrapper around the SCXML State Machine Engine.