[Release] wrt-installer_0.1.121
[platform/framework/web/wrt-installer.git] / src / jobs / widget_install / task_configuration.h
1 /*
2  * Copyright (c) 2013 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  * @file    task_configuration.h
18  * @version 1.0
19  * @author  Tomasz Iwanek
20  * @brief   header file for configuration task
21  */
22 #ifndef TASK_CONFIGURATION_H
23 #define TASK_CONFIGURATION_H
24
25 #include <dpl/task_list.h>
26 #include <dpl/wrt-dao-ro/config_parser_data.h>
27
28 #include <widget_install/widget_update_info.h>
29 #include <widget_install/widget_install_context.h>
30
31 class InstallerContext;
32
33 namespace Jobs {
34 namespace WidgetInstall {
35
36 class TaskConfiguration : public DPL::TaskDecl<TaskConfiguration>
37 {
38     InstallerContext& m_context;
39     ConfigureResult m_result;
40     WidgetUpdateInfo m_widgetUpdateInfo;
41
42     ConfigureResult ConfigureInstallation(const std::string &widgetSource,
43                                           const WrtDB::ConfigParserData
44                                           &configData,
45                                           const std::string &tempPath);
46     static WrtDB::ConfigParserData getWidgetDataFromXML(
47         const std::string &widgetSource,
48         const std::string &tempPath,
49         WrtDB::PackagingType pkgType,
50         bool isReinstall);
51     static WidgetUpdateInfo detectWidgetUpdate(
52         const WrtDB::ConfigParserData &configInfo,
53         const WrtDB::TizenAppId &tizenId);
54     void setTizenId(const WrtDB::ConfigParserData &configInfo);
55     void configureWidgetLocation(const std::string & widgetPath,
56                                  const std::string &tempPath);
57
58     WrtDB::PackagingType checkPackageType(
59         const std::string &widgetSource,
60         const std::string &tempPath);
61     bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
62     void setInstallLocationType(const WrtDB::ConfigParserData
63                                 &configData);
64
65     bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
66     bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
67     ConfigureResult checkWidgetUpdate(const WidgetUpdateInfo &update);
68     void setApplicationType(const WrtDB::ConfigParserData &configInfo);
69     bool checkSupportRDSUpdate(const WrtDB::ConfigParserData &configInfo);
70
71     void PrepareInstallationStep();
72     void AppendTasklistStep();
73
74     void StartStep();
75     void EndStep();
76
77 public:
78     TaskConfiguration(InstallerContext& context);
79 };
80
81 }
82 }
83
84 #endif // TASK_CONFIGURATION_H