|
1 /** |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifndef __STORAGE_MANAGER_H__ |
|
26 #define __STORAGE_MANAGER_H__ |
|
27 |
|
28 #include <e32cmn.h> |
|
29 #include <s32file.h> |
|
30 #include "t_burteststepbase.h" |
|
31 |
|
32 using namespace conn; |
|
33 |
|
34 namespace bur_ts |
|
35 { |
|
36 // Forward declaration |
|
37 class CBURTestStepBase; |
|
38 |
|
39 class CStorageManager : public CBase |
|
40 /** |
|
41 Handles storage management for both backup and restore. |
|
42 |
|
43 @released |
|
44 @internalComponent |
|
45 */ |
|
46 { |
|
47 public: |
|
48 static CStorageManager* NewL(const TFileName& aBackupDirName, TDriveList aDriveList, CBURTestStepBase* aTestStep); |
|
49 ~CStorageManager(); |
|
50 |
|
51 // Stores data in the archive during a backup operation |
|
52 void ArchiveDataL(CSBGenericTransferType* aTransferType, const TDesC8& aData, TBool aFinished); |
|
53 |
|
54 // Retrieves data from the archive during a restore operation |
|
55 void RetrieveDataL(CSBGenericTransferType* aTransferType, TDes8& aData, TBool& aFinished, TInt aIndex = 0); |
|
56 |
|
57 // generates transfer type array by parsing archive directory |
|
58 //void GenerateSIDTransferTypeArrayL(RTransferTypeArray& aArray, TTransferDataType aDataType); |
|
59 |
|
60 // returns total number of files stored in the directory for Incrementals |
|
61 TInt TotalIncFiles(CSBSIDTransferType* aTransferType); |
|
62 |
|
63 void SaveDataOwnerL(CDataOwnerInfo& aDataOwner); |
|
64 |
|
65 void ReadDataOwnersFromDiskL(RDataOwnerArray& aArray); |
|
66 |
|
67 void GetFileNameL(CSBGenericTransferType* aTransferType, TFileName& aFileName, TBool aBackup, TInt aIndex = 1); |
|
68 |
|
69 TBool IsFileExists(TFileName& aFileName); |
|
70 |
|
71 void Reset(); |
|
72 |
|
73 private: |
|
74 CStorageManager(const TFileName& aBackupDirName, TDriveList aDriveList, CBURTestStepBase* aTestStep); |
|
75 void ConstructL(); |
|
76 |
|
77 // Following methods implement the backup archive naming scheme: |
|
78 void GetSIDFileNameL(CSBSIDTransferType* aTransferType, TFileName& aFileName); |
|
79 void GetSIDPrivateDirName(TChar aDrive, TSecureId aSeID, TFileName& aFileName) const; |
|
80 |
|
81 void GetPIDFileNameL(CSBPackageTransferType* aTransferType, TFileName& aFileName); |
|
82 void GetJavaFileNameL(CSBJavaTransferType* aTransferType, TFileName& aFileName); |
|
83 |
|
84 void GetJavaPrivateDirName(TChar aDrive, const TDesC& aSuiteHash, TFileName& aFileName); |
|
85 |
|
86 void GenerateIncNumber(TInt aIndex, TDes& aDes); |
|
87 |
|
88 void WriteToDiskL(TFileName& aFileName, const TDesC8& aData); |
|
89 |
|
90 void ReadFromDiskL(TFileName& aFileName, TDes8& aData, TBool& aFinished); |
|
91 |
|
92 private: |
|
93 /** The name of the backup directory */ |
|
94 TFileName iBackupDirName; |
|
95 |
|
96 /** List of drives being backed up */ |
|
97 TDriveList iDriveList; |
|
98 |
|
99 /** Parent test step for callbacks to various logging methods */ |
|
100 CBURTestStepBase* iTestStep; |
|
101 |
|
102 /** Last file it which was written to */ |
|
103 TFileName iLastFile; |
|
104 |
|
105 /** firstSupply */ |
|
106 TBool iFirstSupply; |
|
107 |
|
108 /** bytes read */ |
|
109 TInt iBytesRead; |
|
110 }; |
|
111 } |
|
112 |
|
113 #endif // __STORAGE_MANAGER_H__ |
|
114 |