042c5574dfdb65a2cf4ee21bb1c8e99b0ed7f4b6
[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 }}}
37
38 /**
39  * @class               InstallerUtil
40  * @brief               This class represents the class of InstallerUtil.
41  * @since               1.0
42  *
43  * This class represents the class of InstallerUtil.
44  *
45  */
46 class InstallerUtil
47 {
48 public:
49         InstallerUtil(void);
50         virtual ~InstallerUtil(void);
51
52         static bool Remove(const Tizen::Base::String& filePath);
53         static bool Copy(const Tizen::Base::String& srcFilePath, const Tizen::Base::String& destFilePath);
54         static bool CopyDirectory(const Tizen::Base::String& srcFilePath, const Tizen::Base::String& destFilePath);
55         static bool IsSymlink(const Tizen::Base::String& filePath);
56         static bool GetRealPath(const Tizen::Base::String& filePath, Tizen::Base::String& realPath);
57
58         static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath);
59         static bool ChangeMode(const Tizen::Base::String& filePath, int mode);
60         static bool     ChangeOwner(const Tizen::Base::String& filePath);
61         static bool     ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode, bool appOwner);
62
63         static bool IsDrmFile(const Tizen::Base::String& path);
64         static bool DecryptPackage(const Tizen::Base::String& packagePath);
65
66         static Tizen::Base::String GetCategory(int categoryType);
67         static int GetCategoryType(char* pCategory);
68
69         static bool CreateSymlinkForAppDirectory(const Tizen::Base::String& inPath, Tizen::Base::String& outPath);
70         static bool CreateInfoFile(const Tizen::Base::String& filePath, const Tizen::Base::String* pContext);
71
72         static bool DumpLog(const char* pBuf);
73         static bool DumpLogData(char *pData, int dataLen);
74
75         static bool CreateLog(const Tizen::Base::String& logFile);
76         static bool AppendLog(const char* pFunction, int lineNumber, bool fatal, const char* pFormat, ...);
77         static bool PrintLog(const Tizen::Base::String& logFile);
78         static bool GetRdsList(const Tizen::App::PackageId& packageId,
79                         Tizen::Base::Collection::IList* pDeletedList,
80                         Tizen::Base::Collection::IList* pAddedList,
81                         Tizen::Base::Collection::IList* pModifiedList);
82
83         static const char* GetInstallerOperationString(int operation);
84
85 private:
86         static char LogChangeHexToStr(int hex);
87         InstallerUtil(const InstallerUtil& value);
88         InstallerUtil& operator =(const InstallerUtil& source);
89
90 private:
91
92 }; // InstallerUtil
93
94 #endif // _INSTALLER_UTIL_H_