Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / plugins / plugin_manager.h
index 36c0fb6..f5b0e84 100644 (file)
@@ -5,12 +5,15 @@
 #ifndef COMMON_PLUGINS_PLUGIN_MANAGER_H_
 #define COMMON_PLUGINS_PLUGIN_MANAGER_H_
 
-#include <boost/filesystem/path.hpp>
+#include <pkgmgrinfo_basic.h>
 
+#include <filesystem>
+#include <memory>
 #include <string>
 #include <vector>
 
-#include "common/plugins/plugins_launcher.h"
+#include "common/utils/pkgmgr_query.h"
+#include "common/plugins/plugin.h"
 #include "common/plugins/plugin_list_parser.h"
 #include "common/plugins/plugin_xml_parser.h"
 
@@ -19,33 +22,36 @@ namespace common_installer {
 /** this class manages XML and plugin lists */
 class PluginManager {
  public:
-  using TagList = std::vector<std::shared_ptr<PluginInfo>>;
-  PluginManager(const std::string& xml_path, const std::string& list_path)
-      : xml_parser_(xml_path), list_parser_(list_path) {}
-
-  bool GenerateUnknownTagList();
-  const TagList& UnknownTagList();
-  bool Launch(const boost::filesystem::path& pluginPath,
-              const std::string& tag_name,
-              PluginsLauncher::ActionType actionType, const std::string& pkgId);
+  using PluginInfoList = std::vector<std::shared_ptr<PluginInfo>>;
+
+  PluginManager(const std::filesystem::path& xml_path,
+                const std::filesystem::path& list_path,
+                const std::string& pkgid,
+                manifest_x* manifest,
+                uid_t uid)
+      : xml_parser_(xml_path),
+        list_parser_(list_path),
+        pkgid_(pkgid),
+        manifest_(manifest),
+        uid_(uid) {}
+
+  bool LoadPlugins(Plugin::ActionType action_type);
+  bool RunPlugins(Plugin::ActionType action_type);
 
  private:
-  /**
-   * @brief CreateDocPtrForPlugin
-   *        Create copy of xml document with nodes only matching requested
-   *        tag_name
-   * @param doc_ptr original doc ptr of document
-   * @param tag_name name of required node/nodes
-   * @return requested copy
-   */
-  xmlDocPtr CreateDocPtrForPlugin(xmlDocPtr doc_ptr,
-                                  const std::string& tag_name) const;
-
-  std::vector<std::shared_ptr<PluginInfo>> tags_;
+  bool IsDataRemoved(const char* data_type,
+                     const std::string& data);
+  bool GenerateUnknownTagList(std::vector<std::string>* xml_tags);
+  bool GeneratePluginInfoList(PluginInfoList* plugin_info_list);
+
   PluginsXmlParser xml_parser_;
   PluginsListParser list_parser_;
-  PluginsLauncher plugins_launcher_;
+  std::string pkgid_;
+  manifest_x* manifest_;
+  uid_t uid_;
+  std::vector<std::unique_ptr<Plugin>> loaded_plugins_;
 };
+
 }  // namespace common_installer
 
 #endif  // COMMON_PLUGINS_PLUGIN_MANAGER_H_