Fix metadata plugin
[platform/core/appfw/app-installers.git] / src / common / plugins / metadata_plugin.h
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMMON_PLUGINS_METADATA_PLUGIN_H_
6 #define COMMON_PLUGINS_METADATA_PLUGIN_H_
7
8 #include <memory>
9 #include <set>
10 #include <string>
11 #include <utility>
12
13 #include "common/plugins/plugin.h"
14
15 namespace common_installer {
16
17 class MetadataPlugin : public Plugin {
18  public:
19   static const char kType[];
20
21   static std::unique_ptr<MetadataPlugin> Create(const PluginInfo& plugin_info);
22   bool Run(xmlDocPtr doc_ptr, manifest_x* manifest,
23            ActionType action_type) override;
24
25  private:
26   using PkgAppPair = std::pair<std::string, std::string>;
27   bool LoadPluginInfo(manifest_x* manifest);
28   bool ExecutePlugin(const std::string& name, const char* pkgid,
29       const char* appid, GList* md_list);
30   bool AddPluginInfo(manifest_x* manifest, const char* appid);
31   std::string GetFunctionName(ActionType action) const;
32
33   std::set<PkgAppPair> pkg_app_set_;
34
35   using Plugin::Plugin;
36
37   SCOPE_LOG_TAG(MetadataPlugin)
38 };
39
40 }  // namespace common_installer
41
42 #endif  // COMMON_PLUGINS_METADATA_PLUGIN_H_