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.
5 #ifndef COMMON_STEP_CONFIGURATION_STEP_PARSE_MANIFEST_H_
6 #define COMMON_STEP_CONFIGURATION_STEP_PARSE_MANIFEST_H_
8 #include <boost/filesystem.hpp>
10 #include <common/app_installer.h>
11 #include <common/installer_context.h>
12 #include <common/step/step.h>
14 #include <manifest_parser/utils/logging.h>
15 #include <tpk_manifest_handlers/privileges_handler.h>
16 #include <tpk_manifest_handlers/tpk_config_parser.h>
17 #include <tpk_manifest_handlers/ui_and_service_application_infos.h>
23 namespace common_installer {
24 namespace configuration {
27 * @brief The StepParseManifest class
28 * Used to parse tpk manifest file and store information to context
30 * This step is parameterized according to:
31 * - where to look for manifest file
32 * - where to store information from manifest in context structure
34 * Different request mode will choose different ManifestLocation and
35 * StoreLocation for its purpose but main goal of this step parsing tpk
36 * manifest doesn't change.
38 class StepParseManifest : public common_installer::Step {
40 enum class ManifestLocation {
41 PACKAGE, // parse manifest file from unpacking diretory
42 INSTALLED, // parse manfiest file from current package installation
43 RECOVERY // parse manifest file from backup location or package location
46 enum class StoreLocation {
47 NORMAL, // store in context as current application information (new)
48 BACKUP // store in context as old version application information (update)
51 explicit StepParseManifest(common_installer::InstallerContext* context,
52 ManifestLocation manifest_location, StoreLocation store_location);
54 Status process() override;
55 Status clean() override { return Status::OK; }
56 Status undo() override { return Status::OK; }
57 Status precheck() override;
60 bool LocateConfigFile();
61 boost::filesystem::path path_;
64 bool FillInstallationInfo(manifest_x* manifest);
65 bool FillPackageInfo(manifest_x* manifest);
66 bool FillAuthorInfo(manifest_x* manifest);
67 bool FillDescriptionInfo(manifest_x* manifest);
68 bool FillPrivileges(manifest_x* manifest);
69 bool FillWidgetApplication(manifest_x* manifest);
70 bool FillServiceApplication(manifest_x* manifest);
71 bool FillUIApplication(manifest_x* manifest);
72 bool FillWatchApplication(manifest_x* manifest);
77 bool FillAppControl(application_x* manifest, const T& app_control_list);
79 bool FillDataControl(application_x* manifest, const T& data_control_list);
81 bool FillApplicationIconPaths(application_x* manifest,
84 bool FillLabel(application_x* manifest, const T& label_list);
86 bool FillMetadata(application_x* manifest, const T& meta_data_list);
87 // FIXME: For hotfix, must be removed
89 bool FillSupportSize(application_x* manifest, const T& support_size_list);
91 bool FillCategories(application_x* manifest, const T& meta_data_list);
92 bool FillImage(application_x* app,
93 const tpk::parse::ApplicationImagesInfo& label_list);
95 bool FillBackgroundCategoryInfo(application_x* app,
96 const T& background_category_data_list);
98 bool FillSplashScreen(application_x* app,
99 const T& splashscreen_list);
100 bool FillManifestX(manifest_x* manifest);
102 std::unique_ptr<tpk::parse::TPKConfigParser> parser_;
103 ManifestLocation manifest_location_;
104 StoreLocation store_location_;
106 STEP_NAME(ParseManifest)
109 } // namespace configuration
110 } // namespace common_installer
112 #endif // COMMON_STEP_CONFIGURATION_STEP_PARSE_MANIFEST_H_