Add a plugin for app-defined loader
[platform/core/appfw/launchpad.git] / parser / launchpad_parser_plugin_pkgmgr_interface.cc
1 /*
2  * Copyright (c) 2019 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 <libxml/tree.h>
18
19 #include "launchpad_parser_plugin.hh"
20 #include "log_private.hh"
21 #include "common.hh"
22
23 using namespace launchpad_parser_plugin;
24
25 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char *package)
26 {
27   LaunchpadParser parser;
28   LOGI("install");
29   return parser.Install(doc, package);
30 }
31
32 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc, const char *package)
33 {
34   LOGI("uninstall");
35   LaunchpadParser parser;
36   return parser.UnInstall(doc, package);
37 }
38
39 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, const char *package)
40 {
41   LOGI("upgrade");
42   LaunchpadParser parser;
43   return parser.Upgrade(doc, package);
44 }
45
46 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERINSTALL(xmlDocPtr doc,
47     const char *package)
48 {
49   LOGW("recover install");
50   LaunchpadParser parser;
51   return parser.UnInstall(doc, package);
52 }
53
54 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERUNINSTALL(xmlDocPtr doc,
55     const char *package)
56 {
57   LOGW("recover uninstall");
58   LaunchpadParser parser;
59   return parser.UnInstall(doc, package);
60 }
61
62 extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERUPGRADE(xmlDocPtr doc,
63     const char *package)
64 {
65   LOGW("recover upgrade");
66   LaunchpadParser parser;
67   return parser.Upgrade(doc, package);
68 }