}
bool RequestHandlerInvoker::Validate() {
- if (!option_.Validate()) {
- LOG(ERROR) << "Parameter validation failed";
- return false;
- }
-
if (handler_ == nullptr) {
LOG(ERROR) << "Failed to initialize handler";
return false;
if (handler_ == nullptr)
return false;
- return handler_->Execute();
+ if (handler_->Execute() != ErrorType::ERROR_NONE)
+ return false;
+
+ return true;
}
const std::string RequestHandlerInvoker::GetHandlerType() const {
#include <iostream>
#include "include/event_signal_sender.hh"
+#include "include/logging.hh"
#include "include/param_checker.hh"
#include "include/request_handler_invoker.hh"
namespace rsc_handler {
bool RscHandler::Init(int argc, char* argv[]) {
- std::cout << "RscHandler::Init" << std::endl;
-
rsc_handler::ParamChecker option(argc, argv);
if (!option.Validate()) {
- // TODO(jungh.yeon) : error logs
+ LOG(ERROR) << "Invalid argument has given";
return false;
}
signal.SetPkgID(option.GetPkgID());
signal.SetReqType(option.GetRequestType());
- rsc_handler::RequestHandlerInvoker handler(option, signal);
- if (!handler.Validate()) {
- // TODO(jungh.yeon) : error logs
+ handler_.reset(new rsc_handler::RequestHandlerInvoker(option, signal));
+ if (!handler_->Validate()) {
+ LOG(ERROR) << "Failed to initialize request handler";
return false;
}
}
bool RscHandler::Run() {
- std::cout << "RscHandler::Run" << std::endl;
-
- return true;
+ return handler_->Execute();
}
} // namespace rsc_handler