13#ifndef RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMONIMPL_HPP
14#define RTCTK_REUSABLECOMPONENT_DEPLOYMENT_DAEMONIMPL_HPP
16#include "deploymentDaemonEvents.rad.hpp"
31namespace cfw = rtctk::componentFramework;
38 static void Register(cfw::CommandReplier& replier, cfw::StateMachineEngine& engine) {
39 std::shared_ptr<elt::mal::rr::RrEntity> rr_service =
40 std::make_shared<DeploymentCmdsImpl>(engine);
41 replier.RegisterService<rtctkif::AsyncDeploymentCmds>(
"DeploymentCmds", rr_service);
45 : m_logger(cfw::
GetLogger(
"rtctk")), m_engine(engine) {
48 ::elt::mal::future<std::string>
Deploy(
const std::string& deploy_set)
override {
49 LOG4CPLUS_TRACE(m_logger,
"Received command 'Deploy' with deploy_set '" + deploy_set);
50 auto ev = std::make_shared<deployment_daemon_events::Deploy>(deploy_set);
51 auto f = ev->GetPayload().GetReplyFuture();
52 m_engine.PostEvent(ev);
56 ::elt::mal::future<std::string>
Undeploy()
override {
57 LOG4CPLUS_TRACE(m_logger,
"Received command 'Undeploy'");
58 auto ev = std::make_shared<deployment_daemon_events::Undeploy>();
59 auto f = ev->GetPayload().GetReplyFuture();
60 m_engine.PostEvent(ev);
65 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveDeployment'");
66 return cfw::InjectReqRepEvent<deployment_daemon_events::GetActiveDeployment>(m_engine);
70 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetDescription'");
71 return cfw::InjectReqRepEvent<deployment_daemon_events::GetDescription>(m_engine);
75 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetDeploymentSets'");
76 auto ev = std::make_shared<deployment_daemon_events::GetDeploymentSets>();
77 auto f = ev->GetPayload().GetReplyFuture();
78 m_engine.PostEvent(ev);
83 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetComponents'");
84 auto ev = std::make_shared<deployment_daemon_events::GetComponents>();
85 auto f = ev->GetPayload().GetReplyFuture();
86 m_engine.PostEvent(ev);
91 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveComponents'");
92 auto ev = std::make_shared<deployment_daemon_events::GetActiveComponents>();
93 auto f = ev->GetPayload().GetReplyFuture();
94 m_engine.PostEvent(ev);
98 ::elt::mal::future<std::string>
StartComponent(
const std::string& component_name)
override {
99 LOG4CPLUS_TRACE(m_logger,
100 "Received command 'StartComponent' with component_name'" + component_name);
101 auto ev = std::make_shared<deployment_daemon_events::StartComponent>(component_name);
102 auto f = ev->GetPayload().GetReplyFuture();
103 m_engine.PostEvent(ev);
107 ::elt::mal::future<std::string>
StopComponent(
const std::string& component_name)
override {
108 LOG4CPLUS_TRACE(m_logger,
109 "Received command 'StopComponent' with component_name'" + component_name);
110 auto ev = std::make_shared<deployment_daemon_events::StopComponent>(component_name);
111 auto f = ev->GetPayload().GetReplyFuture();
112 m_engine.PostEvent(ev);
116 ::elt::mal::future<std::vector<std::string>>
GetServices()
override {
117 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetServices'");
118 auto ev = std::make_shared<deployment_daemon_events::GetServices>();
119 auto f = ev->GetPayload().GetReplyFuture();
120 m_engine.PostEvent(ev);
125 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetActiveServices'");
126 auto ev = std::make_shared<deployment_daemon_events::GetActiveServices>();
127 auto f = ev->GetPayload().GetReplyFuture();
128 m_engine.PostEvent(ev);
132 ::elt::mal::future<std::string>
GetState()
override {
133 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetState'");
134 return cfw::InjectReqRepEvent<deployment_daemon_events::GetState>(m_engine);
137 ::elt::mal::future<std::string>
Reset()
override {
138 LOG4CPLUS_TRACE(m_logger,
"Received command 'Reset'");
139 return cfw::InjectReqRepEvent<deployment_daemon_events::Reset>(m_engine);
142 ::elt::mal::future<std::string>
Exit()
override {
143 LOG4CPLUS_TRACE(m_logger,
"Received command 'Exit'");
144 return cfw::InjectReqRepEvent<deployment_daemon_events::Exit>(m_engine);
147 ::elt::mal::future<std::string>
148 SetLogLevel(
const std::shared_ptr<rtctkif::LogInfo>& info)
override {
149 LOG4CPLUS_TRACE(m_logger,
150 "Received command 'SetLogLevel' with logger '" + info->getLogger() +
151 "' and level '" + info->getLevel() +
"'");
152 auto ev = std::make_shared<deployment_daemon_events::SetLogLevel>(info->clone());
153 auto f = ev->GetPayload().GetReplyFuture();
154 m_engine.PostEvent(ev);
159 log4cplus::Logger& m_logger;
160 cfw::StateMachineEngine& m_engine;
::elt::mal::future< std::vector< std::string > > GetServices() override
Definition deploymentDaemonCmdsImpl.hpp:116
::elt::mal::future< std::string > GetState() override
Definition deploymentDaemonCmdsImpl.hpp:132
::elt::mal::future< std::string > GetActiveDeployment() override
Definition deploymentDaemonCmdsImpl.hpp:64
::elt::mal::future< std::vector< std::string > > GetActiveServices() override
Definition deploymentDaemonCmdsImpl.hpp:124
static void Register(cfw::CommandReplier &replier, cfw::StateMachineEngine &engine)
Definition deploymentDaemonCmdsImpl.hpp:38
::elt::mal::future< std::vector< std::string > > GetComponents() override
Definition deploymentDaemonCmdsImpl.hpp:82
::elt::mal::future< std::string > Exit() override
Definition deploymentDaemonCmdsImpl.hpp:142
::elt::mal::future< std::string > StopComponent(const std::string &component_name) override
Definition deploymentDaemonCmdsImpl.hpp:107
::elt::mal::future< std::string > SetLogLevel(const std::shared_ptr< rtctkif::LogInfo > &info) override
Definition deploymentDaemonCmdsImpl.hpp:148
::elt::mal::future< std::string > Reset() override
Definition deploymentDaemonCmdsImpl.hpp:137
::elt::mal::future< std::string > Deploy(const std::string &deploy_set) override
Definition deploymentDaemonCmdsImpl.hpp:48
::elt::mal::future< std::string > Undeploy() override
Definition deploymentDaemonCmdsImpl.hpp:56
::elt::mal::future< std::vector< std::string > > GetDeploymentSets() override
Definition deploymentDaemonCmdsImpl.hpp:74
::elt::mal::future< std::string > StartComponent(const std::string &component_name) override
Definition deploymentDaemonCmdsImpl.hpp:98
::elt::mal::future< std::string > GetDescription() override
Definition deploymentDaemonCmdsImpl.hpp:69
::elt::mal::future< std::vector< std::string > > GetActiveComponents() override
Definition deploymentDaemonCmdsImpl.hpp:90
DeploymentCmdsImpl(cfw::StateMachineEngine &engine)
Definition deploymentDaemonCmdsImpl.hpp:44
Receive commands via MAL.
Logging Support Library based on log4cplus.
Provides core functionality of an RTC Component.
Definition commandReplier.cpp:22
log4cplus::Logger & GetLogger(const std::string &name="app")
Get handle to a specific logger.
Definition logger.cpp:192
Definition deploymentDaemonBusinessLogic.cpp:35
Wrapper around the SCXML State Machine Engine.