Add GetRequestHandlerType() on AbstractRequesthandler 09/262409/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 10 Aug 2021 05:42:54 +0000 (14:42 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 10 Aug 2021 05:42:54 +0000 (14:42 +0900)
Add function to check type of RequestHandler.

Change-Id: I6b041a90abf5e766fc07846d479b277c657d654f
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/rsc-copy/include/abstract_request_handler.hh
src/rsc-copy/include/copy_request_handler.hh
src/rsc-copy/include/remove_request_handler.hh
src/rsc-copy/include/uninstall_request_handler.hh
src/rsc-copy/src/abstract_request_handler.cc
src/rsc-copy/src/copy_request_handler.cc
src/rsc-copy/src/remove_request_handler.cc
src/rsc-copy/src/uninstall_request_handler.cc

index 5f5491763035d913a85bc250c27f425fa7f686cc..99ebaa320027e3a3f9518a7490873cbd4861e5e8 100644 (file)
@@ -31,6 +31,7 @@ class AbstractRequestHandler {
       pkgid_(pkgid), path_list_(path_list) {};
 
   virtual ErrorType Execute() = 0;
+  virtual std::string GetRequestHandlerType() = 0;
 
  protected:
   std::string GetRootPath();
index 8993cf38ddafc17c5f305c0b649c9d006266f429..adbeba61cd6a036ca63a75bcdf6cdb9db89a0b8b 100644 (file)
@@ -28,9 +28,12 @@ namespace rsc_handler {
 
 class CopyRequestHandler : public AbstractRequestHandler {
  public:
+  CopyRequestHandler(std::string pkgid, std::list<RscPathInfo> path_list);
+
   ErrorType Execute() override;
+  std::string GetRequestHandlerType() override;
 };
 
-}  // rsc_handler
+}  // namespace rsc_handler
 
 #endif  // COPY_REQUEST_HANDLER_HH_
index 04a906b074f0cfe86299a8c34a1dfef438e11963..bd316e2ee5ea9a77105f4840dc01558a524ad52a 100644 (file)
@@ -28,9 +28,12 @@ namespace rsc_handler {
 
 class RemoveRequestHandler : public AbstractRequestHandler {
  public:
+  RemoveRequestHandler(std::string pkgid, std::list<RscPathInfo> path_list);
+
   ErrorType Execute() override;
+  std::string GetRequestHandlerType() override;
 };
 
-}  // rsc_handler
+}  // namespace rsc_handler
 
 #endif  // REMOVE_REQUEST_HANDLER_HH_
index d0dd127785ab0a1399cd31a73dc86fa6f8364ac4..0f742c487467a6daf17682160ae8a0bdea767d0f 100644 (file)
@@ -28,9 +28,12 @@ namespace rsc_handler {
 
 class UninstallRequestHandler : public AbstractRequestHandler {
  public:
+  UninstallRequestHandler(std::string pkgid, std::list<RscPathInfo> path_list);
+
   ErrorType Execute() override;
+  std::string GetRequestHandlerType() override;
 };
 
-}  // rsc_handler
+}  // namespace rsc_handler
 
 #endif  // UNINSTALL_REQUEST_HANDLER_HH_
index 6b4fe485d6aa7c25af3c79e4189f4d95728964be..c51b3e0d294d1dad18a32b87c622f3336c50fff8 100644 (file)
@@ -33,5 +33,4 @@ std::string AbstractRequestHandler::GetRootPath() {
   return root_path;
 }
 
-
 }  // namesapce rsc_handler
index 1d649db19c1c8447857ce5d7c3a3141802a35bb0..d26995b26b52e1a76b6684ced0c1d4e2b34126cf 100644 (file)
 #include "include/copy_request_handler.hh"
 
 #include <iostream>
+#include <string>
 
+#include "include/abstract_request_handler.hh"
 #include "include/error_type.hh"
 #include "include/rsc_path_info.hh"
 
+namespace {
+
+constexpr char kCopyReqHandlerType[] = "copy";
+
+}  // namespace
+
 namespace rsc_handler {
 
+CopyRequestHandler::CopyRequestHandler(
+    std::string pkgid, std::list<RscPathInfo> path_list) :
+  AbstractRequestHandler(pkgid, path_list) {}
+
 ErrorType CopyRequestHandler::Execute() {
   std::cout << "CopyRequestHandler::Execute" << std::endl;
 
   return ErrorType::ERROR_NONE;
 }
 
+std::string CopyRequestHandler::GetRequestHandlerType() {
+  return kCopyReqHandlerType;
+}
+
 }  // namespace rsc_handler
index eeb0088ab7e14230e6a8e82e2719173dc0d3590f..ca16f304487ebf18550c45c55ac64d6e1342ff6c 100644 (file)
 #include "include/remove_request_handler.hh"
 
 #include <iostream>
+#include <string>
 
+#include "include/abstract_request_handler.hh"
 #include "include/error_type.hh"
 #include "include/rsc_path_info.hh"
 
+namespace {
+
+constexpr char kRemoveReqHandlerType[] = "remove";
+
+}  // namespace
+
 namespace rsc_handler {
 
+RemoveRequestHandler::RemoveRequestHandler(
+    std::string pkgid, std::list<RscPathInfo> path_list) :
+  AbstractRequestHandler(pkgid, path_list) {}
+
 ErrorType RemoveRequestHandler::Execute() {
   std::cout << "RemoveRequestHandler::Execute" << std::endl;
 
   return ErrorType::ERROR_NONE;
 }
 
+std::string RemoveRequestHandler::GetRequestHandlerType() {
+  return kRemoveReqHandlerType;
+}
+
 }  // namespace rsc_handler
index 1d8439643b5f0e0bfec8cc5471679c6a51119581..5d93d81da484338cef086275d20aaac923ac94d7 100644 (file)
 #include "include/uninstall_request_handler.hh"
 
 #include <iostream>
+#include <string>
 
+#include "include/abstract_request_handler.hh"
 #include "include/error_type.hh"
 #include "include/rsc_path_info.hh"
 
+namespace {
+
+constexpr char kUninstallReqHandlerType[] = "delete";
+
+}  // namespace
+
 namespace rsc_handler {
 
+UninstallRequestHandler::UninstallRequestHandler(
+    std::string pkgid, std::list<RscPathInfo> path_list) :
+  AbstractRequestHandler(pkgid, path_list) {}
+
 ErrorType UninstallRequestHandler::Execute() {
   std::cout << "UninstallRequestHandler::Execute" << std::endl;
 
   return ErrorType::ERROR_NONE;
 }
 
+std::string UninstallRequestHandler::GetRequestHandlerType() {
+  return kUninstallReqHandlerType;
+}
 
 }  // namespace rsc_handler