|
1 /* |
|
2 * Copyright (c) 2002-2003 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: Definition of CInstalledAppsRegistryEntry class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef INSTALLEDAPPSREGISTRYENTRY_H |
|
20 #define INSTALLEDAPPSREGISTRYENTRY_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <e32const.h> |
|
26 #include <s32std.h> |
|
27 #include <appversion.h> |
|
28 #include <javaregistryentry.h> |
|
29 #include <javaregistryentrytype.h> |
|
30 |
|
31 #include "minstalledappsregistry.h" |
|
32 #include "installtypes.h" |
|
33 #include "javastorage.h" |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 class CInstalledAppsRegistryFiles; |
|
38 class CInstalledAppsRegistryEntry; |
|
39 class CEntryLangDetails; |
|
40 class CPropertyValuePair; |
|
41 class RFs; |
|
42 class RWriteStream; |
|
43 class RReadStream; |
|
44 |
|
45 // CLASS DECLARATIONS |
|
46 |
|
47 /** |
|
48 * An entry of an installed application. These entries created and retrieved |
|
49 * using the CInstalledAppsRegistry API. |
|
50 * |
|
51 * Each entry is keyed by a UID, and contains various fields and parameters. |
|
52 * It also contains a list of files which make up the application, and |
|
53 * a list of languages the application supports. |
|
54 */ |
|
55 class CInstalledAppsRegistryEntry : private CBase, |
|
56 public MInstalledAppsRegistryEntry |
|
57 { |
|
58 public: // API available for server (Installer and IntegritySupport) |
|
59 /** |
|
60 * Two-phase constructors. |
|
61 */ |
|
62 inline static CInstalledAppsRegistryEntry* NewL(); |
|
63 IMPORT_C static CInstalledAppsRegistryEntry* NewLC(); |
|
64 |
|
65 /** |
|
66 * Two-phase constructors. |
|
67 * @param aOther Another registry entry used for initialization (basically |
|
68 * for copying). |
|
69 */ |
|
70 inline static CInstalledAppsRegistryEntry* NewL |
|
71 (const CInstalledAppsRegistryEntry& aOther); |
|
72 IMPORT_C static CInstalledAppsRegistryEntry* NewLC |
|
73 (const CInstalledAppsRegistryEntry& aOther); |
|
74 |
|
75 /** |
|
76 * Two-phase constructors. |
|
77 * @param aStream Stream used for initialization. |
|
78 */ |
|
79 inline static CInstalledAppsRegistryEntry* NewL(RReadStream& aStream); |
|
80 IMPORT_C static CInstalledAppsRegistryEntry* NewLC(RReadStream& aStream); |
|
81 |
|
82 /** |
|
83 * Two-phase constructor. |
|
84 * |
|
85 * @param aRegEntry JavaRegistry entry. Entry ownership is taken. |
|
86 */ |
|
87 IMPORT_C static CInstalledAppsRegistryEntry* NewL( |
|
88 Java::CJavaRegistryEntry* aRegEntry); |
|
89 |
|
90 /** |
|
91 * Writes the object to a stream |
|
92 * @param aStream |
|
93 */ |
|
94 IMPORT_C void WriteL(RWriteStream& aStream) const; |
|
95 |
|
96 /** |
|
97 * Adds an extra reference to the ref count. |
|
98 */ |
|
99 IMPORT_C void AddRef(); |
|
100 |
|
101 public: // Setter methods. |
|
102 |
|
103 /** |
|
104 * Used to set the uid of the package/application. |
|
105 */ |
|
106 IMPORT_C void SetUid(const TUid& aUid); |
|
107 |
|
108 /** |
|
109 * Used to set the version of the package/application. |
|
110 */ |
|
111 IMPORT_C void SetVersion(const TAppVersion& aVersion); |
|
112 |
|
113 /** |
|
114 * Used to set the drive, where the package/application is stored. |
|
115 */ |
|
116 IMPORT_C void SetDrive(TChar aDrive); |
|
117 |
|
118 /** |
|
119 * Used to set the type of the package/application. |
|
120 */ |
|
121 IMPORT_C void SetType(TInstallType aType); |
|
122 |
|
123 /** |
|
124 * An application-specific filename can be added to the entry with |
|
125 * this method. |
|
126 * @param aFileName Name of the file that belongs to the application. |
|
127 */ |
|
128 IMPORT_C void AddFileL(const TDesC& aFileName); |
|
129 |
|
130 /** |
|
131 * An application-specific directory can be added to the entry with |
|
132 * this method. |
|
133 * @param aFileName Name of the directory that belongs to the application. |
|
134 */ |
|
135 IMPORT_C void AddDirectoryL(const TDesC& aFileName); |
|
136 |
|
137 /** |
|
138 * An AppArc identifier can be added to the application entry with this |
|
139 * method. |
|
140 * @param aApparcIdentifier AppArc identifier to be added. |
|
141 */ |
|
142 IMPORT_C void AddApparcIdentifierL(const TDesC& aApparcIdentifier); |
|
143 |
|
144 /** |
|
145 * A new certificate chain belonging to the application can be added to |
|
146 * the entry. |
|
147 * @param aCertChain Certification chain to be added. |
|
148 */ |
|
149 IMPORT_C void AddCertificateChainL(const TDesC8& aCertChain); |
|
150 |
|
151 /** |
|
152 * Adds a property/value pair to the entry. |
|
153 * @param aPropertyId The UID of the property. |
|
154 * @param aValue The property value. |
|
155 */ |
|
156 IMPORT_C void AddPropertyL(TUid aPropertyId, const TDesC8& aValue); |
|
157 |
|
158 /** |
|
159 * Adds support for a particular language. With it, the package name and |
|
160 * vendor name for this language must be included. |
|
161 * @param aLang The language to add. |
|
162 * @param aPackage The package name for this language. |
|
163 * @param aVendor The vendor name for this language. |
|
164 */ |
|
165 IMPORT_C void AddLanguageL(TLanguage aLang, |
|
166 const TDesC& aPackage, |
|
167 const TDesC& aVendor); |
|
168 |
|
169 /** |
|
170 * Dependencies API calls. Adds a package UID on which the entry is |
|
171 * dependent. |
|
172 * @param aUid Package Uid. |
|
173 */ |
|
174 IMPORT_C void AddDependencyL(TUid aUid); |
|
175 |
|
176 /** |
|
177 * Lists uids this package is dependent upon. |
|
178 * @return List of uids this package is dependent upon. |
|
179 */ |
|
180 inline const RArray<TUid>& Dependencies() const; |
|
181 |
|
182 /** |
|
183 * Embedded packages API calls. Adds the UID of a package which has been |
|
184 * embedded in this package |
|
185 * @param aUid Uid of the package this application is dependent upon. |
|
186 */ |
|
187 IMPORT_C void AddEmbeddedPackageL(TUid aUid); |
|
188 |
|
189 /** |
|
190 * Lists uids identifying entries embedded into this package. |
|
191 * @return List of uids of embedded entries of this package. |
|
192 */ |
|
193 inline const RArray<TUid>& EmbeddedPackages() const; |
|
194 |
|
195 public: // From MInstalledAppsRegistryEntry - Read-only interface |
|
196 |
|
197 /** |
|
198 * @see MInstalledAppsRegistryEntry. |
|
199 */ |
|
200 virtual void Release(); |
|
201 |
|
202 /** |
|
203 * @see MInstalledAppsRegistryEntry. |
|
204 */ |
|
205 virtual TUid UidL() const; |
|
206 |
|
207 /** |
|
208 * @see MInstalledAppsRegistryEntry. |
|
209 */ |
|
210 virtual TAppVersion VersionL() const; |
|
211 |
|
212 /** |
|
213 * @see MInstalledAppsRegistryEntry. |
|
214 */ |
|
215 virtual TChar DriveL() const; |
|
216 |
|
217 /** |
|
218 * @see MInstalledAppsRegistryEntry. |
|
219 */ |
|
220 virtual TInstallType TypeL() const; |
|
221 |
|
222 /** |
|
223 * @see MInstalledAppsRegistryEntry. |
|
224 */ |
|
225 virtual const TDesC& PackageNameL(TLanguage aLanguage) const; |
|
226 |
|
227 /** |
|
228 * @see MInstalledAppsRegistryEntry. |
|
229 */ |
|
230 virtual const TDesC& VendorNameL(TLanguage aLanguage) const; |
|
231 |
|
232 /** |
|
233 * @see MInstalledAppsRegistryEntry. |
|
234 */ |
|
235 virtual void LanguagesL(RArray<TLanguage>& aLangArray) const; |
|
236 |
|
237 /** |
|
238 * @see MInstalledAppsRegistryEntry. |
|
239 */ |
|
240 virtual TBool LanguageSupportedL(TLanguage aLanguage) const; |
|
241 |
|
242 /** |
|
243 * @see MInstalledAppsRegistryEntry. |
|
244 */ |
|
245 virtual void ListFilesL(RPointerArray<HBufC>& aFileArray) const; |
|
246 |
|
247 /** |
|
248 * @see MInstalledAppsRegistryEntry. |
|
249 */ |
|
250 virtual TBool UsesFileL(const TDesC& aFileName) const; |
|
251 |
|
252 /** |
|
253 * @see MInstalledAppsRegistryEntry. |
|
254 */ |
|
255 virtual void ListDirectoriesL(RPointerArray<HBufC>& aDirArray) const; |
|
256 |
|
257 /** |
|
258 * @see MInstalledAppsRegistryEntry. |
|
259 */ |
|
260 virtual TInt NumberOfCertificateChainsL() const; |
|
261 |
|
262 /** |
|
263 * @see MInstalledAppsRegistryEntry. |
|
264 */ |
|
265 virtual const TDesC8& CertificateChainL(TInt aChain) const; |
|
266 |
|
267 /** |
|
268 * @see MInstalledAppsRegistryEntry. |
|
269 */ |
|
270 virtual TInt SizeL() const; |
|
271 |
|
272 /** |
|
273 * @see MInstalledAppsRegistryEntry. |
|
274 */ |
|
275 virtual void FindFileWithExtL(const TDesC& aExtension, |
|
276 TFileName& aFileName) const; |
|
277 |
|
278 /** |
|
279 * @see MInstalledAppsRegistryEntry. |
|
280 */ |
|
281 virtual TBool IsInRomL() const; |
|
282 |
|
283 /** |
|
284 * @see MInstalledAppsRegistryEntry. |
|
285 */ |
|
286 virtual HBufC8* GetPropertyL(TUid aPropertyId) const; |
|
287 |
|
288 /** |
|
289 * @see MInstalledAppsRegistryEntry. |
|
290 */ |
|
291 virtual void ListApparcIdentifiersL |
|
292 (RPointerArray<HBufC>& aApparcIdentifiersArray) const; |
|
293 |
|
294 public: // API used only by CInstalledAppsRegistry |
|
295 /** |
|
296 * Returns the value of a property for a given UID. Returns NULL if the |
|
297 * property does not exists |
|
298 * @param aPropertyId The property ID |
|
299 * @return The value - NULL if not found. |
|
300 * Ownership is NOT transferred to the caller |
|
301 */ |
|
302 CPropertyValuePair* GetProperty(TUid aPropertyId) const; |
|
303 |
|
304 /** |
|
305 * Returns the size of this entry in bytes. Used for allocating a buffer |
|
306 * with the right size for streaming. |
|
307 * @return Size of entry in bytes. |
|
308 */ |
|
309 TInt SizeForStreamingL() const; |
|
310 |
|
311 private: |
|
312 // 1st and 2nd phase constructors |
|
313 /** |
|
314 * Default constructor. |
|
315 */ |
|
316 CInstalledAppsRegistryEntry(); |
|
317 |
|
318 /** |
|
319 * Constructor. |
|
320 * @param aOther Another registry entry based on which initialization can |
|
321 * be performed. |
|
322 */ |
|
323 CInstalledAppsRegistryEntry(const CInstalledAppsRegistryEntry& aOther); |
|
324 |
|
325 /** |
|
326 * Second-phase constructor. |
|
327 */ |
|
328 void ConstructL(); |
|
329 |
|
330 /** |
|
331 * Second-phase constructor. |
|
332 */ |
|
333 void ConstructL(Java::CJavaRegistryEntry* aRegistryEntry); |
|
334 |
|
335 /** |
|
336 * Second-phase constructor. |
|
337 */ |
|
338 void ConstructL(RReadStream& aStream, TBool aStoreFileList = ETrue); |
|
339 |
|
340 /** |
|
341 * Second-phase constructor. |
|
342 */ |
|
343 void ConstructL(const CInstalledAppsRegistryEntry& aOther); |
|
344 |
|
345 /** |
|
346 * Private destructor: everything must go through Release() method. |
|
347 */ |
|
348 virtual ~CInstalledAppsRegistryEntry(); |
|
349 |
|
350 /** |
|
351 * Disallow assignment. |
|
352 */ |
|
353 const CInstalledAppsRegistryEntry& operator= |
|
354 (const CInstalledAppsRegistryEntry&); |
|
355 |
|
356 private: // other internal helper methods |
|
357 /** |
|
358 * Given a language, returns the element containing data for that language. |
|
359 * @param aLanguage Language to be queried. |
|
360 * @return Language details. |
|
361 */ |
|
362 const CEntryLangDetails* FindLanguage(TLanguage aLanguage) const; |
|
363 |
|
364 /** |
|
365 * Given a language, returns the element containing data for that language. |
|
366 * This version leaves if it details are not found. |
|
367 * @param aLanguage Language to be queried. |
|
368 * @return Language details. |
|
369 */ |
|
370 const CEntryLangDetails& FindLanguageL(TLanguage aLanguage) const; |
|
371 |
|
372 /** |
|
373 * Accessor function to the iInstalledFiles member - these ensure that the |
|
374 * installed files have been loaded from the iFromFile. |
|
375 */ |
|
376 CInstalledAppsRegistryFiles& InstalledFilesL() const; |
|
377 |
|
378 private: |
|
379 Java::TJavaRegistryEntryType iType; |
|
380 |
|
381 // This attribute is ETrue if the entry is physically stored in ROM |
|
382 TBool iIsInRom; |
|
383 |
|
384 // Attribute which contains the list of files - when being read from a |
|
385 // file, it is fetched in a lazy fashion such that it is not set until the |
|
386 // client asks for it. It should never be access directly, but rather |
|
387 // through the InstalledFilesL() function |
|
388 mutable CInstalledAppsRegistryFiles* iInstalledFiles; |
|
389 |
|
390 // The reference count - gets deleted if it gets decremented to |
|
391 // zero |
|
392 TInt iRefCount; |
|
393 |
|
394 Java::CJavaRegistryEntry* iRegistryEntry; |
|
395 }; |
|
396 |
|
397 #include "installedappsregistryentry.inl" |
|
398 |
|
399 #endif // INSTALLEDAPPSREGISTRYENTRY_H |