929321069e4435de28a0ad324792c4863c87701e
[platform/framework/native/installer.git] / src / Util / InstallerUtil.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 InstallerUtil.h
19  * @brief       This is the header file for the %InstallerUtil class.
20  *
21  * This header file contains the declarations of the %InstallerUtil class.
22  */
23 #ifndef _INSTALLER_UTIL_H_
24 #define _INSTALLER_UTIL_H_
25
26 #include <FAppTypes.h>
27
28 namespace Tizen { namespace Base
29 {
30 class String;
31 }}
32
33 namespace Tizen { namespace Base { namespace Collection
34 {
35 class IList;
36 class IMap;
37 }}}
38
39 /**
40  * @class               InstallerUtil
41  * @brief               This class represents the class of InstallerUtil.
42  * @since               1.0
43  *
44  * This class represents the class of InstallerUtil.
45  *
46  */
47 class InstallerUtil
48 {
49 public:
50         InstallerUtil(void);
51         virtual ~InstallerUtil(void);
52
53         static bool Remove(const Tizen::Base::String& filePath);
54         static bool Copy(const Tizen::Base::String& srcFilePath, const Tizen::Base::String& destFilePath);
55         static bool CopyDirectory(const Tizen::Base::String& srcFilePath, const Tizen::Base::String& destFilePath);
56         static bool IsSymlink(const Tizen::Base::String& filePath);
57         static bool GetRealPath(const Tizen::Base::String& filePath, Tizen::Base::String& realPath);
58
59         static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath, bool SmackLabelToRealPath = true);
60         static bool ChangeMode(const Tizen::Base::String& filePath, int mode);
61         static bool     ChangeOwner(const Tizen::Base::String& filePath);
62         static bool     ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode, bool appOwner);
63
64         static bool IsDrmFile(const Tizen::Base::String& path);
65         static bool DecryptPackage(const Tizen::Base::String& path, const Tizen::Base::String& decryptedPath);
66
67         static Tizen::Base::String GetCategory(int categoryType);
68         static int GetCategoryType(char* pCategory);
69
70         static bool CreateSymlinkForAppDirectory(const Tizen::Base::String& inPath, Tizen::Base::String& outPath);
71         static bool CreateInfoFile(const Tizen::Base::String& filePath, const Tizen::Base::String* pContext);
72
73         static bool DumpLog(const char* pBuf);
74         static bool DumpLogData(char *pData, int dataLen);
75
76         static bool CreateLog(const Tizen::Base::String& logFile);
77         static bool AppendLog(const char* pFunction, int lineNumber, bool fatal, const char* pFormat, ...);
78         static bool PrintLog(const Tizen::Base::String& logFile);
79         static bool GetRdsList(const Tizen::App::PackageId& packageId,
80                         Tizen::Base::Collection::IList* pDeletedList,
81                         Tizen::Base::Collection::IList* pAddedList,
82                         Tizen::Base::Collection::IList* pModifiedList);
83
84         static const char* GetInstallerOperationString(int operation);
85         static bool GetFileDigest(const Tizen::Base::String& filePath, Tizen::Base::String& digestValue);
86
87         static Tizen::Base::Collection::IMap* ParseN(const Tizen::Base::String& str, const Tizen::Base::String& tokenDelimiter);
88
89         static bool TerminateApp(const Tizen::App::AppId& appId);
90         static bool TerminateApps(const Tizen::App::PackageId& packageId);
91
92         static bool IsUninstallable(const Tizen::App::PackageId& packageId);
93         static bool IsCscPackage(const Tizen::App::PackageId& packageId, Tizen::Base::String& cscInfo);
94
95         static bool IsDefaultExternalStorage();
96         static bool IsSignatureVerificationEnabled();
97
98 private:
99         static char LogChangeHexToStr(int hex);
100         InstallerUtil(const InstallerUtil& value);
101         InstallerUtil& operator =(const InstallerUtil& source);
102
103 private:
104
105 }; // InstallerUtil
106
107 #endif // _INSTALLER_UTIL_H_