|
1 /** |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Declaration of CDataOwnerManager |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 */ |
|
25 #ifndef __DATAOWNERMANAGER_H__ |
|
26 #define __DATAOWNERMANAGER_H__ |
|
27 |
|
28 // System |
|
29 #include <e32base.h> |
|
30 #include <connect/sbtypes.h> |
|
31 #include <f32file.h> |
|
32 #include <e32property.h> |
|
33 #include <swi/sisregistrysession.h> |
|
34 #include <badesca.h> |
|
35 |
|
36 #include "sbeconfig.h" |
|
37 #include "sbeparserproxy.h" |
|
38 #include <connect/javamanagerinterface.h> |
|
39 |
|
40 |
|
41 // Forwards |
|
42 class CBaBackupSessionWrapper; |
|
43 class CARC4; |
|
44 |
|
45 |
|
46 |
|
47 namespace conn |
|
48 { |
|
49 // Forwards |
|
50 class CDataOwner; |
|
51 class CABServer; |
|
52 class CBufferFileReader; |
|
53 class CPackageDataTransfer; |
|
54 class CDataOwnerManager; |
|
55 class CJavaDataOwnerManager; |
|
56 class CSecureBUREncryptKeySource; |
|
57 class CSBEDecompressAndEncrypt; |
|
58 |
|
59 /** The current request state |
|
60 @internalComponent |
|
61 */ |
|
62 enum TState |
|
63 { |
|
64 ENone, /*<! The DataOwnerManager is not requesting or supplying */ |
|
65 ERequest, /*<! The DataOwnerManager is currently dealing with a request */ |
|
66 ESupply, /*<! The DataOwnerManager is currently dealing with a supply */ |
|
67 EBuffer /*<! The DataOwnerManager is currently dealing with buffering */ |
|
68 }; |
|
69 |
|
70 // Globals |
|
71 _LIT(KStar, "*"); |
|
72 _LIT(KPrivate, "\\private\\"); |
|
73 _LIT(KBackSlash, "\\"); |
|
74 _LIT(KColon, ":"); |
|
75 _LIT(KBackupRegistrationFile, "backup_registration*.xml"); |
|
76 _LIT(KPrimaryBackupRegistrationFile, "backup_registration.xml"); |
|
77 _LIT(KImportDir, "\\private\\10202D56\\import\\packages\\"); |
|
78 |
|
79 /** |
|
80 Simple container to map Secure ID's to there assocaited Data Owner |
|
81 @internalComponent |
|
82 */ |
|
83 class CDataOwnerContainer : public CBase |
|
84 { |
|
85 public: |
|
86 static CDataOwnerContainer* NewL(TSecureId aSid, CDataOwnerManager* apDataOwnerManager); |
|
87 ~CDataOwnerContainer(); |
|
88 |
|
89 static TInt Compare(const CDataOwnerContainer& aFirst, const CDataOwnerContainer& aSecond); |
|
90 static TBool Match(const CDataOwnerContainer& aFirst, const CDataOwnerContainer& aSecond); |
|
91 |
|
92 TSecureId SecureId() const; |
|
93 CDataOwner& DataOwner() const; |
|
94 private: |
|
95 CDataOwnerContainer(TSecureId aSID); |
|
96 void ConstructL(CDataOwnerManager* apDataOwnerManager); |
|
97 private: |
|
98 TSecureId iSecureId; /*<! Contains the secure ID */ |
|
99 CDataOwner* ipDataOwner; /*<! Contains the data owner.*/ |
|
100 }; |
|
101 |
|
102 /** The state of the data owner manager |
|
103 @internalComponent |
|
104 */ |
|
105 class TDOMState |
|
106 { |
|
107 public: |
|
108 TState iState; /*<! The current state of the DataOwnerManager */ |
|
109 TSecureId iSID; /*<! The secure ID we are currently working with */ |
|
110 }; |
|
111 |
|
112 /** |
|
113 Manager for data owners. |
|
114 @internalTechnology |
|
115 */ |
|
116 class CDataOwnerManager : public CBase |
|
117 { |
|
118 |
|
119 public: |
|
120 // Construction |
|
121 static CDataOwnerManager* NewLC(); |
|
122 ~CDataOwnerManager(); |
|
123 |
|
124 // Methods |
|
125 void SetBURModeL(const TDriveList& aDriveList, TBURPartType aBURType, |
|
126 TBackupIncType aBackupIncType); |
|
127 void GetDataOwnersL(RPointerArray<CDataOwnerInfo>& aDataOwners); |
|
128 void GetExpectedDataSizeL(CSBGenericTransferType* aGenericTransferType, TUint& aSize); |
|
129 void GetPublicFileListL(CSBGenericDataType* aGenericDataType, TDriveNumber aDriveNumber, RFileArray& aFiles); |
|
130 void GetRawPublicFileListL(CSBGenericDataType* aGenericDataType, TDriveNumber aDriveNumber, |
|
131 RRestoreFileFilterArray& aRestoreFileFilter); |
|
132 void GetXMLPublicFileListL(TSecureId aSID, TDriveNumber aDriveNumber, HBufC*& aBuffer); |
|
133 |
|
134 void SetSIDListForPartialBURL(TDesC8& aFlatArrayPtr); |
|
135 void SIDStatusL(RSIDStatusArray& aSIDStatus); |
|
136 void AllSnapshotsSuppliedL(); |
|
137 void GetNextPublicFileL(CSBGenericDataType* aGenericDataType, TBool aReset, |
|
138 TDriveNumber aDriveNumber, TEntry& aEntry); |
|
139 |
|
140 // Global heap |
|
141 void SupplyDataL(CSBGenericTransferType* aGenericTransferType, TDesC8& aBuffer, |
|
142 TBool aLastSection); |
|
143 void RequestDataL(CSBGenericTransferType* aGenericTransferType, |
|
144 TPtr8& aBuffer, TBool& aLastSection); |
|
145 |
|
146 // Accessors |
|
147 void SetActiveBackupServer(CABServer* aABServer); |
|
148 RFs& GetRFs(); |
|
149 CABServer& ABServer(); |
|
150 CDataOwner& DataOwnerL(TSecureId aSID); |
|
151 |
|
152 TDriveList& DriveList(); |
|
153 TBURPartType BURType() const; |
|
154 TBackupIncType IncType() const; |
|
155 void AllSystemFilesRestoredL(); |
|
156 |
|
157 CSBEConfig& Config(); |
|
158 inline CSBEParserProxy& ParserProxy(); |
|
159 TBool IsSetForPartialL(TSecureId aSecureId) const; |
|
160 |
|
161 private: |
|
162 // Constructor |
|
163 void ConstructL(); |
|
164 CDataOwnerManager(); |
|
165 |
|
166 // Methods |
|
167 void FindDataOwnersL(); |
|
168 CDataOwnerContainer* FindL(TSecureId aSID); |
|
169 CPackageDataTransfer* FindPackageDataContainerL(TUid pid); |
|
170 void StripSecureIdL(const TDesC& aStrip, TSecureId& aSecureId); |
|
171 void UpdateDataOwnersPartialStateL(); |
|
172 void FindImportPackagesL(Swi::RSisRegistrySession& aRegistry, RPointerArray<CDataOwnerInfo>& aDataOwners); |
|
173 void FindRegistrationFilesL(const TDesC& aPath, CDesCArray& aFiles); |
|
174 private: |
|
175 RPointerArray<CDataOwnerContainer> iDataOwners; /*<! An array of TDataOwnerContainers */ |
|
176 RPointerArray<CPackageDataTransfer> iPackageDataOwners; /*<! An array of package data transfer objects */ |
|
177 TDOMState iState; /*!< The state of the DataOwnerManager */ |
|
178 |
|
179 // Current backup options (set in SetBURModeL -> needed for active clients) |
|
180 TDriveList iDriveList; /*<! Drive list for backup */ |
|
181 TBURPartType iBURType; /*<! Backup/restore type */ |
|
182 TBackupIncType iIncType; /*<! Incrementatl type */ |
|
183 |
|
184 // Resources |
|
185 CABServer* ipABServer; /*!< The active backup server */ |
|
186 RFs iFs; /*!< A RFs used in this class and all DataOwners */ |
|
187 CBufferFileReader* iBufferFileReader; /*<! Used to restore registration files */ |
|
188 CSBEDecompressAndEncrypt* iDecompressor; |
|
189 |
|
190 /** Set to true if we need to reset the device after a restore */ |
|
191 TBool iResetAfterRestore; |
|
192 |
|
193 /** Object to handle Java data owners */ |
|
194 CJavaManagerInterface* iJavaDOM; |
|
195 |
|
196 /** List of Secure IDs for Partial Restore */ |
|
197 RSIDArray* iSIDListForPartial; |
|
198 |
|
199 /** Config for SBE */ |
|
200 CSBEConfig* iConfig; |
|
201 |
|
202 /** Base Backup Session Wrapper */ |
|
203 CBaBackupSessionWrapper* iBaBackupSession; |
|
204 |
|
205 /** Backup Registration Parser Proxy */ |
|
206 CSBEParserProxy* iParserProxy; |
|
207 }; |
|
208 |
|
209 inline TDriveList& CDataOwnerManager::DriveList() |
|
210 /** |
|
211 Return the list of drives specified for the operation |
|
212 @return Drivelist |
|
213 */ |
|
214 { |
|
215 return iDriveList; |
|
216 } |
|
217 |
|
218 inline TBURPartType CDataOwnerManager::BURType() const |
|
219 /** |
|
220 Return the partial backup type |
|
221 @return The partial backup type |
|
222 */ |
|
223 { |
|
224 return iBURType; |
|
225 } |
|
226 |
|
227 inline TBackupIncType CDataOwnerManager::IncType() const |
|
228 /** |
|
229 Return the incremental backup type |
|
230 @return The incremental backup type |
|
231 */ |
|
232 { |
|
233 return iIncType; |
|
234 } |
|
235 |
|
236 /** |
|
237 Return Active Backup Server |
|
238 @return reference to Active Backup Server |
|
239 */ |
|
240 inline CABServer& CDataOwnerManager::ABServer() |
|
241 { |
|
242 return *ipABServer; |
|
243 } |
|
244 |
|
245 /** |
|
246 Return Parser Proxy |
|
247 @return reference to Parser Proxy |
|
248 */ |
|
249 inline CSBEParserProxy& CDataOwnerManager::ParserProxy() |
|
250 { |
|
251 return *iParserProxy; |
|
252 } |
|
253 |
|
254 } // namespace conn |
|
255 #endif // __DATAOWNERMANAGER_H__ |