javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp
branchRCL_3
changeset 77 7cee158cb8cd
parent 60 6c158198356e
child 83 26b2b12093af
equal deleted inserted replaced
71:d5e927d5853b 77:7cee158cb8cd
    37 
    37 
    38 using namespace std;
    38 using namespace std;
    39 using namespace java::storage;
    39 using namespace java::storage;
    40 using namespace java::backup;
    40 using namespace java::backup;
    41 
    41 
       
    42 const wchar_t * const JBNULLSTRING = L"ABBAABBA_NULL";
       
    43 const int JBNULLSTRINGLENGTH = -1;
       
    44 
    42 // ======== MEMBER FUNCTIONS ========
    45 // ======== MEMBER FUNCTIONS ========
    43 
    46 
    44 CStorageBackupUtil::CStorageBackupUtil()
    47 CStorageBackupUtil::CStorageBackupUtil()
    45 {
    48 {
    46     LOG(EBackup, EInfo, "CStorageBackupUtil constructor");
    49     LOG(EBackup, EInfo, "CStorageBackupUtil constructor");
    80 {
    83 {
    81     LOG(EBackup, EInfo, "CStorageBackupUtil Destructor");
    84     LOG(EBackup, EInfo, "CStorageBackupUtil Destructor");
    82 
    85 
    83     // clear the vectors to free all the heap data.
    86     // clear the vectors to free all the heap data.
    84     iStringVector.clear();
    87     iStringVector.clear();
       
    88     if (iBufForJavaStorageItemsPtr)
       
    89     {
       
    90         delete iBufForJavaStorageItemsPtr;
       
    91         iBufForJavaStorageItemsPtr = 0;
       
    92     }
       
    93 
    85 }
    94 }
    86 
    95 
    87 
    96 
    88 void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft)
    97 void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft)
    89 {
    98 {
    90     LOG(EBackup, EInfo, "CStorageBackupUtil::BackupStorageDataL");
    99     ILOG(EBackup, "CStorageBackupUtil::BackupStorageDataL()");
    91 
   100 
    92     iBufferSpaceLeft = aBufferSpaceLeft;
   101     iBufferSpaceLeft = aBufferSpaceLeft;
    93 
   102 
    94     if (iFirstCalltoBackupStorageData)
   103     if (iFirstCalltoBackupStorageData)
    95     {
   104     {
       
   105         ILOG(EBackup, "First call to BackupStorageData()");
    96         int err = FillVectorWithStorageData();
   106         int err = FillVectorWithStorageData();
    97 
   107 
    98         if (err != KErrNone)
   108         if (err != KErrNone)
    99         {
   109         {
       
   110             ELOG1(EBackup, "Error (%d) in filling wstring vector", err);
   100             User::Leave(err);
   111             User::Leave(err);
   101         }
   112         }
   102         LOG1(EBackup, EInfo, "Total no of rows in vector: %d", iStringVector.size());
   113         ILOG1(EBackup, "Total no of rows in vector: %d", iStringVector.size());
   103 
   114 
   104         // First write the total no of rows in the vector to the stream
   115         // 1. Find out the size of the buffer needed for containing JavaStorage
   105 
   116         //    data in "streamed" format.
   106         aStream.WriteInt32L(iStringVector.size());
   117         TUint totalStringLengthInBytes = 0;
   107         iBufferSpaceLeft -= sizeof(TInt32);
   118         for (int i = 0; i < iStringVector.size(); ++i)
   108 
   119         {
   109         /* Then write the number of rows in each table to the stream.
   120             if (iStringVector[i] == JBNULLSTRING ){
   110            This will be used while writing the data to storage. */
   121                 continue;
   111 
   122             }
   112         for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++)
   123             totalStringLengthInBytes += iStringVector[i].length()*sizeof(wchar_t);
   113         {
   124         }
   114             aStream.WriteInt16L(iTableSize[tableNumber]);
   125         ILOG1(EBackup, "Total string length calculated: %d", totalStringLengthInBytes);
   115             iBufferSpaceLeft -= sizeof(TInt16);
   126 
   116         }
   127         // Calculate the total length of the buffer.
   117 
   128         // The content of the buffer will be as follows:
       
   129 
       
   130         TUint totalBuffSize = sizeof(TInt32) + NUMBER_OF_TABLES*sizeof(TInt16)
       
   131             + iStringVector.size()*sizeof(TInt16) + totalStringLengthInBytes;
       
   132 
       
   133         // 2. Reserve the buffer with adequate space
       
   134         iBufForJavaStorageItemsPtr = HBufC8::NewL(totalBuffSize);
       
   135         ILOG1(EBackup, "javaStorage Buffer(size %d) allocated SUCCESSFULLY", totalBuffSize);
       
   136 
       
   137         // 3. Create temporary stream operator and with it write stuff to buffer
       
   138         TPtr8 buffPtr(iBufForJavaStorageItemsPtr->Des());
       
   139         RDesWriteStream buffStream(buffPtr);
       
   140         CleanupClosePushL(buffStream);
       
   141         buffStream.WriteInt32L(iStringVector.size());
       
   142         for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; ++tableNumber)
       
   143         {
       
   144             buffStream.WriteInt16L(iTableSize[tableNumber]);
       
   145         }
       
   146         ILOG(EBackup, "JavaStorage table sizes writen to buffer");
       
   147         TUint writenStringLength = 0;
       
   148         for (int i = 0; i < iStringVector.size(); ++i)
       
   149         {
       
   150             TInt16 lenOf8byteString = JBNULLSTRINGLENGTH;
       
   151             if ( iStringVector[i] == JBNULLSTRING )
       
   152             {
       
   153                 buffStream.WriteInt16L(lenOf8byteString);
       
   154                 continue;
       
   155             }
       
   156             lenOf8byteString = iStringVector[i].length()*sizeof(wchar_t);
       
   157             buffStream.WriteInt16L(lenOf8byteString);
       
   158             if (lenOf8byteString > 0 )
       
   159             {
       
   160                 HBufC* tempstring = java::util::S60CommonUtils::wstringToDes(
       
   161                     iStringVector[i].c_str());
       
   162                 if (!tempstring)
       
   163                 {
       
   164                     ELOG(EBackup, "Out of memory in JavaStorage backup(in wstring -> des conv)!");
       
   165                     User::Leave(KErrNoMemory);
       
   166                 }
       
   167                 CleanupStack::PushL(tempstring);
       
   168                 TPtrC tempStr = tempstring->Des();
       
   169                 writenStringLength += tempStr.Size();
       
   170                 buffStream.WriteL(tempStr); //length of the string will not be written
       
   171                 CleanupStack::PopAndDestroy(tempstring);
       
   172             }
       
   173         }
       
   174         ILOG1(EBackup, "Total string length writen: %d", writenStringLength);
       
   175         ILOG(EBackup, "Whole Java Storage String vector writen to streambuffer");
       
   176 
       
   177         // 4. Clear not needed resources
       
   178         iStringVector.clear();
       
   179         CleanupStack::PopAndDestroy(&buffStream);
       
   180         ILOG(EBackup, "Not needed resources cleared");
       
   181 
       
   182         // 5. Set the read pointer to the beginning of the buffer data
       
   183         //    Note that the length of the HBufC8 buffer is exact.
       
   184         iBuffReadPointer.Set(iBufForJavaStorageItemsPtr->Des());
   118         iFirstCalltoBackupStorageData = EFalse;
   185         iFirstCalltoBackupStorageData = EFalse;
   119     }
   186     }
   120 
   187 
   121     // Now write the actual string data into the stream.
   188     // 6. Start to provide data to SBE from the buffer.
   122 
   189     ILOG(EBackup, "Extracting data from buffer to SBE");
   123     while (iBufferSpaceLeft > 0 && iStrCount < iStringVector.size())
   190     ILOG1(EBackup, "Length of the data in stream buffer: %d", iBuffReadPointer.Length());
   124     {
   191     ILOG1(EBackup, "Space available in SBE buffer: %d", aBufferSpaceLeft);
   125         WriteStringtoStreamL(aStream, iStringVector[iStrCount]);
   192     if (iBuffReadPointer.Length() <= aBufferSpaceLeft )
   126         LOG1(EBackup, EInfo, "StrCount = %d", iStrCount);
   193     {
   127     }
   194         aStream.WriteL(iBuffReadPointer);
   128 
   195         aBufferSpaceLeft -= iBuffReadPointer.Length();
   129     if (iStrCount >= iStringVector.size())
   196         iBuffReadPointer.Set(NULL,0);
   130     {
   197         delete iBufForJavaStorageItemsPtr;
   131         LOG(EBackup, EInfo, "Backup of storage data finished");
   198         iBufForJavaStorageItemsPtr = 0;
   132         aBackupNotFinished = EFalse;
   199         ILOG(EBackup, "BACKUP OF STORAGE DATA FINISHED");
       
   200         aBackupNotFinished = EFalse; // Indicate to caller that we are ready
       
   201     }
       
   202     else // All data from internal buffer does not fit at once to buffer received from SBE
       
   203     {
       
   204         aStream.WriteL(iBuffReadPointer, aBufferSpaceLeft);
       
   205         TInt lengthOfWritenData = aBufferSpaceLeft;
       
   206         iBuffReadPointer.Set(iBuffReadPointer.Ptr() + lengthOfWritenData,
       
   207                                        iBuffReadPointer.Length() - lengthOfWritenData);
       
   208         aBufferSpaceLeft = 0;
       
   209         ILOG(EBackup, "Not all of the storage data fit into SBE buffer, new buffer from SBE needed.");
   133     }
   210     }
   134 }
   211 }
   135 
   212 
   136 void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft)
   213 void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft)
   137 {
   214 {
   138     LOG(EBackup, EInfo, "CStorageBackupUtil::RestoreStorageDataL()");
   215     ILOG(EBackup, "+CStorageBackupUtil::RestoreStorageDataL()");
   139 
   216 
   140     iBufferSpaceLeft = aBufferSpaceLeft;
   217     iBufferSpaceLeft = aBufferSpaceLeft;
   141 
   218 
   142     if (iFirstCalltoRestoreStorageData)
   219     if (iFirstCalltoRestoreStorageData)
   143     {
   220     {
   175         // ensure that storage contains correct removable media ids
   252         // ensure that storage contains correct removable media ids
   176         MediaIdUpdater updater;
   253         MediaIdUpdater updater;
   177         updater.update();
   254         updater.update();
   178 
   255 
   179         // Storage restore is over; Set state to EAppArc
   256         // Storage restore is over; Set state to EAppArc
       
   257         ILOG(EBackup, "JAVASTORAGE RESTORED SUCCESSFULLY");
   180         aRestoreState = EAppArc;
   258         aRestoreState = EAppArc;
   181         aBufferSpaceLeft = iBufferSpaceLeft;
   259         aBufferSpaceLeft = iBufferSpaceLeft;
   182     }
   260     }
   183 }
   261     ILOG(EBackup, "-CStorageBackupUtil::RestoreStorageDataL()");
   184 
       
   185 
       
   186 void CStorageBackupUtil::WriteStringtoStreamL(RDesWriteStream& aStream, wstring aStr)
       
   187 {
       
   188     iLenOfString = aStr.length();
       
   189 
       
   190     // if length of string is 0, do not write any string to the stream.
       
   191     if (iLenOfString == 0)
       
   192     {
       
   193         aStream.WriteInt16L(iLenOfString*2);
       
   194         iBufferSpaceLeft -= sizeof(TInt16);
       
   195         iStrCount++;
       
   196     }
       
   197 
       
   198     else
       
   199     {
       
   200         /* if space is not enough for writing the complete string,
       
   201            do not write it. Could be written next time.  */
       
   202         if (((iLenOfString*2) + sizeof(TInt16)) > iBufferSpaceLeft)
       
   203         {
       
   204             LOG(EBackup, EInfo, "Stream size is not enough to hold the string");
       
   205             // set the bufferspaceleft to zero
       
   206             iBufferSpaceLeft = 0;
       
   207         }
       
   208         // stream has enough space for the length and the string data.
       
   209         else
       
   210         {
       
   211             aStream.WriteInt16L(iLenOfString*2);
       
   212             iBufferSpaceLeft -= sizeof(TInt16);
       
   213 
       
   214             HBufC* tempstr = java::util::S60CommonUtils::wstringToDes(aStr.c_str());
       
   215             TPtrC tempStr = tempstr->Des();
       
   216             aStream.WriteL(tempStr);
       
   217             iBufferSpaceLeft -= (iLenOfString*2);
       
   218             delete tempstr;
       
   219 
       
   220             iStrCount++;
       
   221         }
       
   222     }
       
   223 }
   262 }
   224 
   263 
   225 void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream)
   264 void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream)
   226 {
   265 {
   227     wstring emptyString;
   266     wstring emptyString;
   269             iRemainingString = EFalse;
   308             iRemainingString = EFalse;
   270             iHalfReadString = emptyString;
   309             iHalfReadString = emptyString;
   271         }
   310         }
   272     }
   311     }
   273 
   312 
   274     else
   313     else /* handling new string */
   275     {
   314     {
   276         iLenOfString = aStream.ReadInt16L();
   315         iLenOfString = aStream.ReadInt16L();
   277         iBufferSpaceLeft -= sizeof(TInt16);
   316         iBufferSpaceLeft -= sizeof(TInt16);
   278 
   317 
   279         if (iLenOfString > 0)
   318         if (iLenOfString > 0)
   324                 iStringVector.push_back(stringData);
   363                 iStringVector.push_back(stringData);
   325                 iStrCount--;
   364                 iStrCount--;
   326                 delete data;
   365                 delete data;
   327             }
   366             }
   328         }
   367         }
       
   368         /* */
       
   369         else if (iLenOfString == JBNULLSTRINGLENGTH )
       
   370         {
       
   371             iStringVector.push_back(JBNULLSTRING);
       
   372             iStrCount--;
       
   373         }
   329         /* if length of string is 0, do not read anything from the stream;
   374         /* if length of string is 0, do not read anything from the stream;
   330            just push an empty string into the vector */
   375            just push an empty string into the vector */
   331         else
   376         else
   332         {
   377         {
   333             iStringVector.push_back(emptyString);
   378             iStringVector.push_back(emptyString);
   654 
   699 
   655     ILOG(EBackup, "Vector filled with data");
   700     ILOG(EBackup, "Vector filled with data");
   656     return KErrNone;
   701     return KErrNone;
   657 }
   702 }
   658 
   703 
       
   704 
       
   705 void CStorageBackupUtil::WriteItemToStorageEntry(
       
   706     const std::wstring& aEntryName,
       
   707     const std::wstring& aEntryValue,
       
   708     JavaStorageApplicationEntry_t& aInsertEntry
       
   709     )
       
   710 {
       
   711     JavaStorageEntry attribute;
       
   712     if (aEntryValue != JBNULLSTRING )
       
   713     {
       
   714         attribute.setEntry(aEntryName, aEntryValue);
       
   715         aInsertEntry.insert(attribute);
       
   716     }
       
   717 }
   659 
   718 
   660 int CStorageBackupUtil::WriteDataToStorage()
   719 int CStorageBackupUtil::WriteDataToStorage()
   661 {
   720 {
   662     JELOG2(EBackup);
   721     JELOG2(EBackup);
   663     ILOG(EBackup, "Create instance of JAVA_DATABASE_NAME and open the database");
   722     ILOG(EBackup, "Create instance of JAVA_DATABASE_NAME and open the database");
   704             js->remove(PUSH_REGISTRATIONS_TABLE, emptyEntry);
   763             js->remove(PUSH_REGISTRATIONS_TABLE, emptyEntry);
   705             js->remove(ALARM_REGISTRATIONS_TABLE, emptyEntry);
   764             js->remove(ALARM_REGISTRATIONS_TABLE, emptyEntry);
   706             js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry);
   765             js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry);
   707             js->remove(PREINSTALL_TABLE, emptyEntry);
   766             js->remove(PREINSTALL_TABLE, emptyEntry);
   708 
   767 
   709             ILOG(EBackup, "Data removed successfully from table");
   768             ELOG(EBackup, "Data removed successfully from table");
   710         }
   769         }
   711         catch (JavaStorageException jse)
   770         catch (JavaStorageException jse)
   712         {
   771         {
   713             ELOG1(EBackup, "Failed during removal of entries from table: %S", jse.toString().c_str());
   772             ELOG1(EBackup, "Failed during removal of entries from table: %S", jse.toString().c_str());
   714             js->close();
   773             js->close();
   715             return KErrGeneral;
   774             return KErrGeneral;
   716         }
   775         }
   717     }
   776     }
   718 
   777 
   719     JavaStorageEntry attribute;
       
   720     JavaStorageApplicationEntry_t insertEntry;
   778     JavaStorageApplicationEntry_t insertEntry;
   721 
   779 
   722     ILOG(EBackup, "Start transaction for writing into the database");
   780     ILOG(EBackup, "Start transaction for writing into the database");
   723 
   781 
   724     int count = 0;
   782     int count = 0;
   726     {
   784     {
   727         LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_TABLE");
   785         LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_TABLE");
   728 
   786 
   729         for (int rowNumber = 0; rowNumber < iTableSize[0]; rowNumber++)
   787         for (int rowNumber = 0; rowNumber < iTableSize[0]; rowNumber++)
   730         {
   788         {
   731             attribute.setEntry(ID, iStringVector[count++]);
   789             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   732             insertEntry.insert(attribute);
   790             WriteItemToStorageEntry(PACKAGE_NAME, iStringVector[count++], insertEntry);
   733 
   791             WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry);
   734             attribute.setEntry(PACKAGE_NAME, iStringVector[count++]);
   792             WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry);
   735             insertEntry.insert(attribute);
   793             WriteItemToStorageEntry(ROOT_PATH, iStringVector[count++], insertEntry);
   736 
   794             WriteItemToStorageEntry(MEDIA_ID, iStringVector[count++], insertEntry);
   737             attribute.setEntry(VENDOR, iStringVector[count++]);
   795             WriteItemToStorageEntry(INITIAL_SIZE, iStringVector[count++], insertEntry);
   738             insertEntry.insert(attribute);
   796             WriteItemToStorageEntry(JAD_PATH, iStringVector[count++], insertEntry);
   739 
   797             WriteItemToStorageEntry(JAR_PATH, iStringVector[count++], insertEntry);
   740             attribute.setEntry(VERSION, iStringVector[count++]);
   798             WriteItemToStorageEntry(JAD_URL, iStringVector[count++], insertEntry);
   741             insertEntry.insert(attribute);
   799             WriteItemToStorageEntry(JAR_URL, iStringVector[count++], insertEntry);
   742 
   800             WriteItemToStorageEntry(ACCESS_POINT, iStringVector[count++], insertEntry);
   743             attribute.setEntry(ROOT_PATH, iStringVector[count++]);
   801             WriteItemToStorageEntry(CONTENT_INFO, iStringVector[count++], insertEntry);
   744             insertEntry.insert(attribute);
   802             WriteItemToStorageEntry(CONTENT_ID, iStringVector[count++], insertEntry);
   745 
       
   746             attribute.setEntry(MEDIA_ID, iStringVector[count++]);
       
   747             insertEntry.insert(attribute);
       
   748 
       
   749             attribute.setEntry(INITIAL_SIZE, iStringVector[count++]);
       
   750             insertEntry.insert(attribute);
       
   751 
       
   752             attribute.setEntry(JAD_PATH, iStringVector[count++]);
       
   753             insertEntry.insert(attribute);
       
   754 
       
   755             attribute.setEntry(JAR_PATH, iStringVector[count++]);
       
   756             insertEntry.insert(attribute);
       
   757 
       
   758             attribute.setEntry(JAD_URL, iStringVector[count++]);
       
   759             insertEntry.insert(attribute);
       
   760 
       
   761             attribute.setEntry(JAR_URL, iStringVector[count++]);
       
   762             insertEntry.insert(attribute);
       
   763 
       
   764             attribute.setEntry(ACCESS_POINT, iStringVector[count++]);
       
   765             insertEntry.insert(attribute);
       
   766 
       
   767             attribute.setEntry(CONTENT_INFO, iStringVector[count++]);
       
   768             insertEntry.insert(attribute);
       
   769 
       
   770             attribute.setEntry(CONTENT_ID, iStringVector[count++]);
       
   771             insertEntry.insert(attribute);
       
   772 
   803 
   773             try
   804             try
   774             {
   805             {
   775                 js->write(APPLICATION_PACKAGE_TABLE, insertEntry);
   806                 js->write(APPLICATION_PACKAGE_TABLE, insertEntry);
   776                 ILOG(EBackup, "Writing to table succeded");
   807                 ILOG(EBackup, "Writing to table succeded");
   789     {
   820     {
   790         LOG(EBackup, EInfo,  "Writing to APPLICATION_TABLE");
   821         LOG(EBackup, EInfo,  "Writing to APPLICATION_TABLE");
   791 
   822 
   792         for (int rowNumber = 0; rowNumber < iTableSize[1]; rowNumber++)
   823         for (int rowNumber = 0; rowNumber < iTableSize[1]; rowNumber++)
   793         {
   824         {
   794             attribute.setEntry(ID, iStringVector[count++]);
   825             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   795             insertEntry.insert(attribute);
   826             WriteItemToStorageEntry(PACKAGE_ID, iStringVector[count++], insertEntry);
   796 
   827             WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
   797             attribute.setEntry(PACKAGE_ID, iStringVector[count++]);
   828             WriteItemToStorageEntry(MAIN_CLASS, iStringVector[count++], insertEntry);
   798             insertEntry.insert(attribute);
   829             WriteItemToStorageEntry(AUTORUN, iStringVector[count++], insertEntry);
   799 
       
   800             attribute.setEntry(NAME, iStringVector[count++]);
       
   801             insertEntry.insert(attribute);
       
   802 
       
   803             attribute.setEntry(MAIN_CLASS, iStringVector[count++]);
       
   804             insertEntry.insert(attribute);
       
   805 
       
   806             attribute.setEntry(AUTORUN, iStringVector[count++]);
       
   807             insertEntry.insert(attribute);
       
   808 
   830 
   809             try
   831             try
   810             {
   832             {
   811                 js->write(APPLICATION_TABLE, insertEntry);
   833                 js->write(APPLICATION_TABLE, insertEntry);
   812                 ILOG(EBackup, "Writing to table succeded");
   834                 ILOG(EBackup, "Writing to table succeded");
   825     {
   847     {
   826         LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_ATTRIBUTES_TABLE");
   848         LOG(EBackup, EInfo,  "Writing to APPLICATION_PACKAGE_ATTRIBUTES_TABLE");
   827 
   849 
   828         for (int rowNumber = 0; rowNumber < iTableSize[2]; rowNumber++)
   850         for (int rowNumber = 0; rowNumber < iTableSize[2]; rowNumber++)
   829         {
   851         {
   830             attribute.setEntry(ID, iStringVector[count++]);
   852             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   831             insertEntry.insert(attribute);
   853             WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
   832 
   854             WriteItemToStorageEntry(VALUE, iStringVector[count++], insertEntry);
   833             attribute.setEntry(NAME, iStringVector[count++]);
   855             WriteItemToStorageEntry(TRUSTED, iStringVector[count++], insertEntry);
   834             insertEntry.insert(attribute);
       
   835 
       
   836             attribute.setEntry(VALUE, iStringVector[count++]);
       
   837             insertEntry.insert(attribute);
       
   838 
       
   839             attribute.setEntry(TRUSTED, iStringVector[count++]);
       
   840             insertEntry.insert(attribute);
       
   841 
   856 
   842             try
   857             try
   843             {
   858             {
   844                 js->write(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, insertEntry);
   859                 js->write(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, insertEntry);
   845                 ILOG(EBackup, "Writing to table succeded");
   860                 ILOG(EBackup, "Writing to table succeded");
   858     {
   873     {
   859         LOG(EBackup, EInfo,  "Writing to MIDP_PACKAGE_TABLE");
   874         LOG(EBackup, EInfo,  "Writing to MIDP_PACKAGE_TABLE");
   860 
   875 
   861         for (int rowNumber = 0; rowNumber < iTableSize[3]; rowNumber++)
   876         for (int rowNumber = 0; rowNumber < iTableSize[3]; rowNumber++)
   862         {
   877         {
   863             attribute.setEntry(ID, iStringVector[count++]);
   878             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   864             insertEntry.insert(attribute);
   879             WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry);
   865 
   880             WriteItemToStorageEntry(SECURITY_DOMAIN, iStringVector[count++], insertEntry);
   866             attribute.setEntry(TYPE, iStringVector[count++]);
   881             WriteItemToStorageEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++], insertEntry);
   867             insertEntry.insert(attribute);
   882             WriteItemToStorageEntry(HASH, iStringVector[count++], insertEntry);
   868 
   883             WriteItemToStorageEntry(CERT_HASH, iStringVector[count++], insertEntry);
   869             attribute.setEntry(SECURITY_DOMAIN, iStringVector[count++]);
   884             WriteItemToStorageEntry(RMS, iStringVector[count++], insertEntry);
   870             insertEntry.insert(attribute);
   885             WriteItemToStorageEntry(VALID_CERTS, iStringVector[count++], insertEntry);
   871 
   886             WriteItemToStorageEntry(ON_SCREEN_KEYPAD, iStringVector[count++], insertEntry);
   872             attribute.setEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++]);
   887             WriteItemToStorageEntry(SECURITY_WARNINGS, iStringVector[count++], insertEntry);
   873             insertEntry.insert(attribute);
       
   874 
       
   875             attribute.setEntry(HASH, iStringVector[count++]);
       
   876             insertEntry.insert(attribute);
       
   877 
       
   878             attribute.setEntry(CERT_HASH, iStringVector[count++]);
       
   879             insertEntry.insert(attribute);
       
   880 
       
   881             attribute.setEntry(RMS, iStringVector[count++]);
       
   882             insertEntry.insert(attribute);
       
   883 
       
   884             attribute.setEntry(VALID_CERTS, iStringVector[count++]);
       
   885             insertEntry.insert(attribute);
       
   886 
       
   887             attribute.setEntry(ON_SCREEN_KEYPAD, iStringVector[count++]);
       
   888             insertEntry.insert(attribute);
       
   889             
       
   890             attribute.setEntry(SECURITY_WARNINGS, iStringVector[count++]);
       
   891             insertEntry.insert(attribute);
       
   892 
   888 
   893             try
   889             try
   894             {
   890             {
   895                 js->write(MIDP_PACKAGE_TABLE, insertEntry);
   891                 js->write(MIDP_PACKAGE_TABLE, insertEntry);
   896                 ILOG(EBackup, "Writing to table succeded");
   892                 ILOG(EBackup, "Writing to table succeded");
   909     {
   905     {
   910         LOG(EBackup, EInfo,  "Writing to MIDP_PERMISSIONS_TABLE");
   906         LOG(EBackup, EInfo,  "Writing to MIDP_PERMISSIONS_TABLE");
   911 
   907 
   912         for (int rowNumber = 0; rowNumber < iTableSize[4]; rowNumber++)
   908         for (int rowNumber = 0; rowNumber < iTableSize[4]; rowNumber++)
   913         {
   909         {
   914             attribute.setEntry(ID, iStringVector[count++]);
   910             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   915             insertEntry.insert(attribute);
   911             WriteItemToStorageEntry(CLASS, iStringVector[count++], insertEntry);
   916 
   912             WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
   917             attribute.setEntry(CLASS, iStringVector[count++]);
   913             WriteItemToStorageEntry(ACTION, iStringVector[count++], insertEntry);
   918             insertEntry.insert(attribute);
   914             WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry);
   919 
       
   920             attribute.setEntry(NAME, iStringVector[count++]);
       
   921             insertEntry.insert(attribute);
       
   922 
       
   923             attribute.setEntry(ACTION, iStringVector[count++]);
       
   924             insertEntry.insert(attribute);
       
   925 
       
   926             attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
       
   927             insertEntry.insert(attribute);
       
   928 
   915 
   929             try
   916             try
   930             {
   917             {
   931                 js->write(MIDP_PERMISSIONS_TABLE, insertEntry);
   918                 js->write(MIDP_PERMISSIONS_TABLE, insertEntry);
   932                 ILOG(EBackup, "Writing to table succeded");
   919                 ILOG(EBackup, "Writing to table succeded");
   945     {
   932     {
   946         LOG(EBackup, EInfo,  "MIDP_FUNC_GRP_SETTINGS_TABLE");
   933         LOG(EBackup, EInfo,  "MIDP_FUNC_GRP_SETTINGS_TABLE");
   947 
   934 
   948         for (int rowNumber = 0; rowNumber < iTableSize[5]; rowNumber++)
   935         for (int rowNumber = 0; rowNumber < iTableSize[5]; rowNumber++)
   949         {
   936         {
   950             attribute.setEntry(ID, iStringVector[count++]);
   937             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   951             insertEntry.insert(attribute);
   938             WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry);
   952 
   939             WriteItemToStorageEntry(ALLOWED_SETTINGS, iStringVector[count++], insertEntry);
   953             attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
   940             WriteItemToStorageEntry(CURRENT_SETTING, iStringVector[count++], insertEntry);
   954             insertEntry.insert(attribute);
   941             WriteItemToStorageEntry(BLANKET_PROMPT, iStringVector[count++], insertEntry);
   955 
       
   956             attribute.setEntry(ALLOWED_SETTINGS, iStringVector[count++]);
       
   957             insertEntry.insert(attribute);
       
   958 
       
   959             attribute.setEntry(CURRENT_SETTING, iStringVector[count++]);
       
   960             insertEntry.insert(attribute);
       
   961 
       
   962             attribute.setEntry(BLANKET_PROMPT, iStringVector[count++]);
       
   963             insertEntry.insert(attribute);
       
   964 
   942 
   965             try
   943             try
   966             {
   944             {
   967                 js->write(MIDP_FUNC_GRP_SETTINGS_TABLE, insertEntry);
   945                 js->write(MIDP_FUNC_GRP_SETTINGS_TABLE, insertEntry);
   968                 ILOG(EBackup, "Writing to table succeded");
   946                 ILOG(EBackup, "Writing to table succeded");
   981     {
   959     {
   982         LOG(EBackup, EInfo,  "Writing to PUSH_REGISTRATIONS_TABLE");
   960         LOG(EBackup, EInfo,  "Writing to PUSH_REGISTRATIONS_TABLE");
   983 
   961 
   984         for (int rowNumber = 0; rowNumber < iTableSize[6]; rowNumber++)
   962         for (int rowNumber = 0; rowNumber < iTableSize[6]; rowNumber++)
   985         {
   963         {
   986             attribute.setEntry(ID, iStringVector[count++]);
   964             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
   987             insertEntry.insert(attribute);
   965             WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry);
   988 
   966             WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
   989             attribute.setEntry(URL, iStringVector[count++]);
   967             WriteItemToStorageEntry(FILTER, iStringVector[count++], insertEntry);
   990             insertEntry.insert(attribute);
   968             WriteItemToStorageEntry(REGISTRATION_TYPE, iStringVector[count++], insertEntry);
   991 
       
   992             attribute.setEntry(NAME, iStringVector[count++]);
       
   993             insertEntry.insert(attribute);
       
   994 
       
   995             attribute.setEntry(FILTER, iStringVector[count++]);
       
   996             insertEntry.insert(attribute);
       
   997 
       
   998             attribute.setEntry(REGISTRATION_TYPE, iStringVector[count++]);
       
   999             insertEntry.insert(attribute);
       
  1000 
   969 
  1001             try
   970             try
  1002             {
   971             {
  1003                 js->write(PUSH_REGISTRATIONS_TABLE, insertEntry);
   972                 js->write(PUSH_REGISTRATIONS_TABLE, insertEntry);
  1004                 ILOG(EBackup, "Writing to table succeded");
   973                 ILOG(EBackup, "Writing to table succeded");
  1017     {
   986     {
  1018         LOG(EBackup, EInfo,  "Writing to ALARM_REGISTRATIONS_TABLE");
   987         LOG(EBackup, EInfo,  "Writing to ALARM_REGISTRATIONS_TABLE");
  1019 
   988 
  1020         for (int rowNumber = 0; rowNumber < iTableSize[7]; rowNumber++)
   989         for (int rowNumber = 0; rowNumber < iTableSize[7]; rowNumber++)
  1021         {
   990         {
  1022             attribute.setEntry(ID, iStringVector[count++]);
   991             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
  1023             insertEntry.insert(attribute);
   992             WriteItemToStorageEntry(ALARM_TIME, iStringVector[count++], insertEntry);
  1024 
       
  1025             attribute.setEntry(ALARM_TIME, iStringVector[count++]);
       
  1026             insertEntry.insert(attribute);
       
  1027 
   993 
  1028             try
   994             try
  1029             {
   995             {
  1030                 js->write(ALARM_REGISTRATIONS_TABLE, insertEntry);
   996                 js->write(ALARM_REGISTRATIONS_TABLE, insertEntry);
  1031                 ILOG(EBackup, "Writing to table succeded");
   997                 ILOG(EBackup, "Writing to table succeded");
  1045     {
  1011     {
  1046         LOG(EBackup, EInfo,  "Writing to RUNTIME_SETTINGS_TABLE");
  1012         LOG(EBackup, EInfo,  "Writing to RUNTIME_SETTINGS_TABLE");
  1047 
  1013 
  1048         for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++)
  1014         for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++)
  1049         {
  1015         {
  1050             attribute.setEntry(EXTENSIONS, iStringVector[count++]);
  1016             WriteItemToStorageEntry(EXTENSIONS, iStringVector[count++], insertEntry);
  1051             insertEntry.insert(attribute);
       
  1052 
  1017 
  1053             try
  1018             try
  1054             {
  1019             {
  1055                 js->write(RUNTIME_SETTINGS_TABLE, insertEntry);
  1020                 js->write(RUNTIME_SETTINGS_TABLE, insertEntry);
  1056                 ILOG(EBackup, "Writing to table succeded");
  1021                 ILOG(EBackup, "Writing to table succeded");
  1069     {
  1034     {
  1070         LOG(EBackup, EInfo,  "Writing to PREINSTALL_TABLE");
  1035         LOG(EBackup, EInfo,  "Writing to PREINSTALL_TABLE");
  1071 
  1036 
  1072         for (int rowNumber = 0; rowNumber < iTableSize[9]; rowNumber++)
  1037         for (int rowNumber = 0; rowNumber < iTableSize[9]; rowNumber++)
  1073         {
  1038         {
  1074             attribute.setEntry(NAME, iStringVector[count++]);
  1039             WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
  1075             insertEntry.insert(attribute);
  1040             WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry);
  1076 
  1041             WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry);
  1077             attribute.setEntry(VENDOR, iStringVector[count++]);
  1042             WriteItemToStorageEntry(INSTALL_STATE, iStringVector[count++], insertEntry);
  1078             insertEntry.insert(attribute);
       
  1079 
       
  1080             attribute.setEntry(VERSION, iStringVector[count++]);
       
  1081             insertEntry.insert(attribute);
       
  1082 
       
  1083             attribute.setEntry(INSTALL_STATE, iStringVector[count++]);
       
  1084             insertEntry.insert(attribute);
       
  1085 
  1043 
  1086             try
  1044             try
  1087             {
  1045             {
  1088                 js->write(PREINSTALL_TABLE, insertEntry);
  1046                 js->write(PREINSTALL_TABLE, insertEntry);
  1089                 ILOG(EBackup, "Writing to table succeded");
  1047                 ILOG(EBackup, "Writing to table succeded");
  1168 
  1126 
  1169         LOG(EBackup, EInfo,  "Writing to OTA_STATUS_TABLE");
  1127         LOG(EBackup, EInfo,  "Writing to OTA_STATUS_TABLE");
  1170 
  1128 
  1171         for (int rowNumber = 0; rowNumber < iTableSize[10]; rowNumber++)
  1129         for (int rowNumber = 0; rowNumber < iTableSize[10]; rowNumber++)
  1172         {
  1130         {
  1173             attribute.setEntry(ID, iStringVector[count++]);
  1131             WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
  1174             insertEntry.insert(attribute);
  1132             WriteItemToStorageEntry(CREATION_TIME, iStringVector[count++], insertEntry);
  1175 
  1133             WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry);
  1176             attribute.setEntry(CREATION_TIME, iStringVector[count++]);
  1134             WriteItemToStorageEntry(OTA_CODE, iStringVector[count++], insertEntry);
  1177             insertEntry.insert(attribute);
  1135             WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry);
  1178 
  1136             WriteItemToStorageEntry(LATEST_RETRY_TIME, iStringVector[count++], insertEntry);
  1179             attribute.setEntry(TYPE, iStringVector[count++]);
  1137             WriteItemToStorageEntry(RETRY_COUNT, iStringVector[count++], insertEntry);
  1180             insertEntry.insert(attribute);
       
  1181 
       
  1182             attribute.setEntry(OTA_CODE, iStringVector[count++]);
       
  1183             insertEntry.insert(attribute);
       
  1184 
       
  1185             attribute.setEntry(URL, iStringVector[count++]);
       
  1186             insertEntry.insert(attribute);
       
  1187 
       
  1188             attribute.setEntry(LATEST_RETRY_TIME, iStringVector[count++]);
       
  1189             insertEntry.insert(attribute);
       
  1190 
       
  1191             attribute.setEntry(RETRY_COUNT, iStringVector[count++]);
       
  1192             insertEntry.insert(attribute);
       
  1193 
  1138 
  1194             try
  1139             try
  1195             {
  1140             {
  1196                 jos->write(OTA_STATUS_TABLE, insertEntry);
  1141                 jos->write(OTA_STATUS_TABLE, insertEntry);
  1197                 LOG(EBackup, EInfo,  "Writing to table succeded");
  1142                 LOG(EBackup, EInfo,  "Writing to table succeded");
  1245 
  1190 
  1246     int rowsCount=0;
  1191     int rowsCount=0;
  1247     for (applications = foundEntries.begin(); applications != foundEntries.end(); applications++)
  1192     for (applications = foundEntries.begin(); applications != foundEntries.end(); applications++)
  1248     {
  1193     {
  1249         attribute.setEntry(ID, L"");
  1194         attribute.setEntry(ID, L"");
  1250         str = emptyString;
  1195         FetchStorageEntryToStringVector(attribute, applications);
  1251         findIterator = (*applications).find(attribute);
       
  1252 
       
  1253         if (findIterator != (*applications).end())
       
  1254         {
       
  1255             str = (*findIterator).entryValue();
       
  1256         }
       
  1257         iStringVector.push_back(str);
       
  1258 
  1196 
  1259         attribute.setEntry(PACKAGE_NAME, L"");
  1197         attribute.setEntry(PACKAGE_NAME, L"");
  1260         str = emptyString;
  1198         FetchStorageEntryToStringVector(attribute, applications);
  1261         findIterator = (*applications).find(attribute);
       
  1262 
       
  1263         if (findIterator != (*applications).end())
       
  1264         {
       
  1265             str = (*findIterator).entryValue();
       
  1266         }
       
  1267         iStringVector.push_back(str);
       
  1268 
  1199 
  1269         attribute.setEntry(VENDOR, L"");
  1200         attribute.setEntry(VENDOR, L"");
  1270         str = emptyString;
  1201         FetchStorageEntryToStringVector(attribute, applications);
  1271         findIterator = (*applications).find(attribute);
       
  1272 
       
  1273         if (findIterator != (*applications).end())
       
  1274         {
       
  1275             str = (*findIterator).entryValue();
       
  1276         }
       
  1277         iStringVector.push_back(str);
       
  1278 
  1202 
  1279         attribute.setEntry(VERSION, L"");
  1203         attribute.setEntry(VERSION, L"");
  1280         str = emptyString;
  1204         FetchStorageEntryToStringVector(attribute, applications);
  1281         findIterator = (*applications).find(attribute);
       
  1282 
       
  1283         if (findIterator != (*applications).end())
       
  1284         {
       
  1285             str = (*findIterator).entryValue();
       
  1286         }
       
  1287         iStringVector.push_back(str);
       
  1288 
  1205 
  1289         attribute.setEntry(ROOT_PATH, L"");
  1206         attribute.setEntry(ROOT_PATH, L"");
  1290         str = emptyString;
  1207         FetchStorageEntryToStringVector(attribute, applications);
  1291         findIterator = (*applications).find(attribute);
       
  1292 
       
  1293         if (findIterator != (*applications).end())
       
  1294         {
       
  1295             str = (*findIterator).entryValue();
       
  1296         }
       
  1297         iStringVector.push_back(str);
       
  1298 
  1208 
  1299         attribute.setEntry(MEDIA_ID, L"");
  1209         attribute.setEntry(MEDIA_ID, L"");
  1300         str = emptyString;
  1210         FetchStorageEntryToStringVector(attribute, applications);
  1301         findIterator = (*applications).find(attribute);
       
  1302 
       
  1303         if (findIterator != (*applications).end())
       
  1304         {
       
  1305             str = (*findIterator).entryValue();
       
  1306         }
       
  1307         iStringVector.push_back(str);
       
  1308 
  1211 
  1309         attribute.setEntry(INITIAL_SIZE, L"");
  1212         attribute.setEntry(INITIAL_SIZE, L"");
  1310         str = emptyString;
  1213         FetchStorageEntryToStringVector(attribute, applications);
  1311         findIterator = (*applications).find(attribute);
       
  1312 
       
  1313         if (findIterator != (*applications).end())
       
  1314         {
       
  1315             str = (*findIterator).entryValue();
       
  1316         }
       
  1317         iStringVector.push_back(str);
       
  1318 
  1214 
  1319         attribute.setEntry(JAD_PATH, L"");
  1215         attribute.setEntry(JAD_PATH, L"");
  1320         str = emptyString;
  1216         FetchStorageEntryToStringVector(attribute, applications);
  1321         findIterator = (*applications).find(attribute);
       
  1322 
       
  1323         if (findIterator != (*applications).end())
       
  1324         {
       
  1325             str = (*findIterator).entryValue();
       
  1326         }
       
  1327         iStringVector.push_back(str);
       
  1328 
  1217 
  1329         attribute.setEntry(JAR_PATH, L"");
  1218         attribute.setEntry(JAR_PATH, L"");
  1330         str = emptyString;
  1219         FetchStorageEntryToStringVector(attribute, applications);
  1331         findIterator = (*applications).find(attribute);
       
  1332 
       
  1333         if (findIterator != (*applications).end())
       
  1334         {
       
  1335             str = (*findIterator).entryValue();
       
  1336         }
       
  1337         iStringVector.push_back(str);
       
  1338 
  1220 
  1339         attribute.setEntry(JAD_URL, L"");
  1221         attribute.setEntry(JAD_URL, L"");
  1340         str = emptyString;
  1222         FetchStorageEntryToStringVector(attribute, applications);
  1341         findIterator = (*applications).find(attribute);
       
  1342 
       
  1343         if (findIterator != (*applications).end())
       
  1344         {
       
  1345             str = (*findIterator).entryValue();
       
  1346         }
       
  1347         iStringVector.push_back(str);
       
  1348 
  1223 
  1349         attribute.setEntry(JAR_URL, L"");
  1224         attribute.setEntry(JAR_URL, L"");
  1350         str = emptyString;
  1225         FetchStorageEntryToStringVector(attribute, applications);
  1351         findIterator = (*applications).find(attribute);
       
  1352 
       
  1353         if (findIterator != (*applications).end())
       
  1354         {
       
  1355             str = (*findIterator).entryValue();
       
  1356         }
       
  1357         iStringVector.push_back(str);
       
  1358 
  1226 
  1359         attribute.setEntry(ACCESS_POINT, L"");
  1227         attribute.setEntry(ACCESS_POINT, L"");
  1360         str = emptyString;
  1228         FetchStorageEntryToStringVector(attribute, applications);
  1361         findIterator = (*applications).find(attribute);
       
  1362 
       
  1363         if (findIterator != (*applications).end())
       
  1364         {
       
  1365             str = (*findIterator).entryValue();
       
  1366         }
       
  1367         iStringVector.push_back(str);
       
  1368 
  1229 
  1369         attribute.setEntry(CONTENT_INFO, L"");
  1230         attribute.setEntry(CONTENT_INFO, L"");
  1370         str = emptyString;
  1231         FetchStorageEntryToStringVector(attribute, applications);
  1371         findIterator = (*applications).find(attribute);
       
  1372 
       
  1373         if (findIterator != (*applications).end())
       
  1374         {
       
  1375             str = (*findIterator).entryValue();
       
  1376         }
       
  1377         iStringVector.push_back(str);
       
  1378 
  1232 
  1379         attribute.setEntry(CONTENT_ID, L"");
  1233         attribute.setEntry(CONTENT_ID, L"");
  1380         str = emptyString;
  1234         FetchStorageEntryToStringVector(attribute, applications);
  1381         findIterator = (*applications).find(attribute);
       
  1382 
       
  1383         if (findIterator != (*applications).end())
       
  1384         {
       
  1385             str = (*findIterator).entryValue();
       
  1386         }
       
  1387         iStringVector.push_back(str);
       
  1388 
  1235 
  1389         rowsCount++;
  1236         rowsCount++;
  1390     }
  1237     }
  1391     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1238     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1392     return rowsCount;
  1239     return rowsCount;
  1406 
  1253 
  1407     int rowsCount=0;
  1254     int rowsCount=0;
  1408     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1255     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1409     {
  1256     {
  1410         attribute.setEntry(ID, L"");
  1257         attribute.setEntry(ID, L"");
  1411         str = emptyString;
  1258         FetchStorageEntryToStringVector(attribute, applications);
  1412         findIterator = (*applications).find(attribute);
       
  1413 
       
  1414         if (findIterator != (*applications).end())
       
  1415         {
       
  1416             str = (*findIterator).entryValue();
       
  1417         }
       
  1418         iStringVector.push_back(str);
       
  1419 
  1259 
  1420         attribute.setEntry(PACKAGE_ID, L"");
  1260         attribute.setEntry(PACKAGE_ID, L"");
  1421         str = emptyString;
  1261         FetchStorageEntryToStringVector(attribute, applications);
  1422         findIterator = (*applications).find(attribute);
       
  1423 
       
  1424         if (findIterator != (*applications).end())
       
  1425         {
       
  1426             str = (*findIterator).entryValue();
       
  1427         }
       
  1428         iStringVector.push_back(str);
       
  1429 
  1262 
  1430         attribute.setEntry(NAME, L"");
  1263         attribute.setEntry(NAME, L"");
  1431         str = emptyString;
  1264         FetchStorageEntryToStringVector(attribute, applications);
  1432         findIterator = (*applications).find(attribute);
       
  1433 
       
  1434         if (findIterator != (*applications).end())
       
  1435         {
       
  1436             str = (*findIterator).entryValue();
       
  1437         }
       
  1438         iStringVector.push_back(str);
       
  1439 
  1265 
  1440         attribute.setEntry(MAIN_CLASS, L"");
  1266         attribute.setEntry(MAIN_CLASS, L"");
  1441         str = emptyString;
  1267         FetchStorageEntryToStringVector(attribute, applications);
  1442         findIterator = (*applications).find(attribute);
       
  1443 
       
  1444         if (findIterator != (*applications).end())
       
  1445         {
       
  1446             str = (*findIterator).entryValue();
       
  1447         }
       
  1448         iStringVector.push_back(str);
       
  1449 
  1268 
  1450         attribute.setEntry(AUTORUN, L"");
  1269         attribute.setEntry(AUTORUN, L"");
  1451         str = emptyString;
  1270         FetchStorageEntryToStringVector(attribute, applications);
  1452         findIterator = (*applications).find(attribute);
       
  1453 
       
  1454         if (findIterator != (*applications).end())
       
  1455         {
       
  1456             str = (*findIterator).entryValue();
       
  1457         }
       
  1458         iStringVector.push_back(str);
       
  1459 
  1271 
  1460         rowsCount++;
  1272         rowsCount++;
  1461     }
  1273     }
  1462     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1274     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1463     return rowsCount;
  1275     return rowsCount;
  1477 
  1289 
  1478     int rowsCount=0;
  1290     int rowsCount=0;
  1479     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1291     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1480     {
  1292     {
  1481         attribute.setEntry(ID, L"");
  1293         attribute.setEntry(ID, L"");
  1482         str = emptyString;
  1294         FetchStorageEntryToStringVector(attribute, applications);
  1483         findIterator = (*applications).find(attribute);
       
  1484 
       
  1485         if (findIterator != (*applications).end())
       
  1486         {
       
  1487             str = (*findIterator).entryValue();
       
  1488         }
       
  1489         iStringVector.push_back(str);
       
  1490 
  1295 
  1491         attribute.setEntry(NAME, L"");
  1296         attribute.setEntry(NAME, L"");
  1492         str = emptyString;
  1297         FetchStorageEntryToStringVector(attribute, applications);
  1493         findIterator = (*applications).find(attribute);
       
  1494 
       
  1495         if (findIterator != (*applications).end())
       
  1496         {
       
  1497             str = (*findIterator).entryValue();
       
  1498         }
       
  1499         iStringVector.push_back(str);
       
  1500 
  1298 
  1501         attribute.setEntry(VALUE, L"");
  1299         attribute.setEntry(VALUE, L"");
  1502         str = emptyString;
  1300         FetchStorageEntryToStringVector(attribute, applications);
  1503         findIterator = (*applications).find(attribute);
       
  1504 
       
  1505         if (findIterator != (*applications).end())
       
  1506         {
       
  1507             str = (*findIterator).entryValue();
       
  1508         }
       
  1509         iStringVector.push_back(str);
       
  1510 
  1301 
  1511         attribute.setEntry(TRUSTED, L"");
  1302         attribute.setEntry(TRUSTED, L"");
  1512         str = emptyString;
  1303         FetchStorageEntryToStringVector(attribute, applications);
  1513         findIterator = (*applications).find(attribute);
       
  1514 
       
  1515         if (findIterator != (*applications).end())
       
  1516         {
       
  1517             str = (*findIterator).entryValue();
       
  1518         }
       
  1519         iStringVector.push_back(str);
       
  1520 
  1304 
  1521         rowsCount++;
  1305         rowsCount++;
  1522     }
  1306     }
  1523     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1307     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1524     return rowsCount;
  1308     return rowsCount;
  1525 }
  1309 }
  1526 
  1310 
       
  1311 void CStorageBackupUtil::FetchStorageEntryToStringVector(const JavaStorageEntry& aAttribute,
       
  1312     JavaStorageApplicationList_t::const_iterator& aApplicationsIter)
       
  1313 {
       
  1314     const wstring emptyString;
       
  1315     wstring str;
       
  1316     JavaStorageApplicationEntry_t::const_iterator findIterator;
       
  1317     str = emptyString;
       
  1318     findIterator = (*aApplicationsIter).find(aAttribute);
       
  1319 
       
  1320     if (findIterator != (*aApplicationsIter).end())
       
  1321     {
       
  1322         str = (*findIterator).entryValue();
       
  1323         iStringVector.push_back(str);
       
  1324     } else {
       
  1325         iStringVector.push_back(JBNULLSTRING);
       
  1326     }
       
  1327 }
       
  1328 
  1527 int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries)
  1329 int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries)
       
  1330 {
       
  1331     const wstring emptyString;
       
  1332     wstring str;
       
  1333 
       
  1334     JavaStorageEntry attribute;
       
  1335 
       
  1336     /* Initialise Iterators to iterate through all applications
       
  1337        matched with search patterns.  */
       
  1338     JavaStorageApplicationList_t::const_iterator applications;
       
  1339 
       
  1340     int rowsCount=0;
       
  1341     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
       
  1342     {
       
  1343         attribute.setEntry(ID, L"");
       
  1344         FetchStorageEntryToStringVector(attribute, applications);
       
  1345 
       
  1346         attribute.setEntry(TYPE, L"");
       
  1347         FetchStorageEntryToStringVector(attribute, applications);
       
  1348 
       
  1349         attribute.setEntry(SECURITY_DOMAIN, L"");
       
  1350         FetchStorageEntryToStringVector(attribute, applications);
       
  1351 
       
  1352         attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L"");
       
  1353         FetchStorageEntryToStringVector(attribute, applications);
       
  1354 
       
  1355         attribute.setEntry(HASH, L"");
       
  1356         FetchStorageEntryToStringVector(attribute, applications);
       
  1357 
       
  1358         attribute.setEntry(CERT_HASH, L"");
       
  1359         FetchStorageEntryToStringVector(attribute, applications);
       
  1360 
       
  1361         attribute.setEntry(RMS, L"");
       
  1362         FetchStorageEntryToStringVector(attribute, applications);
       
  1363 
       
  1364         attribute.setEntry(VALID_CERTS, L"");
       
  1365         FetchStorageEntryToStringVector(attribute, applications);
       
  1366 
       
  1367         attribute.setEntry(ON_SCREEN_KEYPAD, L"");
       
  1368         FetchStorageEntryToStringVector(attribute, applications);
       
  1369 
       
  1370         attribute.setEntry(SECURITY_WARNINGS, L"");
       
  1371         FetchStorageEntryToStringVector(attribute, applications);
       
  1372 
       
  1373         rowsCount++;
       
  1374     }
       
  1375     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
       
  1376     return rowsCount;
       
  1377 }
       
  1378 
       
  1379 int CStorageBackupUtil::FillVectorwithMidpPermTableData(JavaStorageApplicationList_t& afoundEntries)
  1528 {
  1380 {
  1529     const wstring emptyString;
  1381     const wstring emptyString;
  1530     wstring str;
  1382     wstring str;
  1531 
  1383 
  1532     JavaStorageEntry attribute;
  1384     JavaStorageEntry attribute;
  1538 
  1390 
  1539     int rowsCount=0;
  1391     int rowsCount=0;
  1540     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1392     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1541     {
  1393     {
  1542         attribute.setEntry(ID, L"");
  1394         attribute.setEntry(ID, L"");
  1543         str = emptyString;
  1395         FetchStorageEntryToStringVector(attribute, applications);
  1544         findIterator = (*applications).find(attribute);
  1396 
  1545 
  1397         attribute.setEntry(CLASS, L"");
  1546         if (findIterator != (*applications).end())
  1398         FetchStorageEntryToStringVector(attribute, applications);
  1547         {
  1399 
  1548             str = (*findIterator).entryValue();
  1400         attribute.setEntry(NAME, L"");
  1549         }
  1401         FetchStorageEntryToStringVector(attribute, applications);
  1550         iStringVector.push_back(str);
  1402 
  1551 
  1403         attribute.setEntry(ACTION, L"");
  1552         attribute.setEntry(TYPE, L"");
  1404         FetchStorageEntryToStringVector(attribute, applications);
  1553         str = emptyString;
  1405 
  1554         findIterator = (*applications).find(attribute);
  1406         attribute.setEntry(FUNCTION_GROUP, L"");
  1555 
  1407         FetchStorageEntryToStringVector(attribute, applications);
  1556         if (findIterator != (*applications).end())
       
  1557         {
       
  1558             str = (*findIterator).entryValue();
       
  1559         }
       
  1560         iStringVector.push_back(str);
       
  1561 
       
  1562         attribute.setEntry(SECURITY_DOMAIN, L"");
       
  1563         str = emptyString;
       
  1564         findIterator = (*applications).find(attribute);
       
  1565 
       
  1566         if (findIterator != (*applications).end())
       
  1567         {
       
  1568             str = (*findIterator).entryValue();
       
  1569         }
       
  1570         iStringVector.push_back(str);
       
  1571 
       
  1572         attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L"");
       
  1573         str = emptyString;
       
  1574         findIterator = (*applications).find(attribute);
       
  1575 
       
  1576         if (findIterator != (*applications).end())
       
  1577         {
       
  1578             str = (*findIterator).entryValue();
       
  1579         }
       
  1580         iStringVector.push_back(str);
       
  1581 
       
  1582         attribute.setEntry(HASH, L"");
       
  1583         str = emptyString;
       
  1584         findIterator = (*applications).find(attribute);
       
  1585 
       
  1586         if (findIterator != (*applications).end())
       
  1587         {
       
  1588             str = (*findIterator).entryValue();
       
  1589         }
       
  1590         iStringVector.push_back(str);
       
  1591 
       
  1592         attribute.setEntry(CERT_HASH, L"");
       
  1593         str = emptyString;
       
  1594         findIterator = (*applications).find(attribute);
       
  1595 
       
  1596         if (findIterator != (*applications).end())
       
  1597         {
       
  1598             str = (*findIterator).entryValue();
       
  1599         }
       
  1600         iStringVector.push_back(str);
       
  1601 
       
  1602         attribute.setEntry(RMS, L"");
       
  1603         str = emptyString;
       
  1604         findIterator = (*applications).find(attribute);
       
  1605 
       
  1606         if (findIterator != (*applications).end())
       
  1607         {
       
  1608             str = (*findIterator).entryValue();
       
  1609         }
       
  1610         iStringVector.push_back(str);
       
  1611 
       
  1612         attribute.setEntry(VALID_CERTS, L"");
       
  1613         str = emptyString;
       
  1614         findIterator = (*applications).find(attribute);
       
  1615 
       
  1616         if (findIterator != (*applications).end())
       
  1617         {
       
  1618             str = (*findIterator).entryValue();
       
  1619         }
       
  1620         iStringVector.push_back(str);
       
  1621 
       
  1622         attribute.setEntry(ON_SCREEN_KEYPAD, L"");
       
  1623         str = emptyString;
       
  1624         findIterator = (*applications).find(attribute);
       
  1625 
       
  1626         if (findIterator != (*applications).end())
       
  1627         {
       
  1628             str = (*findIterator).entryValue();
       
  1629         }
       
  1630         iStringVector.push_back(str);
       
  1631         
       
  1632         attribute.setEntry(SECURITY_WARNINGS, L"");
       
  1633         str = emptyString;
       
  1634         findIterator = (*applications).find(attribute);
       
  1635 
       
  1636         if (findIterator != (*applications).end())
       
  1637         {
       
  1638             str = (*findIterator).entryValue();
       
  1639         }
       
  1640         iStringVector.push_back(str);
       
  1641 
  1408 
  1642         rowsCount++;
  1409         rowsCount++;
  1643     }
  1410     }
  1644     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1411     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1645     return rowsCount;
  1412     return rowsCount;
  1646 }
  1413 }
  1647 
  1414 
  1648 int CStorageBackupUtil::FillVectorwithMidpPermTableData(JavaStorageApplicationList_t& afoundEntries)
  1415 int CStorageBackupUtil::FillVectorwithMidpFuncGrpSetTableData(JavaStorageApplicationList_t& afoundEntries)
  1649 {
  1416 {
  1650     const wstring emptyString;
  1417     const wstring emptyString;
  1651     wstring str;
  1418     wstring str;
  1652 
  1419 
  1653     JavaStorageEntry attribute;
  1420     JavaStorageEntry attribute;
  1659 
  1426 
  1660     int rowsCount=0;
  1427     int rowsCount=0;
  1661     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1428     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1662     {
  1429     {
  1663         attribute.setEntry(ID, L"");
  1430         attribute.setEntry(ID, L"");
  1664         str = emptyString;
  1431         FetchStorageEntryToStringVector(attribute, applications);
  1665         findIterator = (*applications).find(attribute);
       
  1666 
       
  1667         if (findIterator != (*applications).end())
       
  1668         {
       
  1669             str = (*findIterator).entryValue();
       
  1670         }
       
  1671         iStringVector.push_back(str);
       
  1672 
       
  1673         attribute.setEntry(CLASS, L"");
       
  1674         str = emptyString;
       
  1675         findIterator = (*applications).find(attribute);
       
  1676 
       
  1677         if (findIterator != (*applications).end())
       
  1678         {
       
  1679             str = (*findIterator).entryValue();
       
  1680         }
       
  1681         iStringVector.push_back(str);
       
  1682 
       
  1683         attribute.setEntry(NAME, L"");
       
  1684         str = emptyString;
       
  1685         findIterator = (*applications).find(attribute);
       
  1686 
       
  1687         if (findIterator != (*applications).end())
       
  1688         {
       
  1689             str = (*findIterator).entryValue();
       
  1690         }
       
  1691         iStringVector.push_back(str);
       
  1692 
       
  1693         attribute.setEntry(ACTION, L"");
       
  1694         str = emptyString;
       
  1695         findIterator = (*applications).find(attribute);
       
  1696 
       
  1697         if (findIterator != (*applications).end())
       
  1698         {
       
  1699             str = (*findIterator).entryValue();
       
  1700         }
       
  1701         iStringVector.push_back(str);
       
  1702 
  1432 
  1703         attribute.setEntry(FUNCTION_GROUP, L"");
  1433         attribute.setEntry(FUNCTION_GROUP, L"");
  1704         str = emptyString;
  1434         FetchStorageEntryToStringVector(attribute, applications);
  1705         findIterator = (*applications).find(attribute);
  1435 
  1706 
  1436         attribute.setEntry(ALLOWED_SETTINGS, L"");
  1707         if (findIterator != (*applications).end())
  1437         FetchStorageEntryToStringVector(attribute, applications);
  1708         {
  1438 
  1709             str = (*findIterator).entryValue();
  1439         attribute.setEntry(CURRENT_SETTING, L"");
  1710         }
  1440         FetchStorageEntryToStringVector(attribute, applications);
  1711         iStringVector.push_back(str);
  1441 
       
  1442         attribute.setEntry(BLANKET_PROMPT, L"");
       
  1443         FetchStorageEntryToStringVector(attribute, applications);
  1712 
  1444 
  1713         rowsCount++;
  1445         rowsCount++;
  1714     }
  1446     }
  1715     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1447     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1716     return rowsCount;
  1448     return rowsCount;
  1717 }
  1449 }
  1718 
  1450 
  1719 int CStorageBackupUtil::FillVectorwithMidpFuncGrpSetTableData(JavaStorageApplicationList_t& afoundEntries)
  1451 int CStorageBackupUtil::FillVectorwithPushRegTableData(JavaStorageApplicationList_t& afoundEntries)
  1720 {
  1452 {
  1721     const wstring emptyString;
  1453     const wstring emptyString;
  1722     wstring str;
  1454     wstring str;
  1723 
  1455 
  1724     JavaStorageEntry attribute;
  1456     JavaStorageEntry attribute;
  1730 
  1462 
  1731     int rowsCount=0;
  1463     int rowsCount=0;
  1732     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1464     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1733     {
  1465     {
  1734         attribute.setEntry(ID, L"");
  1466         attribute.setEntry(ID, L"");
  1735         str = emptyString;
  1467         FetchStorageEntryToStringVector(attribute, applications);
  1736         findIterator = (*applications).find(attribute);
  1468 
  1737 
  1469         attribute.setEntry(URL, L"");
  1738         if (findIterator != (*applications).end())
  1470         FetchStorageEntryToStringVector(attribute, applications);
  1739         {
  1471 
  1740             str = (*findIterator).entryValue();
  1472         attribute.setEntry(NAME, L"");
  1741         }
  1473         FetchStorageEntryToStringVector(attribute, applications);
  1742         iStringVector.push_back(str);
  1474 
  1743 
  1475         attribute.setEntry(FILTER, L"");
  1744         attribute.setEntry(FUNCTION_GROUP, L"");
  1476         FetchStorageEntryToStringVector(attribute, applications);
  1745         str = emptyString;
  1477 
  1746         findIterator = (*applications).find(attribute);
  1478         attribute.setEntry(REGISTRATION_TYPE, L"");
  1747 
  1479         FetchStorageEntryToStringVector(attribute, applications);
  1748         if (findIterator != (*applications).end())
       
  1749         {
       
  1750             str = (*findIterator).entryValue();
       
  1751         }
       
  1752         iStringVector.push_back(str);
       
  1753 
       
  1754         attribute.setEntry(ALLOWED_SETTINGS, L"");
       
  1755         str = emptyString;
       
  1756         findIterator = (*applications).find(attribute);
       
  1757 
       
  1758         if (findIterator != (*applications).end())
       
  1759         {
       
  1760             str = (*findIterator).entryValue();
       
  1761         }
       
  1762         iStringVector.push_back(str);
       
  1763 
       
  1764         attribute.setEntry(CURRENT_SETTING, L"");
       
  1765         str = emptyString;
       
  1766         findIterator = (*applications).find(attribute);
       
  1767 
       
  1768         if (findIterator != (*applications).end())
       
  1769         {
       
  1770             str = (*findIterator).entryValue();
       
  1771         }
       
  1772         iStringVector.push_back(str);
       
  1773 
       
  1774         attribute.setEntry(BLANKET_PROMPT, L"");
       
  1775         str = emptyString;
       
  1776         findIterator = (*applications).find(attribute);
       
  1777 
       
  1778         if (findIterator != (*applications).end())
       
  1779         {
       
  1780             str = (*findIterator).entryValue();
       
  1781         }
       
  1782         iStringVector.push_back(str);
       
  1783 
  1480 
  1784         rowsCount++;
  1481         rowsCount++;
  1785     }
  1482     }
  1786     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1483     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1787     return rowsCount;
  1484     return rowsCount;
  1788 }
  1485 }
  1789 
  1486 
  1790 int CStorageBackupUtil::FillVectorwithPushRegTableData(JavaStorageApplicationList_t& afoundEntries)
  1487 int CStorageBackupUtil::FillVectorwithAlarmRegTableData(JavaStorageApplicationList_t& afoundEntries)
  1791 {
  1488 {
  1792     const wstring emptyString;
  1489     const wstring emptyString;
  1793     wstring str;
  1490     wstring str;
  1794 
  1491 
  1795     JavaStorageEntry attribute;
  1492     JavaStorageEntry attribute;
  1801 
  1498 
  1802     int rowsCount=0;
  1499     int rowsCount=0;
  1803     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1500     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1804     {
  1501     {
  1805         attribute.setEntry(ID, L"");
  1502         attribute.setEntry(ID, L"");
  1806         str = emptyString;
  1503         FetchStorageEntryToStringVector(attribute, applications);
  1807         findIterator = (*applications).find(attribute);
  1504 
  1808 
  1505         attribute.setEntry(ALARM_TIME, L"");
  1809         if (findIterator != (*applications).end())
  1506         FetchStorageEntryToStringVector(attribute, applications);
  1810         {
       
  1811             str = (*findIterator).entryValue();
       
  1812         }
       
  1813         iStringVector.push_back(str);
       
  1814 
       
  1815         attribute.setEntry(URL, L"");
       
  1816         str = emptyString;
       
  1817         findIterator = (*applications).find(attribute);
       
  1818 
       
  1819         if (findIterator != (*applications).end())
       
  1820         {
       
  1821             str = (*findIterator).entryValue();
       
  1822         }
       
  1823         iStringVector.push_back(str);
       
  1824 
       
  1825         attribute.setEntry(NAME, L"");
       
  1826         str = emptyString;
       
  1827         findIterator = (*applications).find(attribute);
       
  1828 
       
  1829         if (findIterator != (*applications).end())
       
  1830         {
       
  1831             str = (*findIterator).entryValue();
       
  1832         }
       
  1833         iStringVector.push_back(str);
       
  1834 
       
  1835         attribute.setEntry(FILTER, L"");
       
  1836         str = emptyString;
       
  1837         findIterator = (*applications).find(attribute);
       
  1838 
       
  1839         if (findIterator != (*applications).end())
       
  1840         {
       
  1841             str = (*findIterator).entryValue();
       
  1842         }
       
  1843         iStringVector.push_back(str);
       
  1844 
       
  1845         attribute.setEntry(REGISTRATION_TYPE, L"");
       
  1846         str = emptyString;
       
  1847         findIterator = (*applications).find(attribute);
       
  1848 
       
  1849         if (findIterator != (*applications).end())
       
  1850         {
       
  1851             str = (*findIterator).entryValue();
       
  1852         }
       
  1853         iStringVector.push_back(str);
       
  1854 
  1507 
  1855         rowsCount++;
  1508         rowsCount++;
  1856     }
  1509     }
  1857     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1510     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1858     return rowsCount;
  1511     return rowsCount;
  1859 }
  1512 }
  1860 
  1513 
  1861 int CStorageBackupUtil::FillVectorwithAlarmRegTableData(JavaStorageApplicationList_t& afoundEntries)
  1514 int CStorageBackupUtil::FillVectorwithRuntimeSetTableData(JavaStorageApplicationList_t& afoundEntries)
  1862 {
  1515 {
  1863     const wstring emptyString;
  1516     const wstring emptyString;
  1864     wstring str;
  1517     wstring str;
  1865 
  1518 
  1866     JavaStorageEntry attribute;
  1519     JavaStorageEntry attribute;
  1871     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1524     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1872 
  1525 
  1873     int rowsCount=0;
  1526     int rowsCount=0;
  1874     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1527     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1875     {
  1528     {
  1876         attribute.setEntry(ID, L"");
  1529         attribute.setEntry(EXTENSIONS, L"");
  1877         str = emptyString;
  1530         FetchStorageEntryToStringVector(attribute, applications);
  1878         findIterator = (*applications).find(attribute);
       
  1879 
       
  1880         if (findIterator != (*applications).end())
       
  1881         {
       
  1882             str = (*findIterator).entryValue();
       
  1883         }
       
  1884         iStringVector.push_back(str);
       
  1885 
       
  1886         attribute.setEntry(ALARM_TIME, L"");
       
  1887         str = emptyString;
       
  1888         findIterator = (*applications).find(attribute);
       
  1889 
       
  1890         if (findIterator != (*applications).end())
       
  1891         {
       
  1892             str = (*findIterator).entryValue();
       
  1893         }
       
  1894         iStringVector.push_back(str);
       
  1895 
  1531 
  1896         rowsCount++;
  1532         rowsCount++;
  1897     }
  1533     }
  1898     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1534     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1899     return rowsCount;
  1535     return rowsCount;
  1900 }
  1536 }
  1901 
  1537 
  1902 int CStorageBackupUtil::FillVectorwithRuntimeSetTableData(JavaStorageApplicationList_t& afoundEntries)
  1538 int CStorageBackupUtil::FillVectorwithPreinstallTableData(JavaStorageApplicationList_t& afoundEntries)
  1903 {
  1539 {
  1904     const wstring emptyString;
  1540     const wstring emptyString;
  1905     wstring str;
  1541     wstring str;
  1906 
  1542 
  1907     JavaStorageEntry attribute;
  1543     JavaStorageEntry attribute;
  1912     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1548     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1913 
  1549 
  1914     int rowsCount=0;
  1550     int rowsCount=0;
  1915     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1551     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1916     {
  1552     {
  1917         attribute.setEntry(EXTENSIONS, L"");
  1553         attribute.setEntry(NAME, L"");
  1918         str = emptyString;
  1554         FetchStorageEntryToStringVector(attribute, applications);
  1919         findIterator = (*applications).find(attribute);
  1555 
  1920 
  1556         attribute.setEntry(VENDOR, L"");
  1921         if (findIterator != (*applications).end())
  1557         FetchStorageEntryToStringVector(attribute, applications);
  1922         {
  1558 
  1923             str = (*findIterator).entryValue();
  1559         attribute.setEntry(VERSION, L"");
  1924         }
  1560         FetchStorageEntryToStringVector(attribute, applications);
  1925         iStringVector.push_back(str);
  1561 
       
  1562         attribute.setEntry(INSTALL_STATE, L"");
       
  1563         FetchStorageEntryToStringVector(attribute, applications);
  1926 
  1564 
  1927         rowsCount++;
  1565         rowsCount++;
  1928     }
  1566     }
  1929     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1567     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1930     return rowsCount;
  1568     return rowsCount;
  1931 }
  1569 }
  1932 
  1570 
  1933 int CStorageBackupUtil::FillVectorwithPreinstallTableData(JavaStorageApplicationList_t& afoundEntries)
  1571 int CStorageBackupUtil::FillVectorwithOtaStatusTableData(JavaStorageApplicationList_t& afoundEntries)
  1934 {
  1572 {
  1935     const wstring emptyString;
  1573     const wstring emptyString;
  1936     wstring str;
  1574     wstring str;
  1937 
  1575 
  1938     JavaStorageEntry attribute;
  1576     JavaStorageEntry attribute;
  1943     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1581     JavaStorageApplicationEntry_t::const_iterator findIterator;
  1944 
  1582 
  1945     int rowsCount=0;
  1583     int rowsCount=0;
  1946     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1584     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
  1947     {
  1585     {
  1948         attribute.setEntry(NAME, L"");
  1586         attribute.setEntry(ID, L"");
  1949         str = emptyString;
  1587         FetchStorageEntryToStringVector(attribute, applications);
  1950         findIterator = (*applications).find(attribute);
  1588 
  1951 
  1589         attribute.setEntry(CREATION_TIME, L"");
  1952         if (findIterator != (*applications).end())
  1590         FetchStorageEntryToStringVector(attribute, applications);
  1953         {
  1591 
  1954             str = (*findIterator).entryValue();
  1592         attribute.setEntry(TYPE, L"");
  1955         }
  1593         FetchStorageEntryToStringVector(attribute, applications);
  1956         iStringVector.push_back(str);
  1594 
  1957 
  1595         attribute.setEntry(OTA_CODE, L"");
  1958         attribute.setEntry(VENDOR, L"");
  1596         FetchStorageEntryToStringVector(attribute, applications);
  1959         str = emptyString;
  1597 
  1960         findIterator = (*applications).find(attribute);
  1598         attribute.setEntry(URL, L"");
  1961 
  1599         FetchStorageEntryToStringVector(attribute, applications);
  1962         if (findIterator != (*applications).end())
  1600 
  1963         {
  1601         attribute.setEntry(LATEST_RETRY_TIME, L"");
  1964             str = (*findIterator).entryValue();
  1602         FetchStorageEntryToStringVector(attribute, applications);
  1965         }
  1603 
  1966         iStringVector.push_back(str);
  1604         attribute.setEntry(RETRY_COUNT, L"");
  1967 
  1605         FetchStorageEntryToStringVector(attribute, applications);
  1968         attribute.setEntry(VERSION, L"");
       
  1969         str = emptyString;
       
  1970         findIterator = (*applications).find(attribute);
       
  1971 
       
  1972         if (findIterator != (*applications).end())
       
  1973         {
       
  1974             str = (*findIterator).entryValue();
       
  1975         }
       
  1976         iStringVector.push_back(str);
       
  1977 
       
  1978         attribute.setEntry(INSTALL_STATE, L"");
       
  1979         str = emptyString;
       
  1980         findIterator = (*applications).find(attribute);
       
  1981 
       
  1982         if (findIterator != (*applications).end())
       
  1983         {
       
  1984             str = (*findIterator).entryValue();
       
  1985         }
       
  1986         iStringVector.push_back(str);
       
  1987 
  1606 
  1988         rowsCount++;
  1607         rowsCount++;
  1989     }
  1608     }
  1990     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1609     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
  1991     return rowsCount;
  1610     return rowsCount;
  1992 }
  1611 }
  1993 
  1612 
  1994 int CStorageBackupUtil::FillVectorwithOtaStatusTableData(JavaStorageApplicationList_t& afoundEntries)
       
  1995 {
       
  1996     const wstring emptyString;
       
  1997     wstring str;
       
  1998 
       
  1999     JavaStorageEntry attribute;
       
  2000 
       
  2001     /* Initialise Iterators to iterate through all applications
       
  2002        matched with search patterns.  */
       
  2003     JavaStorageApplicationList_t::const_iterator applications;
       
  2004     JavaStorageApplicationEntry_t::const_iterator findIterator;
       
  2005 
       
  2006     int rowsCount=0;
       
  2007     for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
       
  2008     {
       
  2009         attribute.setEntry(ID, L"");
       
  2010         str = emptyString;
       
  2011         findIterator = (*applications).find(attribute);
       
  2012 
       
  2013         if (findIterator != (*applications).end())
       
  2014         {
       
  2015             str = (*findIterator).entryValue();
       
  2016         }
       
  2017         iStringVector.push_back(str);
       
  2018 
       
  2019         attribute.setEntry(CREATION_TIME, L"");
       
  2020         str = emptyString;
       
  2021         findIterator = (*applications).find(attribute);
       
  2022 
       
  2023         if (findIterator != (*applications).end())
       
  2024         {
       
  2025             str = (*findIterator).entryValue();
       
  2026         }
       
  2027         iStringVector.push_back(str);
       
  2028 
       
  2029         attribute.setEntry(TYPE, L"");
       
  2030         str = emptyString;
       
  2031         findIterator = (*applications).find(attribute);
       
  2032 
       
  2033         if (findIterator != (*applications).end())
       
  2034         {
       
  2035             str = (*findIterator).entryValue();
       
  2036         }
       
  2037         iStringVector.push_back(str);
       
  2038 
       
  2039         attribute.setEntry(OTA_CODE, L"");
       
  2040         str = emptyString;
       
  2041         findIterator = (*applications).find(attribute);
       
  2042 
       
  2043         if (findIterator != (*applications).end())
       
  2044         {
       
  2045             str = (*findIterator).entryValue();
       
  2046         }
       
  2047         iStringVector.push_back(str);
       
  2048 
       
  2049         attribute.setEntry(URL, L"");
       
  2050         str = emptyString;
       
  2051         findIterator = (*applications).find(attribute);
       
  2052 
       
  2053         if (findIterator != (*applications).end())
       
  2054         {
       
  2055             str = (*findIterator).entryValue();
       
  2056         }
       
  2057         iStringVector.push_back(str);
       
  2058 
       
  2059         attribute.setEntry(LATEST_RETRY_TIME, L"");
       
  2060         str = emptyString;
       
  2061         findIterator = (*applications).find(attribute);
       
  2062 
       
  2063         if (findIterator != (*applications).end())
       
  2064         {
       
  2065             str = (*findIterator).entryValue();
       
  2066         }
       
  2067         iStringVector.push_back(str);
       
  2068 
       
  2069         attribute.setEntry(RETRY_COUNT, L"");
       
  2070         str = emptyString;
       
  2071         findIterator = (*applications).find(attribute);
       
  2072 
       
  2073         if (findIterator != (*applications).end())
       
  2074         {
       
  2075             str = (*findIterator).entryValue();
       
  2076         }
       
  2077         iStringVector.push_back(str);
       
  2078 
       
  2079         rowsCount++;
       
  2080     }
       
  2081     ILOG1(EBackup, "for loop crossed with i = %d", rowsCount);
       
  2082     return rowsCount;
       
  2083 }
       
  2084