|
1 /* |
|
2 * Copyright (c) 2008-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: Implementation of CStorageBackupUtil |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "javastoragebackuputil.h" |
|
20 #include "midp2backupplugin.h" |
|
21 #include "midp2backupdataids.h" |
|
22 |
|
23 #include "javastorageentry.h" |
|
24 #include "javastorage.h" |
|
25 #include "javastoragenames.h" |
|
26 |
|
27 #include "logger.h" |
|
28 #include "javauid.h" |
|
29 #include "javaoslayer.h" |
|
30 #include "javacommonutils.h" |
|
31 #include "s60commonutils.h" |
|
32 #include "javasymbianoslayer.h" |
|
33 |
|
34 #include <memory> |
|
35 #include <s32mem.h> |
|
36 |
|
37 using namespace std; |
|
38 using namespace java::storage; |
|
39 using namespace java::backup; |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 CStorageBackupUtil::CStorageBackupUtil() |
|
44 { |
|
45 LOG(EBackup, EInfo, "CStorageBackupUtil constructor"); |
|
46 } |
|
47 |
|
48 void CStorageBackupUtil::ConstructL() |
|
49 { |
|
50 LOG(EBackup, EInfo, "CStorageBackupUtil::ConstructL"); |
|
51 |
|
52 iFirstCalltoBackupStorageData = ETrue; |
|
53 iFirstCalltoRestoreStorageData = ETrue; |
|
54 |
|
55 iBufferSpaceLeft = 0; |
|
56 |
|
57 iRemainingString = EFalse; |
|
58 iStrCount = 0; |
|
59 |
|
60 for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++) |
|
61 { |
|
62 iTableSize[tableNumber] = 0; |
|
63 } |
|
64 } |
|
65 |
|
66 CStorageBackupUtil* CStorageBackupUtil::NewL() |
|
67 { |
|
68 LOG(EBackup, EInfo, "CStorageBackupUtil::NewL"); |
|
69 |
|
70 CStorageBackupUtil* self = new(ELeave) CStorageBackupUtil(); |
|
71 CleanupStack::PushL(self); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop(); |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 CStorageBackupUtil::~CStorageBackupUtil() |
|
79 { |
|
80 LOG(EBackup, EInfo, "CStorageBackupUtil Destructor"); |
|
81 |
|
82 // clear the vectors to free all the heap data. |
|
83 iStringVector.clear(); |
|
84 } |
|
85 |
|
86 |
|
87 void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft) |
|
88 { |
|
89 LOG(EBackup, EInfo, "CStorageBackupUtil::BackupStorageDataL"); |
|
90 |
|
91 iBufferSpaceLeft = aBufferSpaceLeft; |
|
92 |
|
93 if (iFirstCalltoBackupStorageData) |
|
94 { |
|
95 int err = FillVectorWithStorageData(); |
|
96 |
|
97 if (err != KErrNone) |
|
98 { |
|
99 User::Leave(err); |
|
100 } |
|
101 LOG1(EBackup, EInfo, "Total no of rows in vector: %d", iStringVector.size()); |
|
102 |
|
103 // First write the total no of rows in the vector to the stream |
|
104 |
|
105 aStream.WriteInt32L(iStringVector.size()); |
|
106 iBufferSpaceLeft -= sizeof(TInt32); |
|
107 |
|
108 /* Then write the number of rows in each table to the stream. |
|
109 This will be used while writing the data to storage. */ |
|
110 |
|
111 for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++) |
|
112 { |
|
113 aStream.WriteInt16L(iTableSize[tableNumber]); |
|
114 iBufferSpaceLeft -= sizeof(TInt16); |
|
115 } |
|
116 |
|
117 iFirstCalltoBackupStorageData = EFalse; |
|
118 } |
|
119 |
|
120 // Now write the actual string data into the stream. |
|
121 |
|
122 while (iBufferSpaceLeft > 0 && iStrCount < iStringVector.size()) |
|
123 { |
|
124 WriteStringtoStreamL(aStream, iStringVector[iStrCount]); |
|
125 LOG1(EBackup, EInfo, "StrCount = %d", iStrCount); |
|
126 } |
|
127 |
|
128 if (iStrCount >= iStringVector.size()) |
|
129 { |
|
130 LOG(EBackup, EInfo, "Backup of storage data finished"); |
|
131 aBackupNotFinished = EFalse; |
|
132 } |
|
133 } |
|
134 |
|
135 void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft) |
|
136 { |
|
137 LOG(EBackup, EInfo, "CStorageBackupUtil::RestoreStorageDataL()"); |
|
138 |
|
139 iBufferSpaceLeft = aBufferSpaceLeft; |
|
140 |
|
141 if (iFirstCalltoRestoreStorageData) |
|
142 { |
|
143 // the no of strings in the stream |
|
144 iStrCount = aStream.ReadInt32L(); |
|
145 iBufferSpaceLeft -= sizeof(TInt32); |
|
146 |
|
147 // read the number of rows in each table |
|
148 for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++) |
|
149 { |
|
150 iTableSize[tableNumber] = aStream.ReadInt16L(); |
|
151 iBufferSpaceLeft -= sizeof(TInt16); |
|
152 } |
|
153 iFirstCalltoRestoreStorageData = EFalse; |
|
154 } |
|
155 |
|
156 while (iBufferSpaceLeft > 0 && iStrCount > 0) |
|
157 { |
|
158 ReadStringfromStreamL(aStream); |
|
159 } |
|
160 |
|
161 if (iStrCount == 0) |
|
162 { |
|
163 LOG1(EBackup, EInfo, "Finished reading from stream, row count = %d", iStringVector.size()); |
|
164 |
|
165 |
|
166 int err = WriteDataToStorage(); |
|
167 |
|
168 if (err != KErrNone) |
|
169 { |
|
170 CleanupStack::PopAndDestroy(&aStream); |
|
171 User::Leave(KErrGeneral); |
|
172 } |
|
173 |
|
174 // Storage restore is over; Set state to EAppArc |
|
175 aRestoreState = EAppArc; |
|
176 aBufferSpaceLeft = iBufferSpaceLeft; |
|
177 } |
|
178 } |
|
179 |
|
180 |
|
181 void CStorageBackupUtil::WriteStringtoStreamL(RDesWriteStream& aStream, wstring aStr) |
|
182 { |
|
183 iLenOfString = aStr.length(); |
|
184 |
|
185 // if length of string is 0, do not write any string to the stream. |
|
186 if (iLenOfString == 0) |
|
187 { |
|
188 aStream.WriteInt16L(iLenOfString*2); |
|
189 iBufferSpaceLeft -= sizeof(TInt16); |
|
190 iStrCount++; |
|
191 } |
|
192 |
|
193 else |
|
194 { |
|
195 /* if space is not enough for writing the complete string, |
|
196 do not write it. Could be written next time. */ |
|
197 if (((iLenOfString*2) + sizeof(TInt16)) > iBufferSpaceLeft) |
|
198 { |
|
199 LOG(EBackup, EInfo, "Stream size is not enough to hold the string"); |
|
200 // set the bufferspaceleft to zero |
|
201 iBufferSpaceLeft = 0; |
|
202 } |
|
203 // stream has enough space for the length and the string data. |
|
204 else |
|
205 { |
|
206 aStream.WriteInt16L(iLenOfString*2); |
|
207 iBufferSpaceLeft -= sizeof(TInt16); |
|
208 |
|
209 HBufC* tempstr = java::util::S60CommonUtils::wstringToDes(aStr.c_str()); |
|
210 TPtrC tempStr = tempstr->Des(); |
|
211 aStream.WriteL(tempStr); |
|
212 iBufferSpaceLeft -= (iLenOfString*2); |
|
213 delete tempstr; |
|
214 |
|
215 iStrCount++; |
|
216 } |
|
217 } |
|
218 } |
|
219 |
|
220 void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream) |
|
221 { |
|
222 wstring emptyString; |
|
223 |
|
224 /* if only part of the string was read last time, |
|
225 read the remaining and append it to that string. */ |
|
226 if (iRemainingString) |
|
227 { |
|
228 // if the whole string cannot be read, read part of it and store it. |
|
229 if (iLenOfString > iBufferSpaceLeft) |
|
230 { |
|
231 LOG(EBackup, EInfo, "Cant read the full string; read only part of it"); |
|
232 |
|
233 HBufC* data = HBufC::NewL(iBufferSpaceLeft/2+1); |
|
234 TPtr pdata = data->Des(); |
|
235 |
|
236 aStream.ReadL(pdata, iBufferSpaceLeft/2); |
|
237 iLenOfString -= iBufferSpaceLeft; |
|
238 iBufferSpaceLeft = 0; |
|
239 |
|
240 wchar_t* str = desToWstring(pdata); |
|
241 wstring stringData(str); |
|
242 iHalfReadString += stringData; |
|
243 |
|
244 delete data; |
|
245 iRemainingString = ETrue; |
|
246 } |
|
247 // else read the complete string |
|
248 else |
|
249 { |
|
250 HBufC* data = HBufC::NewL(iLenOfString/2+1); |
|
251 TPtr pdata = data->Des(); |
|
252 |
|
253 aStream.ReadL(pdata, iLenOfString/2); |
|
254 iBufferSpaceLeft -= (iLenOfString); |
|
255 |
|
256 wchar_t* str = desToWstring(pdata); |
|
257 wstring stringData(str); |
|
258 iHalfReadString += stringData; |
|
259 |
|
260 iStringVector.push_back(iHalfReadString); |
|
261 |
|
262 delete data; |
|
263 iStrCount--; |
|
264 iRemainingString = EFalse; |
|
265 iHalfReadString = emptyString; |
|
266 } |
|
267 } |
|
268 |
|
269 else |
|
270 { |
|
271 iLenOfString = aStream.ReadInt16L(); |
|
272 iBufferSpaceLeft -= sizeof(TInt16); |
|
273 |
|
274 if (iLenOfString > 0) |
|
275 { |
|
276 // if full string cannot be read, read only part of it. |
|
277 if (iLenOfString > iBufferSpaceLeft) |
|
278 { |
|
279 /* if the stream does not have even part of the string, |
|
280 just set the iRemainingFlag to ETrue so that the |
|
281 string can be read next time. */ |
|
282 |
|
283 if (iBufferSpaceLeft == 0) |
|
284 { |
|
285 iRemainingString = ETrue; |
|
286 iHalfReadString = emptyString; |
|
287 } |
|
288 // else stream contains part of the stream. Read it |
|
289 else |
|
290 { |
|
291 LOG(EBackup, EInfo, "Cant read the full string; read only part of it"); |
|
292 |
|
293 HBufC* data = HBufC::NewL(iBufferSpaceLeft/2+1); |
|
294 TPtr pdata = data->Des(); |
|
295 |
|
296 aStream.ReadL(pdata, iBufferSpaceLeft/2); |
|
297 iLenOfString -= iBufferSpaceLeft; |
|
298 iBufferSpaceLeft = 0; |
|
299 |
|
300 wchar_t* str = desToWstring(pdata); |
|
301 wstring stringData(str); |
|
302 iHalfReadString = stringData; |
|
303 delete data; |
|
304 iRemainingString = ETrue; |
|
305 } |
|
306 } |
|
307 // else full string can be read |
|
308 else |
|
309 { |
|
310 HBufC* data = HBufC::NewL(iLenOfString/2+1); |
|
311 TPtr pdata = data->Des(); |
|
312 |
|
313 aStream.ReadL(pdata, iLenOfString/2); |
|
314 iBufferSpaceLeft -= (iLenOfString); |
|
315 |
|
316 wchar_t* str = desToWstring(pdata); |
|
317 wstring stringData(str); |
|
318 |
|
319 iStringVector.push_back(stringData); |
|
320 iStrCount--; |
|
321 delete data; |
|
322 } |
|
323 } |
|
324 /* if length of string is 0, do not read anything from the stream; |
|
325 just push an empty string into the vector */ |
|
326 else |
|
327 { |
|
328 iStringVector.push_back(emptyString); |
|
329 iStrCount--; |
|
330 } |
|
331 } |
|
332 } |
|
333 |
|
334 |
|
335 int CStorageBackupUtil::FillVectorWithStorageData() |
|
336 { |
|
337 // get data from storage |
|
338 |
|
339 LOG(EBackup, EInfo, "CStorageBackupUtil::FillVectorsWithData"); |
|
340 |
|
341 auto_ptr<JavaStorage> js(JavaStorage::createInstance()); |
|
342 LOG(EBackup, EInfo, "Opening connection to JAVA_DATABASE"); |
|
343 |
|
344 try |
|
345 { |
|
346 js->open(JAVA_DATABASE_NAME); |
|
347 LOG(EBackup, EInfo, "Opening commection succeeded"); |
|
348 } |
|
349 catch (JavaStorageException jse) |
|
350 { |
|
351 ELOG1(EBackup, "Opening JAVA_DATABASE failed; %S", jse.toString().c_str()); |
|
352 return KErrGeneral; |
|
353 } |
|
354 |
|
355 JavaStorageEntry attribute; |
|
356 JavaStorageApplicationEntry_t findPattern; |
|
357 JavaStorageApplicationList_t foundEntries; |
|
358 |
|
359 |
|
360 // table 1 : Application package table |
|
361 { |
|
362 LOG(EBackup, EInfo, "Read entries from APPLICATION_PACKAGE_TABLE"); |
|
363 |
|
364 try |
|
365 { |
|
366 js->search(APPLICATION_PACKAGE_TABLE, findPattern, foundEntries); |
|
367 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
368 } |
|
369 catch (JavaStorageException jse) |
|
370 { |
|
371 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
372 js->close(); |
|
373 return KErrGeneral; |
|
374 } |
|
375 |
|
376 iTableSize[0] = FillVectorwithAppPackageTableData(foundEntries); |
|
377 foundEntries.clear(); |
|
378 |
|
379 if (iTableSize[0] == 0) |
|
380 { |
|
381 LOG(EBackup, EInfo, "No data in Storage; So no midlets in system;"); |
|
382 return KErrGeneral; |
|
383 } |
|
384 } |
|
385 |
|
386 |
|
387 // table 2: Application table |
|
388 { |
|
389 LOG(EBackup, EInfo, "Read entries from APPLICATION_TABLE"); |
|
390 |
|
391 try |
|
392 { |
|
393 js->search(APPLICATION_TABLE, findPattern, foundEntries); |
|
394 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
395 } |
|
396 catch (JavaStorageException jse) |
|
397 { |
|
398 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
399 js->close(); |
|
400 return KErrGeneral; |
|
401 } |
|
402 |
|
403 iTableSize[1] = FillVectorwithAppTableData(foundEntries); |
|
404 |
|
405 foundEntries.clear(); |
|
406 } |
|
407 |
|
408 // table 3: Application package attributes table |
|
409 |
|
410 /* for this table, since there are very large number of rows, |
|
411 read the data from the table suite-by-suite |
|
412 ie. read entries for the first suite, then read entries for the |
|
413 second suite. This would prevent stack overflow */ |
|
414 { |
|
415 LOG(EBackup, EInfo, "Read entries from APPLICATION_PACKAGE_ATTRIBUTES_TABLE"); |
|
416 |
|
417 int rowCount = 0; |
|
418 |
|
419 for (int suiteNumber = 0; suiteNumber < iTableSize[0]; suiteNumber++) |
|
420 { |
|
421 attribute.setEntry(ID, iStringVector[suiteNumber*14]); |
|
422 findPattern.insert(attribute); |
|
423 |
|
424 try |
|
425 { |
|
426 js->search(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, findPattern, foundEntries); |
|
427 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
428 } |
|
429 catch (JavaStorageException jse) |
|
430 { |
|
431 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
432 js->close(); |
|
433 return KErrGeneral; |
|
434 } |
|
435 |
|
436 rowCount += FillVectorwithAppPackageAttTableData(foundEntries); |
|
437 |
|
438 foundEntries.clear(); |
|
439 findPattern.clear(); |
|
440 } |
|
441 iTableSize[2] = rowCount; |
|
442 } |
|
443 |
|
444 // table 4: Midp package table |
|
445 { |
|
446 LOG(EBackup, EInfo, "Read entries from MIDP_PACKAGE_TABLE"); |
|
447 |
|
448 try |
|
449 { |
|
450 js->search(MIDP_PACKAGE_TABLE, findPattern, foundEntries); |
|
451 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
452 } |
|
453 catch (JavaStorageException jse) |
|
454 { |
|
455 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
456 js->close(); |
|
457 return KErrGeneral; |
|
458 } |
|
459 |
|
460 iTableSize[3] = FillVectorwithMidpPackageTableData(foundEntries); |
|
461 |
|
462 foundEntries.clear(); |
|
463 } |
|
464 |
|
465 // table 5: Midp permissions table |
|
466 |
|
467 /* for this table, since there are very large number of rows, |
|
468 read the data from the table suite-by-suite |
|
469 ie. read entries for the first suite, then read entries for the |
|
470 second suite. This would prevent stack overflow */ |
|
471 { |
|
472 LOG(EBackup, EInfo, "Read entries from MIDP_PERMISSIONS_TABLE"); |
|
473 |
|
474 int rowCount = 0; |
|
475 |
|
476 for (int suiteNumber = 0; suiteNumber < iTableSize[0]; suiteNumber++) |
|
477 { |
|
478 attribute.setEntry(ID, iStringVector[suiteNumber*14]); |
|
479 findPattern.insert(attribute); |
|
480 |
|
481 try |
|
482 { |
|
483 js->search(MIDP_PERMISSIONS_TABLE, findPattern, foundEntries); |
|
484 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
485 } |
|
486 catch (JavaStorageException jse) |
|
487 { |
|
488 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
489 js->close(); |
|
490 return KErrGeneral; |
|
491 } |
|
492 |
|
493 rowCount += FillVectorwithMidpPermTableData(foundEntries); |
|
494 |
|
495 foundEntries.clear(); |
|
496 findPattern.clear(); |
|
497 } |
|
498 iTableSize[4] = rowCount; |
|
499 } |
|
500 |
|
501 // table 6: Midp function group settings table |
|
502 { |
|
503 LOG(EBackup, EInfo, "Read entries from MIDP_FUNC_GRP_SETTINGS_TABLE"); |
|
504 |
|
505 try |
|
506 { |
|
507 js->search(MIDP_FUNC_GRP_SETTINGS_TABLE, findPattern, foundEntries); |
|
508 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
509 } |
|
510 catch (JavaStorageException jse) |
|
511 { |
|
512 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
513 js->close(); |
|
514 return KErrGeneral; |
|
515 } |
|
516 |
|
517 iTableSize[5] = FillVectorwithMidpFuncGrpSetTableData(foundEntries); |
|
518 |
|
519 foundEntries.clear(); |
|
520 } |
|
521 |
|
522 // table 7: push registration table |
|
523 { |
|
524 LOG(EBackup, EInfo, "Read entries from PUSH_REGISTRATIONS_TABLE"); |
|
525 |
|
526 try |
|
527 { |
|
528 js->search(PUSH_REGISTRATIONS_TABLE, findPattern, foundEntries); |
|
529 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
530 } |
|
531 catch (JavaStorageException jse) |
|
532 { |
|
533 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
534 js->close(); |
|
535 return KErrGeneral; |
|
536 } |
|
537 |
|
538 iTableSize[6] = FillVectorwithPushRegTableData(foundEntries); |
|
539 |
|
540 foundEntries.clear(); |
|
541 } |
|
542 |
|
543 // table 8: alarm registration table |
|
544 { |
|
545 LOG(EBackup, EInfo, "Read entries from ALARM_REGISTRATIONS_TABLE"); |
|
546 |
|
547 try |
|
548 { |
|
549 js->search(ALARM_REGISTRATIONS_TABLE, findPattern, foundEntries); |
|
550 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
551 } |
|
552 catch (JavaStorageException jse) |
|
553 { |
|
554 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
555 js->close(); |
|
556 return KErrGeneral; |
|
557 } |
|
558 |
|
559 iTableSize[7] = FillVectorwithAlarmRegTableData(foundEntries); |
|
560 |
|
561 foundEntries.clear(); |
|
562 } |
|
563 |
|
564 // table 9: runtime settings table |
|
565 { |
|
566 LOG(EBackup, EInfo, "Read entries from RUNTIME_SETTINGS_TABLE"); |
|
567 |
|
568 try |
|
569 { |
|
570 js->search(RUNTIME_SETTINGS_TABLE, findPattern, foundEntries); |
|
571 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
572 } |
|
573 catch (JavaStorageException jse) |
|
574 { |
|
575 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
576 js->close(); |
|
577 return KErrGeneral; |
|
578 } |
|
579 |
|
580 iTableSize[8] = FillVectorwithRuntimeSetTableData(foundEntries); |
|
581 |
|
582 foundEntries.clear(); |
|
583 } |
|
584 |
|
585 // table 10: pre-install table |
|
586 { |
|
587 LOG(EBackup, EInfo, "Read entries from PREINSTALL_TABLE"); |
|
588 |
|
589 try |
|
590 { |
|
591 js->search(PREINSTALL_TABLE, findPattern, foundEntries); |
|
592 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
593 } |
|
594 catch (JavaStorageException jse) |
|
595 { |
|
596 ELOG1(EBackup, "Search in Java Storage failed; %S", jse.toString().c_str()); |
|
597 js->close(); |
|
598 return KErrGeneral; |
|
599 } |
|
600 |
|
601 iTableSize[9] = FillVectorwithPreinstallTableData(foundEntries); |
|
602 |
|
603 foundEntries.clear(); |
|
604 } |
|
605 |
|
606 // Data read from JAVA_DATABASE; So close the connection |
|
607 js->close(); |
|
608 |
|
609 // table 11: ota status table |
|
610 /* Stored in another database called javaotadatabase. |
|
611 so open a new connection to that database. */ |
|
612 { |
|
613 LOG(EBackup, EInfo, "Read entries from OTA_STATUS_TABLE"); |
|
614 |
|
615 auto_ptr<JavaStorage> jos(JavaStorage::createInstance()); |
|
616 |
|
617 try |
|
618 { |
|
619 jos->open(JAVA_OTA_DATABASE_NAME); |
|
620 ILOG(EBackup, "Opening connection to OTA database succeeded"); |
|
621 } |
|
622 catch (JavaStorageException jse) |
|
623 { |
|
624 ELOG1(EBackup, "Opening OTA database failed: %s", jse.toString().c_str()); |
|
625 return KErrGeneral; |
|
626 } |
|
627 |
|
628 try |
|
629 { |
|
630 jos->search(OTA_STATUS_TABLE, findPattern, foundEntries); |
|
631 LOG(EBackup, EInfo, "Search in Java Storage succeded"); |
|
632 } |
|
633 catch (JavaStorageException jse) |
|
634 { |
|
635 ELOG1(EBackup, "Search in Java Storage failed; %s", jse.toString().c_str()); |
|
636 jos->close(); |
|
637 return KErrGeneral; |
|
638 } |
|
639 |
|
640 iTableSize[10] = FillVectorwithOtaStatusTableData(foundEntries); |
|
641 |
|
642 foundEntries.clear(); |
|
643 jos->close(); |
|
644 } |
|
645 |
|
646 //################ printing the vectors ############# |
|
647 //printVector(); |
|
648 //################################################### |
|
649 |
|
650 ILOG(EBackup, "Vector filled with data"); |
|
651 return KErrNone; |
|
652 } |
|
653 |
|
654 |
|
655 int CStorageBackupUtil::WriteDataToStorage() |
|
656 { |
|
657 JELOG2(EBackup); |
|
658 ILOG(EBackup, "Create instance of JAVA_DATABASE_NAME and open the database"); |
|
659 |
|
660 auto_ptr<JavaStorage> js(JavaStorage::createInstance()); |
|
661 |
|
662 try |
|
663 { |
|
664 js->open(JAVA_DATABASE_NAME); |
|
665 ILOG(EBackup, "Opening database succeded"); |
|
666 } |
|
667 catch (JavaStorageException jse) |
|
668 { |
|
669 ELOG1(EBackup, "Opening database failed: %S", jse.toString().c_str()); |
|
670 return KErrGeneral; |
|
671 } |
|
672 |
|
673 try |
|
674 { |
|
675 js->startTransaction(); |
|
676 ILOG(EBackup, "Transaction started"); |
|
677 } |
|
678 catch (JavaStorageException jse) |
|
679 { |
|
680 ELOG1(EBackup, "startTransaction() failed: %S", jse.toString().c_str()); |
|
681 js->close(); |
|
682 return KErrGeneral; |
|
683 } |
|
684 |
|
685 ILOG(EBackup, "Before writing data to storage, existing data must be cleared"); |
|
686 |
|
687 // call delete * from table one-by-one |
|
688 { |
|
689 JavaStorageApplicationEntry_t emptyEntry; |
|
690 |
|
691 try |
|
692 { |
|
693 js->remove(APPLICATION_PACKAGE_TABLE, emptyEntry); |
|
694 js->remove(APPLICATION_TABLE, emptyEntry); |
|
695 js->remove(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, emptyEntry); |
|
696 js->remove(MIDP_PACKAGE_TABLE, emptyEntry); |
|
697 js->remove(MIDP_PERMISSIONS_TABLE, emptyEntry); |
|
698 js->remove(MIDP_FUNC_GRP_SETTINGS_TABLE, emptyEntry); |
|
699 js->remove(PUSH_REGISTRATIONS_TABLE, emptyEntry); |
|
700 js->remove(ALARM_REGISTRATIONS_TABLE, emptyEntry); |
|
701 js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry); |
|
702 js->remove(PREINSTALL_TABLE, emptyEntry); |
|
703 |
|
704 ILOG(EBackup, "Data removed successfully from table"); |
|
705 } |
|
706 catch (JavaStorageException jse) |
|
707 { |
|
708 ELOG1(EBackup, "Failed during removal of entries from table: %S", jse.toString().c_str()); |
|
709 js->close(); |
|
710 return KErrGeneral; |
|
711 } |
|
712 } |
|
713 |
|
714 JavaStorageEntry attribute; |
|
715 JavaStorageApplicationEntry_t insertEntry; |
|
716 |
|
717 ILOG(EBackup, "Start transaction for writing into the database"); |
|
718 |
|
719 int count = 0; |
|
720 // table 1 : Application package table |
|
721 { |
|
722 LOG(EBackup, EInfo, "Writing to APPLICATION_PACKAGE_TABLE"); |
|
723 |
|
724 for (int rowNumber = 0; rowNumber < iTableSize[0]; rowNumber++) |
|
725 { |
|
726 attribute.setEntry(ID, iStringVector[count++]); |
|
727 insertEntry.insert(attribute); |
|
728 |
|
729 attribute.setEntry(PACKAGE_NAME, iStringVector[count++]); |
|
730 insertEntry.insert(attribute); |
|
731 |
|
732 attribute.setEntry(VENDOR, iStringVector[count++]); |
|
733 insertEntry.insert(attribute); |
|
734 |
|
735 attribute.setEntry(VERSION, iStringVector[count++]); |
|
736 insertEntry.insert(attribute); |
|
737 |
|
738 attribute.setEntry(ROOT_PATH, iStringVector[count++]); |
|
739 insertEntry.insert(attribute); |
|
740 |
|
741 attribute.setEntry(MEDIA_ID, iStringVector[count++]); |
|
742 insertEntry.insert(attribute); |
|
743 |
|
744 attribute.setEntry(INITIAL_SIZE, iStringVector[count++]); |
|
745 insertEntry.insert(attribute); |
|
746 |
|
747 attribute.setEntry(JAD_PATH, iStringVector[count++]); |
|
748 insertEntry.insert(attribute); |
|
749 |
|
750 attribute.setEntry(JAR_PATH, iStringVector[count++]); |
|
751 insertEntry.insert(attribute); |
|
752 |
|
753 attribute.setEntry(JAD_URL, iStringVector[count++]); |
|
754 insertEntry.insert(attribute); |
|
755 |
|
756 attribute.setEntry(JAR_URL, iStringVector[count++]); |
|
757 insertEntry.insert(attribute); |
|
758 |
|
759 attribute.setEntry(ACCESS_POINT, iStringVector[count++]); |
|
760 insertEntry.insert(attribute); |
|
761 |
|
762 attribute.setEntry(CONTENT_INFO, iStringVector[count++]); |
|
763 insertEntry.insert(attribute); |
|
764 |
|
765 attribute.setEntry(CONTENT_ID, iStringVector[count++]); |
|
766 insertEntry.insert(attribute); |
|
767 |
|
768 try |
|
769 { |
|
770 js->write(APPLICATION_PACKAGE_TABLE, insertEntry); |
|
771 ILOG(EBackup, "Writing to table succeded"); |
|
772 } |
|
773 catch (JavaStorageException jse) |
|
774 { |
|
775 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
776 js->close(); |
|
777 return KErrGeneral; |
|
778 } |
|
779 insertEntry.clear(); |
|
780 } |
|
781 } |
|
782 |
|
783 // table 2: Application table |
|
784 { |
|
785 LOG(EBackup, EInfo, "Writing to APPLICATION_TABLE"); |
|
786 |
|
787 for (int rowNumber = 0; rowNumber < iTableSize[1]; rowNumber++) |
|
788 { |
|
789 attribute.setEntry(ID, iStringVector[count++]); |
|
790 insertEntry.insert(attribute); |
|
791 |
|
792 attribute.setEntry(PACKAGE_ID, iStringVector[count++]); |
|
793 insertEntry.insert(attribute); |
|
794 |
|
795 attribute.setEntry(NAME, iStringVector[count++]); |
|
796 insertEntry.insert(attribute); |
|
797 |
|
798 attribute.setEntry(MAIN_CLASS, iStringVector[count++]); |
|
799 insertEntry.insert(attribute); |
|
800 |
|
801 attribute.setEntry(AUTORUN, iStringVector[count++]); |
|
802 insertEntry.insert(attribute); |
|
803 |
|
804 try |
|
805 { |
|
806 js->write(APPLICATION_TABLE, insertEntry); |
|
807 ILOG(EBackup, "Writing to table succeded"); |
|
808 } |
|
809 catch (JavaStorageException jse) |
|
810 { |
|
811 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
812 js->close(); |
|
813 return KErrGeneral; |
|
814 } |
|
815 insertEntry.clear(); |
|
816 } |
|
817 } |
|
818 |
|
819 // table 3: Application package attributes table |
|
820 { |
|
821 LOG(EBackup, EInfo, "Writing to APPLICATION_PACKAGE_ATTRIBUTES_TABLE"); |
|
822 |
|
823 for (int rowNumber = 0; rowNumber < iTableSize[2]; rowNumber++) |
|
824 { |
|
825 attribute.setEntry(ID, iStringVector[count++]); |
|
826 insertEntry.insert(attribute); |
|
827 |
|
828 attribute.setEntry(NAME, iStringVector[count++]); |
|
829 insertEntry.insert(attribute); |
|
830 |
|
831 attribute.setEntry(VALUE, iStringVector[count++]); |
|
832 insertEntry.insert(attribute); |
|
833 |
|
834 attribute.setEntry(TRUSTED, iStringVector[count++]); |
|
835 insertEntry.insert(attribute); |
|
836 |
|
837 try |
|
838 { |
|
839 js->write(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, insertEntry); |
|
840 ILOG(EBackup, "Writing to table succeded"); |
|
841 } |
|
842 catch (JavaStorageException jse) |
|
843 { |
|
844 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
845 js->close(); |
|
846 return KErrGeneral; |
|
847 } |
|
848 insertEntry.clear(); |
|
849 } |
|
850 } |
|
851 |
|
852 // table 4: Midp package table |
|
853 { |
|
854 LOG(EBackup, EInfo, "Writing to MIDP_PACKAGE_TABLE"); |
|
855 |
|
856 for (int rowNumber = 0; rowNumber < iTableSize[3]; rowNumber++) |
|
857 { |
|
858 attribute.setEntry(ID, iStringVector[count++]); |
|
859 insertEntry.insert(attribute); |
|
860 |
|
861 attribute.setEntry(TYPE, iStringVector[count++]); |
|
862 insertEntry.insert(attribute); |
|
863 |
|
864 attribute.setEntry(SECURITY_DOMAIN, iStringVector[count++]); |
|
865 insertEntry.insert(attribute); |
|
866 |
|
867 attribute.setEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++]); |
|
868 insertEntry.insert(attribute); |
|
869 |
|
870 attribute.setEntry(HASH, iStringVector[count++]); |
|
871 insertEntry.insert(attribute); |
|
872 |
|
873 attribute.setEntry(CERT_HASH, iStringVector[count++]); |
|
874 insertEntry.insert(attribute); |
|
875 |
|
876 attribute.setEntry(RMS, iStringVector[count++]); |
|
877 insertEntry.insert(attribute); |
|
878 |
|
879 attribute.setEntry(VALID_CERTS, iStringVector[count++]); |
|
880 insertEntry.insert(attribute); |
|
881 |
|
882 attribute.setEntry(ON_SCREEN_KEYPAD, iStringVector[count++]); |
|
883 insertEntry.insert(attribute); |
|
884 |
|
885 try |
|
886 { |
|
887 js->write(MIDP_PACKAGE_TABLE, insertEntry); |
|
888 ILOG(EBackup, "Writing to table succeded"); |
|
889 } |
|
890 catch (JavaStorageException jse) |
|
891 { |
|
892 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
893 js->close(); |
|
894 return KErrGeneral; |
|
895 } |
|
896 insertEntry.clear(); |
|
897 } |
|
898 } |
|
899 |
|
900 // table 5: Midp permissions table |
|
901 { |
|
902 LOG(EBackup, EInfo, "Writing to MIDP_PERMISSIONS_TABLE"); |
|
903 |
|
904 for (int rowNumber = 0; rowNumber < iTableSize[4]; rowNumber++) |
|
905 { |
|
906 attribute.setEntry(ID, iStringVector[count++]); |
|
907 insertEntry.insert(attribute); |
|
908 |
|
909 attribute.setEntry(CLASS, iStringVector[count++]); |
|
910 insertEntry.insert(attribute); |
|
911 |
|
912 attribute.setEntry(NAME, iStringVector[count++]); |
|
913 insertEntry.insert(attribute); |
|
914 |
|
915 attribute.setEntry(ACTION, iStringVector[count++]); |
|
916 insertEntry.insert(attribute); |
|
917 |
|
918 attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]); |
|
919 insertEntry.insert(attribute); |
|
920 |
|
921 try |
|
922 { |
|
923 js->write(MIDP_PERMISSIONS_TABLE, insertEntry); |
|
924 ILOG(EBackup, "Writing to table succeded"); |
|
925 } |
|
926 catch (JavaStorageException jse) |
|
927 { |
|
928 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
929 js->close(); |
|
930 return KErrGeneral; |
|
931 } |
|
932 insertEntry.clear(); |
|
933 } |
|
934 } |
|
935 |
|
936 // table 6: Midp function group settings table |
|
937 { |
|
938 LOG(EBackup, EInfo, "MIDP_FUNC_GRP_SETTINGS_TABLE"); |
|
939 |
|
940 for (int rowNumber = 0; rowNumber < iTableSize[5]; rowNumber++) |
|
941 { |
|
942 attribute.setEntry(ID, iStringVector[count++]); |
|
943 insertEntry.insert(attribute); |
|
944 |
|
945 attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]); |
|
946 insertEntry.insert(attribute); |
|
947 |
|
948 attribute.setEntry(ALLOWED_SETTINGS, iStringVector[count++]); |
|
949 insertEntry.insert(attribute); |
|
950 |
|
951 attribute.setEntry(CURRENT_SETTING, iStringVector[count++]); |
|
952 insertEntry.insert(attribute); |
|
953 |
|
954 attribute.setEntry(BLANKET_PROMPT, iStringVector[count++]); |
|
955 insertEntry.insert(attribute); |
|
956 |
|
957 try |
|
958 { |
|
959 js->write(MIDP_FUNC_GRP_SETTINGS_TABLE, insertEntry); |
|
960 ILOG(EBackup, "Writing to table succeded"); |
|
961 } |
|
962 catch (JavaStorageException jse) |
|
963 { |
|
964 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
965 js->close(); |
|
966 return KErrGeneral; |
|
967 } |
|
968 insertEntry.clear(); |
|
969 } |
|
970 } |
|
971 |
|
972 // table 7: push registration table |
|
973 { |
|
974 LOG(EBackup, EInfo, "Writing to PUSH_REGISTRATIONS_TABLE"); |
|
975 |
|
976 for (int rowNumber = 0; rowNumber < iTableSize[6]; rowNumber++) |
|
977 { |
|
978 attribute.setEntry(ID, iStringVector[count++]); |
|
979 insertEntry.insert(attribute); |
|
980 |
|
981 attribute.setEntry(URL, iStringVector[count++]); |
|
982 insertEntry.insert(attribute); |
|
983 |
|
984 attribute.setEntry(NAME, iStringVector[count++]); |
|
985 insertEntry.insert(attribute); |
|
986 |
|
987 attribute.setEntry(FILTER, iStringVector[count++]); |
|
988 insertEntry.insert(attribute); |
|
989 |
|
990 attribute.setEntry(REGISTRATION_TYPE, iStringVector[count++]); |
|
991 insertEntry.insert(attribute); |
|
992 |
|
993 try |
|
994 { |
|
995 js->write(PUSH_REGISTRATIONS_TABLE, insertEntry); |
|
996 ILOG(EBackup, "Writing to table succeded"); |
|
997 } |
|
998 catch (JavaStorageException jse) |
|
999 { |
|
1000 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
1001 js->close(); |
|
1002 return KErrGeneral; |
|
1003 } |
|
1004 insertEntry.clear(); |
|
1005 } |
|
1006 } |
|
1007 |
|
1008 // table 8: alarm registration table |
|
1009 { |
|
1010 LOG(EBackup, EInfo, "Writing to ALARM_REGISTRATIONS_TABLE"); |
|
1011 |
|
1012 for (int rowNumber = 0; rowNumber < iTableSize[7]; rowNumber++) |
|
1013 { |
|
1014 attribute.setEntry(ID, iStringVector[count++]); |
|
1015 insertEntry.insert(attribute); |
|
1016 |
|
1017 attribute.setEntry(ALARM_TIME, iStringVector[count++]); |
|
1018 insertEntry.insert(attribute); |
|
1019 |
|
1020 try |
|
1021 { |
|
1022 js->write(ALARM_REGISTRATIONS_TABLE, insertEntry); |
|
1023 ILOG(EBackup, "Writing to table succeded"); |
|
1024 } |
|
1025 catch (JavaStorageException jse) |
|
1026 { |
|
1027 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
1028 js->close(); |
|
1029 return KErrGeneral; |
|
1030 } |
|
1031 insertEntry.clear(); |
|
1032 } |
|
1033 } |
|
1034 |
|
1035 |
|
1036 // table 9: runtime settings table |
|
1037 { |
|
1038 LOG(EBackup, EInfo, "Writing to RUNTIME_SETTINGS_TABLE"); |
|
1039 |
|
1040 for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++) |
|
1041 { |
|
1042 attribute.setEntry(EXTENSIONS, iStringVector[count++]); |
|
1043 insertEntry.insert(attribute); |
|
1044 |
|
1045 try |
|
1046 { |
|
1047 js->write(RUNTIME_SETTINGS_TABLE, insertEntry); |
|
1048 ILOG(EBackup, "Writing to table succeded"); |
|
1049 } |
|
1050 catch (JavaStorageException jse) |
|
1051 { |
|
1052 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
1053 js->close(); |
|
1054 return KErrGeneral; |
|
1055 } |
|
1056 insertEntry.clear(); |
|
1057 } |
|
1058 } |
|
1059 |
|
1060 // table 10: pre-install table |
|
1061 { |
|
1062 LOG(EBackup, EInfo, "Writing to PREINSTALL_TABLE"); |
|
1063 |
|
1064 for (int rowNumber = 0; rowNumber < iTableSize[9]; rowNumber++) |
|
1065 { |
|
1066 attribute.setEntry(NAME, iStringVector[count++]); |
|
1067 insertEntry.insert(attribute); |
|
1068 |
|
1069 attribute.setEntry(VENDOR, iStringVector[count++]); |
|
1070 insertEntry.insert(attribute); |
|
1071 |
|
1072 attribute.setEntry(VERSION, iStringVector[count++]); |
|
1073 insertEntry.insert(attribute); |
|
1074 |
|
1075 attribute.setEntry(INSTALL_STATE, iStringVector[count++]); |
|
1076 insertEntry.insert(attribute); |
|
1077 |
|
1078 try |
|
1079 { |
|
1080 js->write(PREINSTALL_TABLE, insertEntry); |
|
1081 ILOG(EBackup, "Writing to table succeded"); |
|
1082 } |
|
1083 catch (JavaStorageException jse) |
|
1084 { |
|
1085 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
1086 js->close(); |
|
1087 return KErrGeneral; |
|
1088 } |
|
1089 insertEntry.clear(); |
|
1090 } |
|
1091 } |
|
1092 |
|
1093 ILOG(EBackup, "Data written to JAVA_DATABASE; So Commit the transaction and close the database"); |
|
1094 ILOG(EBackup, "Committing the transaction"); |
|
1095 |
|
1096 try |
|
1097 { |
|
1098 js->commitTransaction(); |
|
1099 ILOG(EBackup, "Transaction committed successfully"); |
|
1100 } |
|
1101 catch (JavaStorageException jse) |
|
1102 { |
|
1103 ELOG1(EBackup, "Committing the transaction failed: %S", jse.toString().c_str()); |
|
1104 js->close(); |
|
1105 return KErrGeneral; |
|
1106 } |
|
1107 |
|
1108 ILOG(EBackup, "Close the database"); |
|
1109 |
|
1110 // close the JAVA_DATABASE |
|
1111 js->close(); |
|
1112 |
|
1113 |
|
1114 // table 11: ota status table |
|
1115 /* stored in another database called javaotadatabase. |
|
1116 so open a new connection to that database */ |
|
1117 |
|
1118 { |
|
1119 ILOG(EBackup, "Create instance of JAVA_OTA_DATABASE_NAME and open the database"); |
|
1120 auto_ptr<JavaStorage> jos(JavaStorage::createInstance()); |
|
1121 |
|
1122 try |
|
1123 { |
|
1124 jos->open(JAVA_OTA_DATABASE_NAME); |
|
1125 ILOG(EBackup, "Opening database succeded"); |
|
1126 } |
|
1127 catch (JavaStorageException jse) |
|
1128 { |
|
1129 ELOG1(EBackup, "Opening database failed: %S", jse.toString().c_str()); |
|
1130 return KErrGeneral; |
|
1131 } |
|
1132 |
|
1133 ILOG(EBackup, "Start a transaction for writing to this database"); |
|
1134 |
|
1135 try |
|
1136 { |
|
1137 jos->startTransaction(); |
|
1138 ILOG(EBackup, "Transaction started"); |
|
1139 } |
|
1140 catch (JavaStorageException jse) |
|
1141 { |
|
1142 ELOG1(EBackup, "startTransaction() failed: %S", jse.toString().c_str()); |
|
1143 jos->close(); |
|
1144 return KErrGeneral; |
|
1145 } |
|
1146 |
|
1147 ILOG(EBackup, "Before writing data to this database, existing data must be cleared"); |
|
1148 |
|
1149 try |
|
1150 { |
|
1151 JavaStorageApplicationEntry_t emptyEntry; |
|
1152 jos->remove(OTA_STATUS_TABLE, emptyEntry); |
|
1153 } |
|
1154 catch (JavaStorageException jse) |
|
1155 { |
|
1156 ELOG1(EBackup, "Removing data from OTA database failed: %S", jse.toString().c_str()); |
|
1157 jos->close(); |
|
1158 return KErrGeneral; |
|
1159 } |
|
1160 |
|
1161 LOG(EBackup, EInfo, "Writing to OTA_STATUS_TABLE"); |
|
1162 |
|
1163 for (int rowNumber = 0; rowNumber < iTableSize[10]; rowNumber++) |
|
1164 { |
|
1165 attribute.setEntry(ID, iStringVector[count++]); |
|
1166 insertEntry.insert(attribute); |
|
1167 |
|
1168 attribute.setEntry(CREATION_TIME, iStringVector[count++]); |
|
1169 insertEntry.insert(attribute); |
|
1170 |
|
1171 attribute.setEntry(TYPE, iStringVector[count++]); |
|
1172 insertEntry.insert(attribute); |
|
1173 |
|
1174 attribute.setEntry(OTA_CODE, iStringVector[count++]); |
|
1175 insertEntry.insert(attribute); |
|
1176 |
|
1177 attribute.setEntry(URL, iStringVector[count++]); |
|
1178 insertEntry.insert(attribute); |
|
1179 |
|
1180 attribute.setEntry(LATEST_RETRY_TIME, iStringVector[count++]); |
|
1181 insertEntry.insert(attribute); |
|
1182 |
|
1183 attribute.setEntry(RETRY_COUNT, iStringVector[count++]); |
|
1184 insertEntry.insert(attribute); |
|
1185 |
|
1186 try |
|
1187 { |
|
1188 jos->write(OTA_STATUS_TABLE, insertEntry); |
|
1189 LOG(EBackup, EInfo, "Writing to table succeded"); |
|
1190 } |
|
1191 catch (JavaStorageException jse) |
|
1192 { |
|
1193 ELOG1(EBackup, "Writing to table failed: %S", jse.toString().c_str()); |
|
1194 jos->close(); |
|
1195 return KErrGeneral; |
|
1196 } |
|
1197 insertEntry.clear(); |
|
1198 } |
|
1199 |
|
1200 ILOG(EBackup, "Data written to JAVA_OTA_DATABASE; commit the transaction and close the database"); |
|
1201 ILOG(EBackup, "Committing the transaction"); |
|
1202 |
|
1203 try |
|
1204 { |
|
1205 jos->commitTransaction(); |
|
1206 LOG(EBackup, EInfo, "Transaction committed successfully"); |
|
1207 } |
|
1208 catch (JavaStorageException jse) |
|
1209 { |
|
1210 ELOG1(EBackup, "Committing the transaction failed: %S", jse.toString().c_str()); |
|
1211 jos->close(); |
|
1212 return KErrGeneral; |
|
1213 } |
|
1214 |
|
1215 LOG(EBackup, EInfo, "Close the database"); |
|
1216 |
|
1217 // close the OTA_DATABASE |
|
1218 jos->close(); |
|
1219 } |
|
1220 |
|
1221 LOG(EBackup, EInfo, "Data written to Storage"); |
|
1222 return KErrNone; |
|
1223 } |
|
1224 |
|
1225 |
|
1226 int CStorageBackupUtil::FillVectorwithAppPackageTableData(JavaStorageApplicationList_t& foundEntries) |
|
1227 { |
|
1228 const wstring emptyString; |
|
1229 wstring str; |
|
1230 |
|
1231 JavaStorageEntry attribute; |
|
1232 |
|
1233 /* Initialise Iterators to iterate through all applications |
|
1234 matched with search patterns. */ |
|
1235 JavaStorageApplicationList_t::const_iterator applications; |
|
1236 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1237 |
|
1238 int rowsCount=0; |
|
1239 for (applications = foundEntries.begin(); applications != foundEntries.end(); applications++) |
|
1240 { |
|
1241 attribute.setEntry(ID, L""); |
|
1242 str = emptyString; |
|
1243 findIterator = (*applications).find(attribute); |
|
1244 |
|
1245 if (findIterator != (*applications).end()) |
|
1246 { |
|
1247 str = (*findIterator).entryValue(); |
|
1248 } |
|
1249 iStringVector.push_back(str); |
|
1250 |
|
1251 attribute.setEntry(PACKAGE_NAME, L""); |
|
1252 str = emptyString; |
|
1253 findIterator = (*applications).find(attribute); |
|
1254 |
|
1255 if (findIterator != (*applications).end()) |
|
1256 { |
|
1257 str = (*findIterator).entryValue(); |
|
1258 } |
|
1259 iStringVector.push_back(str); |
|
1260 |
|
1261 attribute.setEntry(VENDOR, L""); |
|
1262 str = emptyString; |
|
1263 findIterator = (*applications).find(attribute); |
|
1264 |
|
1265 if (findIterator != (*applications).end()) |
|
1266 { |
|
1267 str = (*findIterator).entryValue(); |
|
1268 } |
|
1269 iStringVector.push_back(str); |
|
1270 |
|
1271 attribute.setEntry(VERSION, L""); |
|
1272 str = emptyString; |
|
1273 findIterator = (*applications).find(attribute); |
|
1274 |
|
1275 if (findIterator != (*applications).end()) |
|
1276 { |
|
1277 str = (*findIterator).entryValue(); |
|
1278 } |
|
1279 iStringVector.push_back(str); |
|
1280 |
|
1281 attribute.setEntry(ROOT_PATH, L""); |
|
1282 str = emptyString; |
|
1283 findIterator = (*applications).find(attribute); |
|
1284 |
|
1285 if (findIterator != (*applications).end()) |
|
1286 { |
|
1287 str = (*findIterator).entryValue(); |
|
1288 } |
|
1289 iStringVector.push_back(str); |
|
1290 |
|
1291 attribute.setEntry(MEDIA_ID, L""); |
|
1292 str = emptyString; |
|
1293 findIterator = (*applications).find(attribute); |
|
1294 |
|
1295 if (findIterator != (*applications).end()) |
|
1296 { |
|
1297 str = (*findIterator).entryValue(); |
|
1298 } |
|
1299 iStringVector.push_back(str); |
|
1300 |
|
1301 attribute.setEntry(INITIAL_SIZE, L""); |
|
1302 str = emptyString; |
|
1303 findIterator = (*applications).find(attribute); |
|
1304 |
|
1305 if (findIterator != (*applications).end()) |
|
1306 { |
|
1307 str = (*findIterator).entryValue(); |
|
1308 } |
|
1309 iStringVector.push_back(str); |
|
1310 |
|
1311 attribute.setEntry(JAD_PATH, L""); |
|
1312 str = emptyString; |
|
1313 findIterator = (*applications).find(attribute); |
|
1314 |
|
1315 if (findIterator != (*applications).end()) |
|
1316 { |
|
1317 str = (*findIterator).entryValue(); |
|
1318 } |
|
1319 iStringVector.push_back(str); |
|
1320 |
|
1321 attribute.setEntry(JAR_PATH, L""); |
|
1322 str = emptyString; |
|
1323 findIterator = (*applications).find(attribute); |
|
1324 |
|
1325 if (findIterator != (*applications).end()) |
|
1326 { |
|
1327 str = (*findIterator).entryValue(); |
|
1328 } |
|
1329 iStringVector.push_back(str); |
|
1330 |
|
1331 attribute.setEntry(JAD_URL, L""); |
|
1332 str = emptyString; |
|
1333 findIterator = (*applications).find(attribute); |
|
1334 |
|
1335 if (findIterator != (*applications).end()) |
|
1336 { |
|
1337 str = (*findIterator).entryValue(); |
|
1338 } |
|
1339 iStringVector.push_back(str); |
|
1340 |
|
1341 attribute.setEntry(JAR_URL, L""); |
|
1342 str = emptyString; |
|
1343 findIterator = (*applications).find(attribute); |
|
1344 |
|
1345 if (findIterator != (*applications).end()) |
|
1346 { |
|
1347 str = (*findIterator).entryValue(); |
|
1348 } |
|
1349 iStringVector.push_back(str); |
|
1350 |
|
1351 attribute.setEntry(ACCESS_POINT, L""); |
|
1352 str = emptyString; |
|
1353 findIterator = (*applications).find(attribute); |
|
1354 |
|
1355 if (findIterator != (*applications).end()) |
|
1356 { |
|
1357 str = (*findIterator).entryValue(); |
|
1358 } |
|
1359 iStringVector.push_back(str); |
|
1360 |
|
1361 attribute.setEntry(CONTENT_INFO, L""); |
|
1362 str = emptyString; |
|
1363 findIterator = (*applications).find(attribute); |
|
1364 |
|
1365 if (findIterator != (*applications).end()) |
|
1366 { |
|
1367 str = (*findIterator).entryValue(); |
|
1368 } |
|
1369 iStringVector.push_back(str); |
|
1370 |
|
1371 attribute.setEntry(CONTENT_ID, L""); |
|
1372 str = emptyString; |
|
1373 findIterator = (*applications).find(attribute); |
|
1374 |
|
1375 if (findIterator != (*applications).end()) |
|
1376 { |
|
1377 str = (*findIterator).entryValue(); |
|
1378 } |
|
1379 iStringVector.push_back(str); |
|
1380 |
|
1381 rowsCount++; |
|
1382 } |
|
1383 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1384 return rowsCount; |
|
1385 } |
|
1386 |
|
1387 int CStorageBackupUtil::FillVectorwithAppTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1388 { |
|
1389 const wstring emptyString; |
|
1390 wstring str; |
|
1391 |
|
1392 JavaStorageEntry attribute; |
|
1393 |
|
1394 /* Initialise Iterators to iterate through all applications |
|
1395 matched with search patterns. */ |
|
1396 JavaStorageApplicationList_t::const_iterator applications; |
|
1397 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1398 |
|
1399 int rowsCount=0; |
|
1400 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1401 { |
|
1402 attribute.setEntry(ID, L""); |
|
1403 str = emptyString; |
|
1404 findIterator = (*applications).find(attribute); |
|
1405 |
|
1406 if (findIterator != (*applications).end()) |
|
1407 { |
|
1408 str = (*findIterator).entryValue(); |
|
1409 } |
|
1410 iStringVector.push_back(str); |
|
1411 |
|
1412 attribute.setEntry(PACKAGE_ID, L""); |
|
1413 str = emptyString; |
|
1414 findIterator = (*applications).find(attribute); |
|
1415 |
|
1416 if (findIterator != (*applications).end()) |
|
1417 { |
|
1418 str = (*findIterator).entryValue(); |
|
1419 } |
|
1420 iStringVector.push_back(str); |
|
1421 |
|
1422 attribute.setEntry(NAME, L""); |
|
1423 str = emptyString; |
|
1424 findIterator = (*applications).find(attribute); |
|
1425 |
|
1426 if (findIterator != (*applications).end()) |
|
1427 { |
|
1428 str = (*findIterator).entryValue(); |
|
1429 } |
|
1430 iStringVector.push_back(str); |
|
1431 |
|
1432 attribute.setEntry(MAIN_CLASS, L""); |
|
1433 str = emptyString; |
|
1434 findIterator = (*applications).find(attribute); |
|
1435 |
|
1436 if (findIterator != (*applications).end()) |
|
1437 { |
|
1438 str = (*findIterator).entryValue(); |
|
1439 } |
|
1440 iStringVector.push_back(str); |
|
1441 |
|
1442 attribute.setEntry(AUTORUN, L""); |
|
1443 str = emptyString; |
|
1444 findIterator = (*applications).find(attribute); |
|
1445 |
|
1446 if (findIterator != (*applications).end()) |
|
1447 { |
|
1448 str = (*findIterator).entryValue(); |
|
1449 } |
|
1450 iStringVector.push_back(str); |
|
1451 |
|
1452 rowsCount++; |
|
1453 } |
|
1454 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1455 return rowsCount; |
|
1456 } |
|
1457 |
|
1458 int CStorageBackupUtil::FillVectorwithAppPackageAttTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1459 { |
|
1460 const wstring emptyString; |
|
1461 wstring str; |
|
1462 |
|
1463 JavaStorageEntry attribute; |
|
1464 |
|
1465 /* Initialise Iterators to iterate through all applications |
|
1466 matched with search patterns. */ |
|
1467 JavaStorageApplicationList_t::const_iterator applications; |
|
1468 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1469 |
|
1470 int rowsCount=0; |
|
1471 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1472 { |
|
1473 attribute.setEntry(ID, L""); |
|
1474 str = emptyString; |
|
1475 findIterator = (*applications).find(attribute); |
|
1476 |
|
1477 if (findIterator != (*applications).end()) |
|
1478 { |
|
1479 str = (*findIterator).entryValue(); |
|
1480 } |
|
1481 iStringVector.push_back(str); |
|
1482 |
|
1483 attribute.setEntry(NAME, L""); |
|
1484 str = emptyString; |
|
1485 findIterator = (*applications).find(attribute); |
|
1486 |
|
1487 if (findIterator != (*applications).end()) |
|
1488 { |
|
1489 str = (*findIterator).entryValue(); |
|
1490 } |
|
1491 iStringVector.push_back(str); |
|
1492 |
|
1493 attribute.setEntry(VALUE, L""); |
|
1494 str = emptyString; |
|
1495 findIterator = (*applications).find(attribute); |
|
1496 |
|
1497 if (findIterator != (*applications).end()) |
|
1498 { |
|
1499 str = (*findIterator).entryValue(); |
|
1500 } |
|
1501 iStringVector.push_back(str); |
|
1502 |
|
1503 attribute.setEntry(TRUSTED, L""); |
|
1504 str = emptyString; |
|
1505 findIterator = (*applications).find(attribute); |
|
1506 |
|
1507 if (findIterator != (*applications).end()) |
|
1508 { |
|
1509 str = (*findIterator).entryValue(); |
|
1510 } |
|
1511 iStringVector.push_back(str); |
|
1512 |
|
1513 rowsCount++; |
|
1514 } |
|
1515 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1516 return rowsCount; |
|
1517 } |
|
1518 |
|
1519 int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1520 { |
|
1521 const wstring emptyString; |
|
1522 wstring str; |
|
1523 |
|
1524 JavaStorageEntry attribute; |
|
1525 |
|
1526 /* Initialise Iterators to iterate through all applications |
|
1527 matched with search patterns. */ |
|
1528 JavaStorageApplicationList_t::const_iterator applications; |
|
1529 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1530 |
|
1531 int rowsCount=0; |
|
1532 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1533 { |
|
1534 attribute.setEntry(ID, L""); |
|
1535 str = emptyString; |
|
1536 findIterator = (*applications).find(attribute); |
|
1537 |
|
1538 if (findIterator != (*applications).end()) |
|
1539 { |
|
1540 str = (*findIterator).entryValue(); |
|
1541 } |
|
1542 iStringVector.push_back(str); |
|
1543 |
|
1544 attribute.setEntry(TYPE, L""); |
|
1545 str = emptyString; |
|
1546 findIterator = (*applications).find(attribute); |
|
1547 |
|
1548 if (findIterator != (*applications).end()) |
|
1549 { |
|
1550 str = (*findIterator).entryValue(); |
|
1551 } |
|
1552 iStringVector.push_back(str); |
|
1553 |
|
1554 attribute.setEntry(SECURITY_DOMAIN, L""); |
|
1555 str = emptyString; |
|
1556 findIterator = (*applications).find(attribute); |
|
1557 |
|
1558 if (findIterator != (*applications).end()) |
|
1559 { |
|
1560 str = (*findIterator).entryValue(); |
|
1561 } |
|
1562 iStringVector.push_back(str); |
|
1563 |
|
1564 attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L""); |
|
1565 str = emptyString; |
|
1566 findIterator = (*applications).find(attribute); |
|
1567 |
|
1568 if (findIterator != (*applications).end()) |
|
1569 { |
|
1570 str = (*findIterator).entryValue(); |
|
1571 } |
|
1572 iStringVector.push_back(str); |
|
1573 |
|
1574 attribute.setEntry(HASH, L""); |
|
1575 str = emptyString; |
|
1576 findIterator = (*applications).find(attribute); |
|
1577 |
|
1578 if (findIterator != (*applications).end()) |
|
1579 { |
|
1580 str = (*findIterator).entryValue(); |
|
1581 } |
|
1582 iStringVector.push_back(str); |
|
1583 |
|
1584 attribute.setEntry(CERT_HASH, L""); |
|
1585 str = emptyString; |
|
1586 findIterator = (*applications).find(attribute); |
|
1587 |
|
1588 if (findIterator != (*applications).end()) |
|
1589 { |
|
1590 str = (*findIterator).entryValue(); |
|
1591 } |
|
1592 iStringVector.push_back(str); |
|
1593 |
|
1594 attribute.setEntry(RMS, L""); |
|
1595 str = emptyString; |
|
1596 findIterator = (*applications).find(attribute); |
|
1597 |
|
1598 if (findIterator != (*applications).end()) |
|
1599 { |
|
1600 str = (*findIterator).entryValue(); |
|
1601 } |
|
1602 iStringVector.push_back(str); |
|
1603 |
|
1604 attribute.setEntry(VALID_CERTS, L""); |
|
1605 str = emptyString; |
|
1606 findIterator = (*applications).find(attribute); |
|
1607 |
|
1608 if (findIterator != (*applications).end()) |
|
1609 { |
|
1610 str = (*findIterator).entryValue(); |
|
1611 } |
|
1612 iStringVector.push_back(str); |
|
1613 |
|
1614 attribute.setEntry(ON_SCREEN_KEYPAD, L""); |
|
1615 str = emptyString; |
|
1616 findIterator = (*applications).find(attribute); |
|
1617 |
|
1618 if (findIterator != (*applications).end()) |
|
1619 { |
|
1620 str = (*findIterator).entryValue(); |
|
1621 } |
|
1622 iStringVector.push_back(str); |
|
1623 |
|
1624 rowsCount++; |
|
1625 } |
|
1626 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1627 return rowsCount; |
|
1628 } |
|
1629 |
|
1630 int CStorageBackupUtil::FillVectorwithMidpPermTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1631 { |
|
1632 const wstring emptyString; |
|
1633 wstring str; |
|
1634 |
|
1635 JavaStorageEntry attribute; |
|
1636 |
|
1637 /* Initialise Iterators to iterate through all applications |
|
1638 matched with search patterns. */ |
|
1639 JavaStorageApplicationList_t::const_iterator applications; |
|
1640 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1641 |
|
1642 int rowsCount=0; |
|
1643 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1644 { |
|
1645 attribute.setEntry(ID, L""); |
|
1646 str = emptyString; |
|
1647 findIterator = (*applications).find(attribute); |
|
1648 |
|
1649 if (findIterator != (*applications).end()) |
|
1650 { |
|
1651 str = (*findIterator).entryValue(); |
|
1652 } |
|
1653 iStringVector.push_back(str); |
|
1654 |
|
1655 attribute.setEntry(CLASS, L""); |
|
1656 str = emptyString; |
|
1657 findIterator = (*applications).find(attribute); |
|
1658 |
|
1659 if (findIterator != (*applications).end()) |
|
1660 { |
|
1661 str = (*findIterator).entryValue(); |
|
1662 } |
|
1663 iStringVector.push_back(str); |
|
1664 |
|
1665 attribute.setEntry(NAME, L""); |
|
1666 str = emptyString; |
|
1667 findIterator = (*applications).find(attribute); |
|
1668 |
|
1669 if (findIterator != (*applications).end()) |
|
1670 { |
|
1671 str = (*findIterator).entryValue(); |
|
1672 } |
|
1673 iStringVector.push_back(str); |
|
1674 |
|
1675 attribute.setEntry(ACTION, L""); |
|
1676 str = emptyString; |
|
1677 findIterator = (*applications).find(attribute); |
|
1678 |
|
1679 if (findIterator != (*applications).end()) |
|
1680 { |
|
1681 str = (*findIterator).entryValue(); |
|
1682 } |
|
1683 iStringVector.push_back(str); |
|
1684 |
|
1685 attribute.setEntry(FUNCTION_GROUP, L""); |
|
1686 str = emptyString; |
|
1687 findIterator = (*applications).find(attribute); |
|
1688 |
|
1689 if (findIterator != (*applications).end()) |
|
1690 { |
|
1691 str = (*findIterator).entryValue(); |
|
1692 } |
|
1693 iStringVector.push_back(str); |
|
1694 |
|
1695 rowsCount++; |
|
1696 } |
|
1697 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1698 return rowsCount; |
|
1699 } |
|
1700 |
|
1701 int CStorageBackupUtil::FillVectorwithMidpFuncGrpSetTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1702 { |
|
1703 const wstring emptyString; |
|
1704 wstring str; |
|
1705 |
|
1706 JavaStorageEntry attribute; |
|
1707 |
|
1708 /* Initialise Iterators to iterate through all applications |
|
1709 matched with search patterns. */ |
|
1710 JavaStorageApplicationList_t::const_iterator applications; |
|
1711 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1712 |
|
1713 int rowsCount=0; |
|
1714 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1715 { |
|
1716 attribute.setEntry(ID, L""); |
|
1717 str = emptyString; |
|
1718 findIterator = (*applications).find(attribute); |
|
1719 |
|
1720 if (findIterator != (*applications).end()) |
|
1721 { |
|
1722 str = (*findIterator).entryValue(); |
|
1723 } |
|
1724 iStringVector.push_back(str); |
|
1725 |
|
1726 attribute.setEntry(FUNCTION_GROUP, L""); |
|
1727 str = emptyString; |
|
1728 findIterator = (*applications).find(attribute); |
|
1729 |
|
1730 if (findIterator != (*applications).end()) |
|
1731 { |
|
1732 str = (*findIterator).entryValue(); |
|
1733 } |
|
1734 iStringVector.push_back(str); |
|
1735 |
|
1736 attribute.setEntry(ALLOWED_SETTINGS, L""); |
|
1737 str = emptyString; |
|
1738 findIterator = (*applications).find(attribute); |
|
1739 |
|
1740 if (findIterator != (*applications).end()) |
|
1741 { |
|
1742 str = (*findIterator).entryValue(); |
|
1743 } |
|
1744 iStringVector.push_back(str); |
|
1745 |
|
1746 attribute.setEntry(CURRENT_SETTING, L""); |
|
1747 str = emptyString; |
|
1748 findIterator = (*applications).find(attribute); |
|
1749 |
|
1750 if (findIterator != (*applications).end()) |
|
1751 { |
|
1752 str = (*findIterator).entryValue(); |
|
1753 } |
|
1754 iStringVector.push_back(str); |
|
1755 |
|
1756 attribute.setEntry(BLANKET_PROMPT, L""); |
|
1757 str = emptyString; |
|
1758 findIterator = (*applications).find(attribute); |
|
1759 |
|
1760 if (findIterator != (*applications).end()) |
|
1761 { |
|
1762 str = (*findIterator).entryValue(); |
|
1763 } |
|
1764 iStringVector.push_back(str); |
|
1765 |
|
1766 rowsCount++; |
|
1767 } |
|
1768 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1769 return rowsCount; |
|
1770 } |
|
1771 |
|
1772 int CStorageBackupUtil::FillVectorwithPushRegTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1773 { |
|
1774 const wstring emptyString; |
|
1775 wstring str; |
|
1776 |
|
1777 JavaStorageEntry attribute; |
|
1778 |
|
1779 /* Initialise Iterators to iterate through all applications |
|
1780 matched with search patterns. */ |
|
1781 JavaStorageApplicationList_t::const_iterator applications; |
|
1782 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1783 |
|
1784 int rowsCount=0; |
|
1785 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1786 { |
|
1787 attribute.setEntry(ID, L""); |
|
1788 str = emptyString; |
|
1789 findIterator = (*applications).find(attribute); |
|
1790 |
|
1791 if (findIterator != (*applications).end()) |
|
1792 { |
|
1793 str = (*findIterator).entryValue(); |
|
1794 } |
|
1795 iStringVector.push_back(str); |
|
1796 |
|
1797 attribute.setEntry(URL, L""); |
|
1798 str = emptyString; |
|
1799 findIterator = (*applications).find(attribute); |
|
1800 |
|
1801 if (findIterator != (*applications).end()) |
|
1802 { |
|
1803 str = (*findIterator).entryValue(); |
|
1804 } |
|
1805 iStringVector.push_back(str); |
|
1806 |
|
1807 attribute.setEntry(NAME, L""); |
|
1808 str = emptyString; |
|
1809 findIterator = (*applications).find(attribute); |
|
1810 |
|
1811 if (findIterator != (*applications).end()) |
|
1812 { |
|
1813 str = (*findIterator).entryValue(); |
|
1814 } |
|
1815 iStringVector.push_back(str); |
|
1816 |
|
1817 attribute.setEntry(FILTER, L""); |
|
1818 str = emptyString; |
|
1819 findIterator = (*applications).find(attribute); |
|
1820 |
|
1821 if (findIterator != (*applications).end()) |
|
1822 { |
|
1823 str = (*findIterator).entryValue(); |
|
1824 } |
|
1825 iStringVector.push_back(str); |
|
1826 |
|
1827 attribute.setEntry(REGISTRATION_TYPE, L""); |
|
1828 str = emptyString; |
|
1829 findIterator = (*applications).find(attribute); |
|
1830 |
|
1831 if (findIterator != (*applications).end()) |
|
1832 { |
|
1833 str = (*findIterator).entryValue(); |
|
1834 } |
|
1835 iStringVector.push_back(str); |
|
1836 |
|
1837 rowsCount++; |
|
1838 } |
|
1839 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1840 return rowsCount; |
|
1841 } |
|
1842 |
|
1843 int CStorageBackupUtil::FillVectorwithAlarmRegTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1844 { |
|
1845 const wstring emptyString; |
|
1846 wstring str; |
|
1847 |
|
1848 JavaStorageEntry attribute; |
|
1849 |
|
1850 /* Initialise Iterators to iterate through all applications |
|
1851 matched with search patterns. */ |
|
1852 JavaStorageApplicationList_t::const_iterator applications; |
|
1853 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1854 |
|
1855 int rowsCount=0; |
|
1856 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1857 { |
|
1858 attribute.setEntry(ID, L""); |
|
1859 str = emptyString; |
|
1860 findIterator = (*applications).find(attribute); |
|
1861 |
|
1862 if (findIterator != (*applications).end()) |
|
1863 { |
|
1864 str = (*findIterator).entryValue(); |
|
1865 } |
|
1866 iStringVector.push_back(str); |
|
1867 |
|
1868 attribute.setEntry(ALARM_TIME, L""); |
|
1869 str = emptyString; |
|
1870 findIterator = (*applications).find(attribute); |
|
1871 |
|
1872 if (findIterator != (*applications).end()) |
|
1873 { |
|
1874 str = (*findIterator).entryValue(); |
|
1875 } |
|
1876 iStringVector.push_back(str); |
|
1877 |
|
1878 rowsCount++; |
|
1879 } |
|
1880 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1881 return rowsCount; |
|
1882 } |
|
1883 |
|
1884 int CStorageBackupUtil::FillVectorwithRuntimeSetTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1885 { |
|
1886 const wstring emptyString; |
|
1887 wstring str; |
|
1888 |
|
1889 JavaStorageEntry attribute; |
|
1890 |
|
1891 /* Initialise Iterators to iterate through all applications |
|
1892 matched with search patterns. */ |
|
1893 JavaStorageApplicationList_t::const_iterator applications; |
|
1894 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1895 |
|
1896 int rowsCount=0; |
|
1897 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1898 { |
|
1899 attribute.setEntry(EXTENSIONS, L""); |
|
1900 str = emptyString; |
|
1901 findIterator = (*applications).find(attribute); |
|
1902 |
|
1903 if (findIterator != (*applications).end()) |
|
1904 { |
|
1905 str = (*findIterator).entryValue(); |
|
1906 } |
|
1907 iStringVector.push_back(str); |
|
1908 |
|
1909 rowsCount++; |
|
1910 } |
|
1911 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1912 return rowsCount; |
|
1913 } |
|
1914 |
|
1915 int CStorageBackupUtil::FillVectorwithPreinstallTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1916 { |
|
1917 const wstring emptyString; |
|
1918 wstring str; |
|
1919 |
|
1920 JavaStorageEntry attribute; |
|
1921 |
|
1922 /* Initialise Iterators to iterate through all applications |
|
1923 matched with search patterns. */ |
|
1924 JavaStorageApplicationList_t::const_iterator applications; |
|
1925 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1926 |
|
1927 int rowsCount=0; |
|
1928 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1929 { |
|
1930 attribute.setEntry(NAME, L""); |
|
1931 str = emptyString; |
|
1932 findIterator = (*applications).find(attribute); |
|
1933 |
|
1934 if (findIterator != (*applications).end()) |
|
1935 { |
|
1936 str = (*findIterator).entryValue(); |
|
1937 } |
|
1938 iStringVector.push_back(str); |
|
1939 |
|
1940 attribute.setEntry(VENDOR, L""); |
|
1941 str = emptyString; |
|
1942 findIterator = (*applications).find(attribute); |
|
1943 |
|
1944 if (findIterator != (*applications).end()) |
|
1945 { |
|
1946 str = (*findIterator).entryValue(); |
|
1947 } |
|
1948 iStringVector.push_back(str); |
|
1949 |
|
1950 attribute.setEntry(VERSION, L""); |
|
1951 str = emptyString; |
|
1952 findIterator = (*applications).find(attribute); |
|
1953 |
|
1954 if (findIterator != (*applications).end()) |
|
1955 { |
|
1956 str = (*findIterator).entryValue(); |
|
1957 } |
|
1958 iStringVector.push_back(str); |
|
1959 |
|
1960 attribute.setEntry(INSTALL_STATE, L""); |
|
1961 str = emptyString; |
|
1962 findIterator = (*applications).find(attribute); |
|
1963 |
|
1964 if (findIterator != (*applications).end()) |
|
1965 { |
|
1966 str = (*findIterator).entryValue(); |
|
1967 } |
|
1968 iStringVector.push_back(str); |
|
1969 |
|
1970 rowsCount++; |
|
1971 } |
|
1972 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
1973 return rowsCount; |
|
1974 } |
|
1975 |
|
1976 int CStorageBackupUtil::FillVectorwithOtaStatusTableData(JavaStorageApplicationList_t& afoundEntries) |
|
1977 { |
|
1978 const wstring emptyString; |
|
1979 wstring str; |
|
1980 |
|
1981 JavaStorageEntry attribute; |
|
1982 |
|
1983 /* Initialise Iterators to iterate through all applications |
|
1984 matched with search patterns. */ |
|
1985 JavaStorageApplicationList_t::const_iterator applications; |
|
1986 JavaStorageApplicationEntry_t::const_iterator findIterator; |
|
1987 |
|
1988 int rowsCount=0; |
|
1989 for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++) |
|
1990 { |
|
1991 attribute.setEntry(ID, L""); |
|
1992 str = emptyString; |
|
1993 findIterator = (*applications).find(attribute); |
|
1994 |
|
1995 if (findIterator != (*applications).end()) |
|
1996 { |
|
1997 str = (*findIterator).entryValue(); |
|
1998 } |
|
1999 iStringVector.push_back(str); |
|
2000 |
|
2001 attribute.setEntry(CREATION_TIME, L""); |
|
2002 str = emptyString; |
|
2003 findIterator = (*applications).find(attribute); |
|
2004 |
|
2005 if (findIterator != (*applications).end()) |
|
2006 { |
|
2007 str = (*findIterator).entryValue(); |
|
2008 } |
|
2009 iStringVector.push_back(str); |
|
2010 |
|
2011 attribute.setEntry(TYPE, L""); |
|
2012 str = emptyString; |
|
2013 findIterator = (*applications).find(attribute); |
|
2014 |
|
2015 if (findIterator != (*applications).end()) |
|
2016 { |
|
2017 str = (*findIterator).entryValue(); |
|
2018 } |
|
2019 iStringVector.push_back(str); |
|
2020 |
|
2021 attribute.setEntry(OTA_CODE, L""); |
|
2022 str = emptyString; |
|
2023 findIterator = (*applications).find(attribute); |
|
2024 |
|
2025 if (findIterator != (*applications).end()) |
|
2026 { |
|
2027 str = (*findIterator).entryValue(); |
|
2028 } |
|
2029 iStringVector.push_back(str); |
|
2030 |
|
2031 attribute.setEntry(URL, L""); |
|
2032 str = emptyString; |
|
2033 findIterator = (*applications).find(attribute); |
|
2034 |
|
2035 if (findIterator != (*applications).end()) |
|
2036 { |
|
2037 str = (*findIterator).entryValue(); |
|
2038 } |
|
2039 iStringVector.push_back(str); |
|
2040 |
|
2041 attribute.setEntry(LATEST_RETRY_TIME, L""); |
|
2042 str = emptyString; |
|
2043 findIterator = (*applications).find(attribute); |
|
2044 |
|
2045 if (findIterator != (*applications).end()) |
|
2046 { |
|
2047 str = (*findIterator).entryValue(); |
|
2048 } |
|
2049 iStringVector.push_back(str); |
|
2050 |
|
2051 attribute.setEntry(RETRY_COUNT, L""); |
|
2052 str = emptyString; |
|
2053 findIterator = (*applications).find(attribute); |
|
2054 |
|
2055 if (findIterator != (*applications).end()) |
|
2056 { |
|
2057 str = (*findIterator).entryValue(); |
|
2058 } |
|
2059 iStringVector.push_back(str); |
|
2060 |
|
2061 rowsCount++; |
|
2062 } |
|
2063 ILOG1(EBackup, "for loop crossed with i = %d", rowsCount); |
|
2064 return rowsCount; |
|
2065 } |
|
2066 |