|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: writeablejavaregistry definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WRITEABLEJAVAREGISTRY_H |
|
20 #define WRITEABLEJAVAREGISTRY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "javaregistryentrytype.h" |
|
25 #include "javastorage.h" |
|
26 |
|
27 namespace Java |
|
28 { |
|
29 namespace Manager |
|
30 { |
|
31 namespace Registry |
|
32 { |
|
33 |
|
34 // FORWARD DECLARATION |
|
35 class CWriteableJavaRegistryEntry; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 /** |
|
39 * This class provides the Internal API for JavaRegistry. |
|
40 * It allows for trusted clients to retrieve and set properties of |
|
41 * Java install packages, applications, services etc. |
|
42 * |
|
43 * @lib javaregistryclient.lib |
|
44 * @since S60 v3.2 |
|
45 */ |
|
46 class CWriteableJavaRegistry : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 // constructors |
|
51 /** |
|
52 * CWriteableJavaRegistry::NewL method creates a |
|
53 * CWriteableJavaRegistry object. |
|
54 * The function may leave with one of the system-wide error codes. |
|
55 * |
|
56 * @since S60 v3.2 |
|
57 * @param aUseIntegrity ETrue if Integrity Server must be used during |
|
58 * the lifetime of this object, EFalse if it's |
|
59 * not required. |
|
60 * @return A pointer to a CWriteableJavaRegistry object. Caller takes |
|
61 * over the ownership of the object being transferred. |
|
62 */ |
|
63 IMPORT_C static CWriteableJavaRegistry* NewL(TBool aUseIntegrity); |
|
64 |
|
65 /** |
|
66 * CWriteableJavaRegistry::NewLC method creates a |
|
67 * CWriteableJavaRegistry object. |
|
68 * The function may leave with one of the system-wide error codes. |
|
69 * |
|
70 * @since S60 v3.2 |
|
71 * @param aUseIntegrity ETrue if Integrity Server must be used during |
|
72 * the lifetime of this object, EFalse if it's |
|
73 * not required. |
|
74 * @return A pointer to a CWriteableJavaRegistry object. Caller takes |
|
75 * over the ownership of the object being transferred. |
|
76 */ |
|
77 IMPORT_C static CWriteableJavaRegistry* NewLC(TBool aUseIntegrity); |
|
78 |
|
79 // destructor |
|
80 /** |
|
81 * CWriteableJavaRegistry::~CWriteableJavaRegistry destructor |
|
82 * |
|
83 * @since S60 v3.2 |
|
84 */ |
|
85 IMPORT_C ~CWriteableJavaRegistry(); |
|
86 |
|
87 // general methods |
|
88 |
|
89 /** |
|
90 * CWriteableJavaRegistry::RegistryEntryExistsL method returns whether |
|
91 * registry entry with the specified Uid exists. |
|
92 * The function may leave with one of the system-wide error codes. |
|
93 * |
|
94 * @since S60 v3.2 |
|
95 * @param aUid The Uid to be checked. |
|
96 * @return ETrue if the registry entry exists, EFalse otherwise. |
|
97 */ |
|
98 IMPORT_C TBool RegistryEntryExistsL(const TUid& aUid) const; |
|
99 |
|
100 |
|
101 /** |
|
102 * CWriteableJavaRegistry::GetRegistryEntryUidsL method returns |
|
103 * an array of Uids of the registry entries, that are installed to |
|
104 * the phone, or to the mmc drive currently plugged in. |
|
105 * The function may leave with one of the system-wide error codes. |
|
106 * |
|
107 * @since S60 v3.2 |
|
108 * @param aUids [out] Uids of the registry entries. |
|
109 */ |
|
110 IMPORT_C void GetRegistryEntryUidsL(RArray<TUid>& aUids) const; |
|
111 |
|
112 |
|
113 /** |
|
114 * CWriteableJavaRegistry::GetRegistryEntryUidsL method returns |
|
115 * an array of Uids of the registry entries, that are installed to |
|
116 * the phone, or to the mmc drive currently plugged in. |
|
117 * Entries are searched by the specified type. |
|
118 * The function may leave with one of the system-wide error codes. |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 * @param aType Type of registry entries whose Uids are to be returned. |
|
122 * @param aUids [out] Uids of the matching registry entries. |
|
123 */ |
|
124 IMPORT_C void GetRegistryEntryUidsL(TJavaRegistryEntryType aType, |
|
125 RArray<TUid>& aUids, |
|
126 TBool aAllEntries = EFalse) const; |
|
127 |
|
128 /** |
|
129 * CWriteableJavaRegistry::RegistryEntryL method returns the |
|
130 * corresponding registry entry for a given Uid. |
|
131 * The returned entry can be casted to the appropriate subclass |
|
132 * according to the type property. If type is in the package range |
|
133 * (EGeneralPackage <= entryType < EGeneralApplication), it can |
|
134 * be casted to CWriteableJavaRegistryPackageEntry, and if type is |
|
135 * in the application range (EGeneralApplication <= entryType), |
|
136 * it can be casted to CWriteableJavaRegistryApplicationEntry. |
|
137 * The function may leave with one of the system-wide error codes. |
|
138 * |
|
139 * @since S60 v3.2 |
|
140 * @param aUid The Uid of the entry to be retrieved. |
|
141 * @return The returned registry entry or null if registry entry not |
|
142 * found. Caller takes over the ownership of the object being |
|
143 * transferred. |
|
144 */ |
|
145 IMPORT_C CWriteableJavaRegistryEntry* RegistryEntryL( |
|
146 const TUid& aUid, |
|
147 TBool aAllEntries = EFalse) const; |
|
148 |
|
149 protected: |
|
150 |
|
151 // constructor |
|
152 /** |
|
153 * CWriteableJavaRegistry::CWriteableJavaRegistry constructor |
|
154 * |
|
155 * @since S60 v3.2 |
|
156 */ |
|
157 IMPORT_C CWriteableJavaRegistry(); |
|
158 |
|
159 // 2nd phase constructors |
|
160 /** |
|
161 * CWriteableJavaRegistry::ConstructL method |
|
162 * The function may leave with one of the system-wide error codes. |
|
163 * |
|
164 * @since S60 v3.2 |
|
165 * @param aUseIntegrity ETrue if Integrity Server must be used during |
|
166 * the lifetime of this object, EFalse if it's |
|
167 * not required. |
|
168 * @param aLegacy Indicates, that the registry is used in legacy |
|
169 * mode. |
|
170 */ |
|
171 IMPORT_C void ConstructL(TBool aUseIntegrity, TBool aLegacy = EFalse); |
|
172 |
|
173 private: |
|
174 |
|
175 /** |
|
176 * Read all application Uids from JavaStorage. |
|
177 * |
|
178 * @param[out] aFoundApps Application list to be populated. |
|
179 */ |
|
180 void ApplicationUids( |
|
181 java::storage::JavaStorageApplicationList_t& aFoundApps) const; |
|
182 |
|
183 /** |
|
184 * Match given Uid to Uids in the given list. Application type is populated |
|
185 * after matching and it is checked if application is present. |
|
186 * |
|
187 * @since S60 vx.x |
|
188 * @param aApps Application list holding Uids. |
|
189 * @param aUid to match. |
|
190 * @param[out] aType application type to be populated. |
|
191 * @return true if uid matches one with the application list and |
|
192 * it is present, false otherwise. |
|
193 */ |
|
194 TBool MatchUid(const java::storage::JavaStorageApplicationList_t& aApps, |
|
195 const java::util::Uid& aUid, |
|
196 Java::TJavaRegistryEntryType& aType) const; |
|
197 |
|
198 /** |
|
199 * Read application entry from JavaStorage. Entry is read based on its |
|
200 * uid. Entry is left empty if it is |
|
201 * not found from the storage. |
|
202 * |
|
203 * @param aUid uid used to identify application entry. |
|
204 * @param aTableName where entry is read. |
|
205 * @param[out] aAppEntry to be populated. |
|
206 */ |
|
207 void StorageEntry( |
|
208 const java::util::Uid& aUid, |
|
209 const std::string& aTableName, |
|
210 java::storage::JavaStorageApplicationEntry_t& aAppEntry) const; |
|
211 |
|
212 /** |
|
213 * Populate TUid array. Array is populated Uids matching to JavaStorageEntry |
|
214 * defined Uid. Add TUid to array if not exists already. If error happens |
|
215 * in Uid to TUid conversion, uid is skipped. |
|
216 * |
|
217 * @param aApps Applications which Uids are populated. |
|
218 * @param aEntry Used to match correct Uid. |
|
219 * @param aUids Array to be populated. |
|
220 */ |
|
221 void AddUids( |
|
222 const java::storage::JavaStorageApplicationList_t& aApps, |
|
223 const java::storage::JavaStorageEntry& aEntry, |
|
224 RArray<TUid>& aUids) const; |
|
225 |
|
226 /** |
|
227 * Check is entry present on the device. Entry must contain at least |
|
228 * ID or PACKAGE_ID and MEDIA_ID attributes. |
|
229 * |
|
230 * @param aEntry to be checked. |
|
231 * @return true if application is present, false otherwise. |
|
232 */ |
|
233 TBool IsPresent( |
|
234 const java::storage::JavaStorageApplicationEntry_t& aEntry) const; |
|
235 |
|
236 /** |
|
237 * Read entry attribute value from given entry. |
|
238 * If not found value is set as empty. |
|
239 * |
|
240 * @param aEntry where to search. |
|
241 * @param aName to be search. |
|
242 * @param[out] aValue to be populated. |
|
243 */ |
|
244 void EntryAttributeValue( |
|
245 const java::storage::JavaStorageApplicationEntry_t& aEntry, |
|
246 const std::wstring& aName, |
|
247 std::wstring& aValue) const; |
|
248 |
|
249 |
|
250 private: // Data |
|
251 |
|
252 java::storage::JavaStorage* iStorage; |
|
253 |
|
254 }; |
|
255 |
|
256 } // namespace Registry |
|
257 } // namespace Manager |
|
258 } // namespace Java |
|
259 |
|
260 #endif // WRITEABLEJAVAREGISTRY_H |
|
261 |
|
262 // End of File |