3315496b0927091012f047361e81672774617b8b
[framework/osp/installer.git] / src / Context / InstallationContext.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        InstallerContext.h
19  * @brief       This is the header file for the %InstallerContext class.
20  *
21  * This header file contains the declarations of the %InstallerContext class.
22  */
23 #ifndef _INSTALLATION_CONTEXT_H_
24 #define _INSTALLATION_CONTEXT_H_
25
26 #include <app2ext_interface.h>
27
28 #include <FAppPackageInfo.h>
29 #include <FSecCertX509CertificatePath.h>
30
31 #include "InstallerDefs.h"
32 #include "IInstallationStep.h"
33 #include "DrmLicense.h"
34
35 class IInstallationStep;
36
37 /**
38  * @class               InstallationContext
39  * @brief               This class represents the class of InstallationContext.
40  * @since               1.0
41  *
42  * This class represents the class of InstallationContext.
43  *
44  */
45 class InstallationContext
46 {
47 public:
48         enum InstallationStorage
49         {
50                 INSTALLATION_STORAGE_INTERNAL,
51                 INSTALLATION_STORAGE_EXTERNAL,
52         };
53
54         InstallationContext(void);
55         virtual ~InstallationContext(void);
56         InstallerError Construct(void);
57
58         bool ChangeStep(InstallationStep step);
59         InstallerError Run(void);
60
61         InstallationStep GetCurrentInstallationStep(void);
62         void SetCurrentInstallationStep(InstallationStep step);
63
64         InstallerError GetError(void);
65         void SetError(InstallerError installerError);
66
67         InstallationState GetState(void);
68         void SetState(InstallationState installationState);
69
70         IInstallationStep* GetStep(void);
71
72         void SetInputPath(const Osp::Base::String& path);
73         const Osp::Base::String& GetInputPath(void) const;
74
75         void SetInstallerOperation(InstallerOperation op);
76         InstallerOperation GetInstallerOperation(void) const;
77
78         void SetInstallationStorage(InstallationStorage storage);
79         InstallationStorage GetInstallationStorage(void) const;
80
81         bool IsContinue(void);
82         void SetContinue(bool cont);
83
84         bool IsPreloaded(void);
85         void SetPreloaded(bool preloaded);
86
87         bool IsHybridService(void);
88         void SetHybridService(bool hybridService);
89
90         const Osp::Base::String& GetPackagePath(void) const;
91         void SetPackagePath(const Osp::Base::String& packagePath);
92
93         const Osp::Base::String& GetLicensePath(void) const;
94         void SetLicensePath(const Osp::Base::String& licensePath);
95
96         const Osp::Base::String& GetTemporaryDir(void) const;
97         void SetTemporaryDir(const Osp::Base::String& temporaryDir);
98
99         const Osp::Base::String& GetInstallDir(void) const;
100         void SetInstallDir(const Osp::Base::String& installDir);
101
102         const Osp::Base::String& GetWorkingDir(void) const;
103         void SetWorkingDir(const Osp::Base::String& workingDir);
104
105         const Osp::Base::String& GetAppId(void) const;
106         void SetAppId(const Osp::Base::String& appId);
107
108         const Osp::Base::String& GetAppVersion(void) const;
109         void SetAppVersion(const Osp::Base::String& appVersion);
110
111         Osp::Base::String GetManifestXmlPath(void);
112         Osp::Base::String GetSignatureXmlPath(void);
113         Osp::Base::String GetAuthorSignatureXmlPath(void);
114
115         const Osp::Base::Collection::ArrayList* GetPrivilegeList(void) const;
116         void SetPrivilegeList(Osp::Base::Collection::ArrayList* privilegeList);
117
118         Osp::Base::Collection::ArrayList* GetLiveBoxList(void) const;
119         void SetLiveBoxList(Osp::Base::Collection::ArrayList* pLiveBoxList);
120
121         Osp::Base::Collection::ArrayList* GetContentInfoList(void) const;
122         void SetContentInfoList(Osp::Base::Collection::ArrayList* pContentInfoList);
123
124         Osp::Security::Cert::X509CertificatePath* GetAuthorCertPath(void) const;
125         void SetAuthorCertPath(Osp::Security::Cert::X509CertificatePath* pAuthorCertPath);
126
127         Osp::Security::Cert::X509CertificatePath* GetDistributorCertPath(void) const;
128         void SetDistributorCertPath(Osp::Security::Cert::X509CertificatePath* pDistributorCertPath);
129
130         RootCertificateType GetRootCertType(void) const;
131         void SetRootCertType(RootCertificateType certType);
132
133         int GetPackageNameType(void) const;
134         void SetPackageNameType(int type);
135
136         app2ext_handle* GetApp2ExtHandle(void) const;
137         void SetApp2ExtHandle(app2ext_handle* pHandle);
138
139         Osp::App::_PackageInfoImpl* GetPackageInfoImpl(void) const;
140
141 private:
142         InstallationContext(const InstallationContext& value);
143         InstallationContext& operator =(const InstallationContext& source);
144
145         IInstallationStep* __pStep;
146         DrmLicense* __pDrmLicense;
147         InstallerError __error;
148         InstallationStep __step;
149         int __attributeType;
150         InstallationState __state;
151         bool __stepChanged;
152         bool __continue;
153         bool __preloaded;
154         bool __hybridService;
155
156         Osp::Base::String __inputPath;
157         InstallerOperation __operation;
158         InstallationStorage __storage;
159
160         Osp::Base::String __packagePath;
161         Osp::Base::String __licensePath;
162         Osp::Base::String __temporaryDir;
163         Osp::Base::String __installDir;
164         Osp::Base::String __workingDir;
165         Osp::Base::String __appId;
166         Osp::Base::String __appVersion;
167         Osp::Base::String __appRootPath;
168
169         Osp::Base::Collection::ArrayList* __pPrivilegeList;
170         Osp::Base::Collection::ArrayList* __pLiveBoxList;
171         Osp::Base::Collection::ArrayList* __pContentInfoList;
172         Osp::Security::Cert::X509CertificatePath* __pAuthorCertPath;
173         Osp::Security::Cert::X509CertificatePath* __pDistributorCertPath;
174         RootCertificateType __rootCertType;
175
176         int __packageNameType;
177         app2ext_handle* __pApp2ExtHandle;
178
179         Osp::App::_PackageInfoImpl* __pPackageInfoImpl;
180
181 }; // InstallationContext
182
183 class LiveboxInfo
184         : public Osp::Base::Object
185 {
186 public:
187         LiveboxInfo(void);
188         virtual ~LiveboxInfo(void);
189
190         result SetUpdatePeriod(long long period);
191         long long GetUpdatePeriod(void) const;
192
193         result SetPopupEnabled(const Osp::Base::String& value);
194         const Osp::Base::String& GetPopupEnabled(void) const;
195
196         result SetIcon(const Osp::Base::String& icon);
197         const Osp::Base::String& GetIcon(void) const;
198
199         result AddName(const Osp::Base::String& language, const Osp::Base::String& name);
200         Osp::Base::Collection::HashMap* GetNameList(void) const;
201
202         result AddSize(const Osp::Base::String& size);
203         Osp::Base::Collection::ArrayList* GetSizeList(void) const;
204
205 private:
206         LiveboxInfo(const LiveboxInfo& value);
207         LiveboxInfo& operator =(const LiveboxInfo& source);
208
209         long long __updatePeriod;
210         Osp::Base::String __popupEnabled;
211         Osp::Base::String __icon;
212
213         Osp::Base::Collection::HashMap* __pNameList;
214         Osp::Base::Collection::ArrayList* __pSizeList;
215
216 }; // LiveboxInfo
217
218 class ContentInfo
219         : public Osp::Base::Object
220 {
221 public:
222         ContentInfo(void);
223         virtual ~ContentInfo(void);
224
225         result SetContentId(const Osp::Base::String& contentId);
226         const Osp::Base::String& GetContentId(void) const;
227
228         result SetIcon(const Osp::Base::String& icon);
229         const Osp::Base::String& GetIcon(void) const;
230
231         result AddName(const Osp::Base::String& language, const Osp::Base::String& name);
232         Osp::Base::Collection::HashMap* GetNameList(void) const;
233
234 private:
235         ContentInfo(const ContentInfo& value);
236         ContentInfo& operator =(const ContentInfo& source);
237
238         Osp::Base::String __icon;
239         Osp::Base::String __contentId;
240
241         Osp::Base::Collection::HashMap* __pNameList;
242
243 }; // ContentInfo
244
245 #endif // _INSTALLATION_CONTEXT_H_