tizen 2.4 release
[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 <string>
26
27 #include <dpl/platform.h>
28 #include <dpl/task.h>
29 #include <dpl/wrt-dao-ro/config_parser_data.h>
30 #include <widget_install/widget_install_context.h>
31 #include <dpl/wrt-dao-ro/common_dao_types.h>
32 #include <pkg-manager/pkgmgr_signal.h>
33 #include <widget_install/job_widget_install.h>
34
35 class InstallerContext;
36
37 namespace Jobs {
38 namespace WidgetInstall {
39
40 const std::string WRT_CORE_SPEC_2_4_FEATURE = "2.4";
41 const std::string WRT_CORE_SPEC_2_3_1_FEATURE = "2.3.1";
42
43 static bool parseVersionString(const std::string &version, long &majorVer, long &minorVer, long &microVer);
44 static bool isAcceptableVersion(const std::string &ver1, const std::string &ver2);
45
46 class TaskConfiguration : public DPL::TaskDecl<TaskConfiguration>
47 {
48     JobWidgetInstall* m_jobContext;
49     std::string m_tempDir;
50     WrtDB::ConfigParserData &m_widgetConfig;
51     std::string m_configuration;
52
53     void parseWidgetXMLConfig(
54         const std::string &widgetSource,
55         const std::string &tempPath,
56         WrtDB::PackagingType pkgType,
57         bool isReinstall);
58
59     bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
60     bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
61     void ApplicationTypeStep(const WrtDB::ConfigParserData &configInfo);
62     bool checkSupportRDSUpdateIfReinstall(const WrtDB::ConfigParserData &configInfo);
63     bool getDefaultExternalStorage();
64     bool getMMCStatus();
65
66     std::shared_ptr<PackageManager::IPkgmgrSignal> pkgMgrInterface();
67
68     //steps
69     void StartStep();
70
71     void SetupTempDirStep();
72     void UnzipConfigurationStep();
73     void ParseXMLConfigStep();
74     void FeatureVersionCheckStep();
75     void TizenIdStep();
76     void DetectUpdateInstallationStep();
77     void PkgmgrStartStep();
78
79     void ApplicationTypeStep();
80     void ResourceEncryptionStep();
81 #if ENABLE(PRE_LAUNCH)
82     void PreLaunchingWebappStep();
83 #endif
84     void InstallationFSLocationStep();
85
86     void ConfigureWidgetLocationStep();
87     void CheckRDSSupportStep();
88
89     void AppendTasklistStep();
90     void EndStep();
91
92 public:
93     TaskConfiguration(JobWidgetInstall * const &jobContext);
94 };
95
96 }
97 }
98
99 #endif // TASK_CONFIGURATION_H