|
1 /* |
|
2 * Copyright (c) 2005 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: CMMCScBkupStateArchiveOpJavaData implementation |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "CMMCScBkupStateArchiveOpJavaData.h" |
|
20 |
|
21 // User includes |
|
22 #include "MMCScBkupLogger.h" |
|
23 #include "CMMCScBkupDataOwnerCollection.h" |
|
24 #include "CMMCScBkupDataOwnerInfo.h" |
|
25 #include "MMCScBkupSBEUtils.h" |
|
26 #include "CMMCScBkupArchive.h" |
|
27 #include "CMMCScBkupArchiveFooter.h" |
|
28 #include "CMMCScBkupIndexJavaData.h" |
|
29 #include "MMMCScBkupArchiveDataInterface.h" |
|
30 |
|
31 |
|
32 |
|
33 // ========================= MEMBER FUNCTIONS ================================ |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() |
|
37 // |
|
38 // C++ constructor. |
|
39 // --------------------------------------------------------------------------- |
|
40 CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData( MMMCScBkupDriver& aDriver ) |
|
41 : CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) |
|
42 { |
|
43 __LOG1("CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() - 0x%08x", StateId().iUid ); |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() |
|
49 // |
|
50 // Destructor. |
|
51 // --------------------------------------------------------------------------- |
|
52 CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() |
|
53 { |
|
54 Cancel(); |
|
55 // |
|
56 delete iBackupTransferObjectMidlet; |
|
57 delete iBackupTransferObjectMidletData; |
|
58 delete iRestoreTransferObjectMidlet; |
|
59 delete iRestoreTransferObjectMidletData; |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CMMCScBkupStateArchiveOpJavaData::NewL() |
|
65 // |
|
66 // |
|
67 // --------------------------------------------------------------------------- |
|
68 CMMCScBkupStateArchiveOpJavaData* CMMCScBkupStateArchiveOpJavaData::NewL( MMMCScBkupDriver& aDriver ) |
|
69 { |
|
70 CMMCScBkupStateArchiveOpJavaData* self = new(ELeave) CMMCScBkupStateArchiveOpJavaData( aDriver ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CMMCScBkupStateArchiveOpJavaData::StateId() |
|
77 // |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::StateId() const |
|
81 { |
|
82 return KMMCScBkupStateIdArchiveOpJavaData; |
|
83 } |
|
84 |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CMMCScBkupStateArchiveOpJavaData::NextStateBackupId() |
|
88 // |
|
89 // |
|
90 // --------------------------------------------------------------------------- |
|
91 TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateBackupId( TBool /*aPartial*/ ) const |
|
92 { |
|
93 return KMMCScBkupStateIdGetDataOwnerStatuses; |
|
94 } |
|
95 |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId() |
|
99 // |
|
100 // |
|
101 // --------------------------------------------------------------------------- |
|
102 TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId( TBool /*aPartial*/ ) const |
|
103 { |
|
104 return KMMCScBkupStateIdArchiveOpPassiveData; |
|
105 } |
|
106 |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() |
|
110 // |
|
111 // |
|
112 // --------------------------------------------------------------------------- |
|
113 void CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL( TBool /*aPartial*/ ) |
|
114 { |
|
115 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() - START" ); |
|
116 __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA; |
|
117 |
|
118 iBackupTransferObjectMidlet = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( |
|
119 Driver(), |
|
120 *this, |
|
121 EMMCScBkupOwnerDataTypeJavaData, |
|
122 EJavaTransferDerivedType, |
|
123 EJavaMIDlet |
|
124 ); |
|
125 |
|
126 iBackupTransferObjectMidletData = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( |
|
127 Driver(), |
|
128 *this, |
|
129 EMMCScBkupOwnerDataTypePassiveData, |
|
130 EJavaTransferDerivedType, |
|
131 EJavaMIDletData |
|
132 ); |
|
133 |
|
134 CompleteSelf(); |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() |
|
140 // |
|
141 // |
|
142 // --------------------------------------------------------------------------- |
|
143 void CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL( TBool /*aPartial*/ ) |
|
144 { |
|
145 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - START" ); |
|
146 __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA; |
|
147 |
|
148 |
|
149 iRestoreTransferObjectMidlet = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( |
|
150 Driver(), |
|
151 EMMCScBkupOwnerDataTypeJavaData, |
|
152 EJavaMIDlet |
|
153 ); |
|
154 |
|
155 iRestoreTransferObjectMidletData = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( |
|
156 Driver(), |
|
157 EMMCScBkupOwnerDataTypePassiveData, |
|
158 EJavaMIDletData |
|
159 ); |
|
160 |
|
161 CompleteSelf(); |
|
162 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - END" ); |
|
163 } |
|
164 |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() |
|
168 // |
|
169 // |
|
170 // --------------------------------------------------------------------------- |
|
171 void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) |
|
172 { |
|
173 __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - START - iCurrentJavaState: %d", iCurrentJavaState ); |
|
174 |
|
175 switch( iCurrentJavaState ) |
|
176 { |
|
177 case EJavaStateIdle: |
|
178 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateIdle"); |
|
179 BackupMidletL(); |
|
180 break; |
|
181 case EJavaStateMidlet: |
|
182 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidlet"); |
|
183 BackupMidletDataL(); |
|
184 break; |
|
185 case EJavaStateMidletData: |
|
186 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidletData"); |
|
187 iCurrentJavaState = EJavaStateIdle; |
|
188 CompleteSelf(); |
|
189 break; |
|
190 default: |
|
191 break; |
|
192 } |
|
193 |
|
194 __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); |
|
195 } |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() |
|
200 // |
|
201 // |
|
202 // --------------------------------------------------------------------------- |
|
203 void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) |
|
204 { |
|
205 __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - START - iCurrentJavaState: %d", iCurrentJavaState ); |
|
206 |
|
207 switch( iCurrentJavaState ) |
|
208 { |
|
209 case EJavaStateIdle: |
|
210 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateIdle"); |
|
211 RestoreMidletL(); |
|
212 break; |
|
213 case EJavaStateMidlet: |
|
214 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidlet"); |
|
215 RestoreMidletDataL(); |
|
216 break; |
|
217 case EJavaStateMidletData: |
|
218 __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidletData"); |
|
219 iCurrentJavaState = EJavaStateIdle; |
|
220 CompleteSelf(); |
|
221 break; |
|
222 default: |
|
223 break; |
|
224 } |
|
225 |
|
226 __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); |
|
227 } |
|
228 |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() |
|
232 // |
|
233 // |
|
234 // --------------------------------------------------------------------------- |
|
235 TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) |
|
236 { |
|
237 (void) aError; |
|
238 __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); |
|
239 |
|
240 // Reset state and move to next item. Treat the current (badly behaving) item |
|
241 // as completed/processed. |
|
242 CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); |
|
243 if ( iIndexValueCurrent < dataOwners.Count() ) |
|
244 { |
|
245 CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); |
|
246 owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); |
|
247 iCurrentJavaState = EJavaStateIdle; |
|
248 |
|
249 __LOGFILE2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - JAVA data skipped for DO", aError, owner.SecureId().iId ); |
|
250 } |
|
251 |
|
252 CompleteSelf(); |
|
253 return ETrue; |
|
254 } |
|
255 |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() |
|
259 // |
|
260 // |
|
261 // --------------------------------------------------------------------------- |
|
262 TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) |
|
263 { |
|
264 (void) aError; |
|
265 __LOGFILE1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); |
|
266 |
|
267 iCurrentJavaState = EJavaStateIdle; |
|
268 CompleteSelf(); |
|
269 return ETrue; |
|
270 } |
|
271 |
|
272 |
|
273 // --------------------------------------------------------------------------- |
|
274 // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() |
|
275 // |
|
276 // |
|
277 // --------------------------------------------------------------------------- |
|
278 void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() |
|
279 { |
|
280 if (iBackupTransferObjectMidlet) |
|
281 { |
|
282 iBackupTransferObjectMidlet->Cancel(); |
|
283 } |
|
284 if (iBackupTransferObjectMidletData) |
|
285 { |
|
286 iBackupTransferObjectMidletData->Cancel(); |
|
287 } |
|
288 if (iRestoreTransferObjectMidlet) |
|
289 { |
|
290 iRestoreTransferObjectMidlet->Cancel(); |
|
291 } |
|
292 if (iRestoreTransferObjectMidletData) |
|
293 { |
|
294 iRestoreTransferObjectMidletData->Cancel(); |
|
295 } |
|
296 } |
|
297 |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL() |
|
301 // |
|
302 // |
|
303 // --------------------------------------------------------------------------- |
|
304 void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL( TBool /*aPartial*/ ) |
|
305 { |
|
306 CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); |
|
307 index.StoreL( Driver() ); |
|
308 } |
|
309 |
|
310 |
|
311 // --------------------------------------------------------------------------- |
|
312 // CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL() |
|
313 // |
|
314 // |
|
315 // --------------------------------------------------------------------------- |
|
316 void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL( TBool /*aPartial*/ ) |
|
317 { |
|
318 } |
|
319 |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 // CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() |
|
323 // |
|
324 // |
|
325 // --------------------------------------------------------------------------- |
|
326 void CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) |
|
327 { |
|
328 CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeJavaData ); |
|
329 CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); |
|
330 // |
|
331 TJavaTransferType type = EJavaMIDlet; |
|
332 HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aDataOwner.Owner().Identifier() ); |
|
333 // |
|
334 if ( iCurrentJavaState == EJavaStateMidlet ) |
|
335 { |
|
336 __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDlet", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); |
|
337 type = EJavaMIDlet; |
|
338 } |
|
339 else if ( iCurrentJavaState == EJavaStateMidletData ) |
|
340 { |
|
341 __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDletData", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); |
|
342 type = EJavaMIDletData; |
|
343 } |
|
344 // |
|
345 index.AddIndexRecordL( aInfo, *hash, aDrive, type ); |
|
346 CleanupStack::PopAndDestroy( hash ); |
|
347 } |
|
348 |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CMMCScBkupStateArchiveOpJavaData::BackupMidletL() |
|
352 // |
|
353 // |
|
354 // --------------------------------------------------------------------------- |
|
355 void CMMCScBkupStateArchiveOpJavaData::BackupMidletL() |
|
356 { |
|
357 CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); |
|
358 const TInt count = dataOwners.Count(); |
|
359 // |
|
360 while ( ++iIndexValueCurrent < count ) |
|
361 { |
|
362 CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); |
|
363 // |
|
364 if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) |
|
365 { |
|
366 #ifdef __MMCSCBKUPLOGGING_ENABLED__ |
|
367 HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); |
|
368 __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletL() - trying to get midlet for hash: %S", hash ); |
|
369 CleanupStack::PopAndDestroy( hash ); |
|
370 #endif |
|
371 |
|
372 iBackupTransferObjectMidlet->RequestL( owner, |
|
373 iStatus, |
|
374 Driver().DrvParamsBase().DriveAndOperations() ); |
|
375 SetActive(); |
|
376 iCurrentJavaState = EJavaStateMidlet; |
|
377 |
|
378 break; // while loop |
|
379 } |
|
380 } |
|
381 } |
|
382 |
|
383 |
|
384 // --------------------------------------------------------------------------- |
|
385 // CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() |
|
386 // |
|
387 // |
|
388 // --------------------------------------------------------------------------- |
|
389 void CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() |
|
390 { |
|
391 CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); |
|
392 CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); |
|
393 |
|
394 // We only need to request the midlet's passive data if it has a non-zero |
|
395 // size. |
|
396 if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) |
|
397 { |
|
398 if ( owner.OperationalSize( EMMCScBkupOwnerDataTypePassiveData ) > 0 ) |
|
399 { |
|
400 #ifdef __MMCSCBKUPLOGGING_ENABLED__ |
|
401 HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); |
|
402 __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() - trying to get midlet data for hash: %S", hash ); |
|
403 CleanupStack::PopAndDestroy( hash ); |
|
404 #endif |
|
405 |
|
406 iBackupTransferObjectMidletData->RequestL( owner, |
|
407 iStatus, |
|
408 Driver().DrvParamsBase().DriveAndOperations() ); |
|
409 SetActive(); |
|
410 } |
|
411 else |
|
412 { |
|
413 CompleteSelf(); |
|
414 } |
|
415 } |
|
416 else |
|
417 { |
|
418 CompleteSelf(); |
|
419 } |
|
420 |
|
421 iCurrentJavaState = EJavaStateMidletData; |
|
422 } |
|
423 |
|
424 |
|
425 // --------------------------------------------------------------------------- |
|
426 // CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() |
|
427 // |
|
428 // |
|
429 // --------------------------------------------------------------------------- |
|
430 void CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() |
|
431 { |
|
432 CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); |
|
433 CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); |
|
434 |
|
435 const TInt count = index.Count(); |
|
436 __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - START - %d data owners...", count ); |
|
437 // |
|
438 if ( ++iIndexValueCurrent < count ) |
|
439 { |
|
440 __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); |
|
441 const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); |
|
442 |
|
443 // Get the associated data owner |
|
444 CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); |
|
445 |
|
446 __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to get data owner info for hash: %S", &entry.Hash() ); |
|
447 CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); |
|
448 |
|
449 if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) |
|
450 { |
|
451 // Request all the java data (on all supported drives) for this |
|
452 // particular data owner |
|
453 __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to restore JAVA MIDLET for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletInfo().Offset(), entry.MidletInfo().Length() ); |
|
454 |
|
455 // Build restore entry list (will only contain one entry - the |
|
456 // reader API forces an array interface on us, so let's do ou best |
|
457 // to please it...) |
|
458 const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletInfo() ); |
|
459 iRestoreEntries.Reset(); |
|
460 iRestoreEntries.AppendL( driveAndVector ); |
|
461 |
|
462 // Start the asynchronous restore op... |
|
463 iRestoreTransferObjectMidlet->RequestL( owner, |
|
464 iStatus, |
|
465 iRestoreEntries ); |
|
466 SetActive(); |
|
467 } |
|
468 else |
|
469 { |
|
470 CompleteSelf(); |
|
471 } |
|
472 |
|
473 iCurrentJavaState = EJavaStateMidlet; |
|
474 } |
|
475 } |
|
476 |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() |
|
480 // |
|
481 // |
|
482 // --------------------------------------------------------------------------- |
|
483 void CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() |
|
484 { |
|
485 CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); |
|
486 CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); |
|
487 |
|
488 const TInt count = index.Count(); |
|
489 __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - START - %d data owners...", count ); |
|
490 // |
|
491 if ( iIndexValueCurrent < count ) |
|
492 { |
|
493 __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); |
|
494 const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); |
|
495 |
|
496 if ( entry.HasMidletDataInfo() ) |
|
497 { |
|
498 // Get the associated data owner |
|
499 CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); |
|
500 |
|
501 __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to get data owner info for hash: %S", &entry.Hash() ); |
|
502 CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); |
|
503 |
|
504 if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) |
|
505 { |
|
506 // Request all the java data (on all supported drives) for this |
|
507 // particular data owner |
|
508 __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to restore JAVA MIDLET DATA for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletDataInfo().Offset(), entry.MidletDataInfo().Length() ); |
|
509 |
|
510 // Build restore entry list (will only contain one entry - the |
|
511 // reader API forces an array interface on us, so let's do ou best |
|
512 // to please it...) |
|
513 const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletDataInfo() ); |
|
514 iRestoreEntries.Reset(); |
|
515 iRestoreEntries.AppendL( driveAndVector ); |
|
516 |
|
517 // Start the asynchronous restore op... |
|
518 iRestoreTransferObjectMidletData->RequestL( owner, |
|
519 iStatus, |
|
520 iRestoreEntries ); |
|
521 SetActive(); |
|
522 } |
|
523 else |
|
524 { |
|
525 CompleteSelf(); |
|
526 } |
|
527 } |
|
528 else |
|
529 { |
|
530 CompleteSelf(); |
|
531 } |
|
532 } |
|
533 else |
|
534 { |
|
535 CompleteSelf(); |
|
536 } |
|
537 |
|
538 iCurrentJavaState = EJavaStateMidletData; |
|
539 } |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |