|
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: javaregstore definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef JAVAREGSTORE_H |
|
20 #define JAVAREGSTORE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "javastorage.h" |
|
24 #include "javauid.h" |
|
25 #include "javaregistryentrytype.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 namespace Java |
|
29 { |
|
30 namespace Manager |
|
31 { |
|
32 namespace Registry |
|
33 { |
|
34 |
|
35 class CJavaPropertyArray; |
|
36 class CJavaProperty; |
|
37 |
|
38 /** |
|
39 * CJavaRegStore read application information from Java Storage. |
|
40 * Information is then converterd to Java Registry format and sent |
|
41 * back to client. Only reading is possible. |
|
42 */ |
|
43 class CJavaRegStore : public CBase |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Creates object of this class. |
|
50 * |
|
51 * @since S60 v3.2 |
|
52 */ |
|
53 static CJavaRegStore* NewL(); |
|
54 |
|
55 /** |
|
56 * Creates object of this class. |
|
57 * |
|
58 * @since S60 v3.2 |
|
59 */ |
|
60 static CJavaRegStore* NewLC(); |
|
61 |
|
62 /** |
|
63 * Reads properties from the file identified with the given uid. |
|
64 * If no properties found for the given uid aProperties is null else |
|
65 * it is allocated a new CJavaPropertyArray object containing the read |
|
66 * properties. |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 * @param aUid properties belonging to this uid must be read |
|
70 * @param aProperties [out] properties are read in this parameter |
|
71 * @param aAllEntries decision, if we want to read entry |
|
72 * from not presented MMC |
|
73 */ |
|
74 void ReadPropertiesL( |
|
75 TUid aUid, |
|
76 CJavaPropertyArray*& aProperties, |
|
77 TBool aAllEntries = EFalse); |
|
78 |
|
79 /** |
|
80 * Returns the stored uids of all drives. |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @param [out] aUid stored uids are returned in this parameter |
|
84 */ |
|
85 void GetUidsL(RArray<TUid>& aUids); |
|
86 |
|
87 /** |
|
88 * Returns with a set of uids whose entries contains the properties (and |
|
89 * has the same values) given in the aProperties parameter. |
|
90 * |
|
91 * @since S60 v3.2 |
|
92 * @param aProperties the set of properties which must exists |
|
93 * (and must have the same values) in the looked entries |
|
94 * @param[out] aFoundUids uids of the found entries are returned |
|
95 * in this parameter |
|
96 * @param aAllEntries means, that method give all entries including |
|
97 * entries, which regards with midlets stored in not presented |
|
98 * media. EFalse means entries with regarding not presented |
|
99 * media will not return. |
|
100 */ |
|
101 void FindEntriesL( |
|
102 CJavaPropertyArray& aProperties, |
|
103 RArray<TUid>& aFoundUids, |
|
104 TBool aAllEntries = EFalse); |
|
105 |
|
106 /** |
|
107 * Destructs object. |
|
108 * |
|
109 * @since S60 v3.2 |
|
110 */ |
|
111 ~CJavaRegStore(); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Constructor |
|
117 * |
|
118 * @since S60 v3.2 |
|
119 */ |
|
120 CJavaRegStore(); |
|
121 |
|
122 /** |
|
123 * ConstructL |
|
124 * |
|
125 * @since S60 v3.2 |
|
126 */ |
|
127 void ConstructL(); |
|
128 |
|
129 /** |
|
130 * Match given Uid to entry type. |
|
131 * |
|
132 * @param aApps List of applications where to match. |
|
133 * @param aUid Uid to be matched. |
|
134 * @param aType[out] Matched application type. |
|
135 * @return ETrue if Uid matched to one in the application list, false |
|
136 * otherwise. |
|
137 */ |
|
138 TBool MatchUidL( |
|
139 const java::storage::JavaStorageApplicationList_t& aApps, |
|
140 const java::util::Uid& aUid, |
|
141 Java::TJavaRegistryEntryType& aType) const; |
|
142 |
|
143 /** |
|
144 * Read storage entry from Java Storage. |
|
145 * The function may leave one of the Java Storage error codes. |
|
146 * |
|
147 * @param aUid Entry Uid to be read. |
|
148 * @param aTableName Table where to read. |
|
149 * @param aAppEntry[out] Application entry. Empty if not found from |
|
150 * the storage. |
|
151 */ |
|
152 void StorageEntryL( |
|
153 const java::util::Uid& aUid, |
|
154 const std::string& aTableName, |
|
155 java::storage::JavaStorageApplicationEntry_t& aAppEntry) const; |
|
156 |
|
157 /** |
|
158 * Convert application entries to registry format. |
|
159 * |
|
160 * @param aArray[out] Converted properties. |
|
161 * @param aAttrs Application entries to be converted. |
|
162 */ |
|
163 void PopulatePropertiesL( |
|
164 CJavaPropertyArray*& aArray, |
|
165 const java::storage::JavaStorageApplicationEntry_t& aAttrs) const; |
|
166 |
|
167 /** |
|
168 * Convert application entry to registry property. |
|
169 * |
|
170 * @param aName Name of the application entry. |
|
171 * @param aValue Value of the application entry. |
|
172 * @return created property. Ownership is moved to caller. |
|
173 * If property cannot be created NULL is returned. |
|
174 */ |
|
175 CJavaProperty* CreatePropertyL( |
|
176 const std::wstring& aName, |
|
177 const std::wstring& aValue) const; |
|
178 |
|
179 /** |
|
180 * Search from Java Storage. |
|
181 * The function may leave one of the Java Storage error codes. |
|
182 * |
|
183 * @param aTableName Table name where to search. |
|
184 * @param Query used in search. |
|
185 * @param aFoundApps Matched applications. Empty if no matches. |
|
186 */ |
|
187 void SearchL( |
|
188 const std::string& aTableName, |
|
189 const java::storage::JavaStorageApplicationEntry_t& aQuery, |
|
190 java::storage::JavaStorageApplicationList_t& aFoundApps) const; |
|
191 |
|
192 /** |
|
193 * Populate Uid array by Uids found from storage application list. |
|
194 * |
|
195 * @param aApps Application list. |
|
196 * @param aEntry Entry to define Application type. |
|
197 * @param[out] aUids Uid array to be populated. |
|
198 */ |
|
199 void AddUidsL( |
|
200 const java::storage::JavaStorageApplicationList_t& aApps, |
|
201 const java::storage::JavaStorageEntry& aEntry, |
|
202 RArray<TUid>& aUids) const; |
|
203 |
|
204 /** |
|
205 * Read application complementary information. This information is such |
|
206 * that cannot be read from information belogning to the application |
|
207 * i.e. application suite stored information. One example is |
|
208 * application installation drive. |
|
209 * |
|
210 * @param aUid Uid which application information to read. |
|
211 * @param[out] aAttrs Attribute container where new attributes are |
|
212 * added. |
|
213 */ |
|
214 void ComplementaryInformationL( |
|
215 const java::util::Uid& aUid, |
|
216 java::storage::JavaStorageApplicationEntry_t& aAttrs) const; |
|
217 |
|
218 void PopulateManifestAttributesL( |
|
219 const java::util::Uid& aUid, |
|
220 CJavaPropertyArray*& aProperties) const; |
|
221 |
|
222 /** |
|
223 * Read attribute value from entry. Value is left empty if no value exists. |
|
224 * |
|
225 * @param aEntry application entry. |
|
226 * @param aName attribute name to be read. |
|
227 * @param aValue to be populated. |
|
228 */ |
|
229 void EntryAttributeValue( |
|
230 const java::storage::JavaStorageApplicationEntry_t& aEntry, |
|
231 const std::wstring& aName, |
|
232 std::wstring& aValue) const; |
|
233 |
|
234 /** |
|
235 * Read Entry attributes from the storage. |
|
236 * |
|
237 * @param aUid Entry Uid. |
|
238 * @param aAppType Entry type. |
|
239 * @param[out] aAttributes Entry attributes. |
|
240 */ |
|
241 void EntryAttributesL( |
|
242 java::util::Uid& aUid, |
|
243 Java::TJavaRegistryEntryType& aAppType, |
|
244 java::storage::JavaStorageApplicationEntry_t& aAttributes) const; |
|
245 |
|
246 /** |
|
247 * Populate Entry type specific attributes. |
|
248 * |
|
249 * @param aUid Entry Uid. |
|
250 * @param aAppType Entry type. |
|
251 * @param[out] aProperties Entry specific attributes. |
|
252 */ |
|
253 void PopulateAppTypePropertiesL( |
|
254 const java::util::Uid& aUid, |
|
255 const Java::TJavaRegistryEntryType aAppType, |
|
256 CJavaPropertyArray*& aProperties) const; |
|
257 |
|
258 /** |
|
259 * Check application is stored in present media. |
|
260 * |
|
261 * @param aEntry Entry to be checked. |
|
262 * @return ETrue if application is stored to present media, |
|
263 * false otherwise. |
|
264 **/ |
|
265 TBool IsPresentL( |
|
266 const java::storage::JavaStorageApplicationEntry_t& aEntry) const; |
|
267 |
|
268 private: // members |
|
269 |
|
270 java::storage::JavaStorage* iStorage; |
|
271 |
|
272 }; |
|
273 |
|
274 }//namespace Registry |
|
275 }//namespace Manager |
|
276 }//namespace Java |
|
277 |
|
278 #endif // JAVAREGSTORE_H |
|
279 |