Fix Metadata Plugin Parser
[platform/core/appfw/aul-1.git] / parser / metadata / alias-appid / pkgmgr_interface.cc
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <glib.h>
18
19 #include "common/log_private.hh"
20 #include "alias-appid/plugin_manager.hh"
21
22 #undef API
23 #define API __attribute__ ((visibility("default")))
24
25 using namespace plugin;
26
27 extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
28     const char* appid, GList* list)
29 {
30   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
31   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
32       EventType::Install, list);
33   PluginManager::GetInst().Do();
34   return 0;
35 }
36
37 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
38     const char* appid, GList* list)
39 {
40   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
41   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
42       EventType::Uninstall, list);
43   PluginManager::GetInst().Do();
44   return 0;
45 }
46
47 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
48     const char* appid, GList* list)
49 {
50   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
51   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
52       EventType::Upgrade, list);
53   PluginManager::GetInst().Do();
54   return 0;
55 }
56
57 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
58     const char* appid, GList* list)
59 {
60   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
61   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
62       EventType::Uninstall, list);
63   PluginManager::GetInst().Do();
64   return 0;
65 }
66
67 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
68     const char* appid, GList* list)
69 {
70   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
71   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
72       EventType::Uninstall, list);
73   PluginManager::GetInst().Do();
74   return 0;
75 }
76
77 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
78     const char* appid, GList* list)
79 {
80   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
81   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
82       EventType::Upgrade, list);
83   PluginManager::GetInst().Do();
84   return 0;
85 }
86
87 extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
88     const char* appid, GList* list)
89 {
90   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
91   PluginManager::GetInst().Clean();
92   return 0;
93 }
94
95 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
96     const char* appid, GList* list)
97 {
98   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
99   PluginManager::GetInst().Undo();
100   return 0;
101 }
102
103 extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
104     const char* appid, GList* list)
105 {
106   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
107   return 0;
108 }