|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Header file for Java Secure Backup Core JsbcDataOwner class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef JSBCDATAOWNER_H |
|
20 #define JSBCDATAOWNER_H |
|
21 |
|
22 #include <abclient.h> |
|
23 |
|
24 namespace java |
|
25 { |
|
26 namespace backup |
|
27 { |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CBackupPlugin; |
|
31 class CJsbcActive; |
|
32 |
|
33 |
|
34 /** |
|
35 * CJsbcDataOwner class is implemeting the active backup of Java Domain |
|
36 */ |
|
37 class CJsbcDataOwner : public CBase, |
|
38 public conn::MActiveBackupDataClient |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 static CJsbcDataOwner* NewL(CJsbcActive* aJsbcActive); |
|
44 static CJsbcDataOwner* NewLC(CJsbcActive* aJsbcActive); |
|
45 ~CJsbcDataOwner(); |
|
46 |
|
47 /** |
|
48 * This method is called when a backup or restore operation is |
|
49 * starting. Preparations can be done to prepare for BUR. |
|
50 * |
|
51 * @param aBackupStateValue the value of the current backup state |
|
52 */ |
|
53 void PrepareForBURL(TInt aBackupStateValue); |
|
54 |
|
55 // from base class MActiveBackupDataClient |
|
56 |
|
57 /** |
|
58 * This method informs the active backup data client that all |
|
59 * snapshots have been supplied. If the client has not |
|
60 * received a snapshot then it should perform a base backup |
|
61 */ |
|
62 void AllSnapshotsSuppliedL(); |
|
63 |
|
64 /** |
|
65 * This method receives all or part of a snapshot of data to allow |
|
66 * calculation of an incremental backup. The snapshot is one that |
|
67 * was previously supplied by the data owner. The snapshot data |
|
68 * should be read from the location supplied. The snapshot data may |
|
69 * be larger than the location supplied in which case the routine |
|
70 * will be called repeatedly until all data has been supplied. |
|
71 * |
|
72 * Snapshot data will also be supplied as part of a restore operation |
|
73 * |
|
74 * @param aDrive the drive being backed up |
|
75 * @param aBuffer a pointer to the base of the location from whence |
|
76 * data can be copied. |
|
77 * @param aLastSection ETrue if this is the last section of snapshot |
|
78 * data, else EFalse. |
|
79 */ |
|
80 void ReceiveSnapshotDataL(TDriveNumber aDrive, |
|
81 TDesC8& aBuffer, |
|
82 TBool aLastSection); |
|
83 |
|
84 /** |
|
85 * This method returns the expected size of backup data that will be |
|
86 * supplied. If an incremental backup is underway then this method |
|
87 * then this method will not be called until after |
|
88 * ReceiveSnapshotDataL(). The size data will be used for the purpose |
|
89 * of tracking progess during a backup. If it is inaccurate then the |
|
90 * user may see irregular progress but the actual backup data will |
|
91 * not be affected so it is acceptable to return an estimated value. |
|
92 * |
|
93 * @param aDrive the drive being backed up. |
|
94 * @return the size of the data that will be returned |
|
95 */ |
|
96 TUint GetExpectedDataSize(TDriveNumber aDrive); |
|
97 |
|
98 /** |
|
99 * This method returns a snapshot of data to accompany a backup. The |
|
100 * snapshot is expected to contain details on files / data being |
|
101 * backed up. The format of the snapshot is only meaningful to the |
|
102 * data owner. The snapshot will be supplied if the data owner is |
|
103 * asked for an incremental backup and for a restore operation. The |
|
104 * snapshot data should be copied to the location supplied. |
|
105 * |
|
106 * The snapshot data may be larger than the location supplied in |
|
107 * which case the routine will be called repeatedly until all data |
|
108 * has been retrieved. |
|
109 * |
|
110 * @param aDrive the drive being backed up |
|
111 * @param aBuffer a pointer to the base of the location where data |
|
112 * can be copied. |
|
113 * @param aFinished on return ETrue if all data has been returned |
|
114 * for this drive, else EFalse. |
|
115 */ |
|
116 void GetSnapshotDataL(TDriveNumber aDrive, |
|
117 TPtr8& aBuffer, |
|
118 TBool& aFinished); |
|
119 |
|
120 /** |
|
121 * This method prepares the implementor to return backup data. It |
|
122 * will be followed by a sequence of calls to request the actual |
|
123 * data. |
|
124 * |
|
125 * @param aDrive the drive being backed up. |
|
126 */ |
|
127 void InitialiseGetBackupDataL(TDriveNumber aDrive); |
|
128 |
|
129 /** |
|
130 * This method requests a section of backup data. |
|
131 * InitialiseGetBackupDataL() will have been called previously to |
|
132 * specify the drive concerned. The data returned may be base or |
|
133 * incremental depending on the type of backup and the capability of |
|
134 * the data owner. |
|
135 * |
|
136 * @param aBuffer a pointer to the base of the location where data |
|
137 * can be copied. |
|
138 * @param aFinished on return ETrue if all data has been returned |
|
139 * for this drive, else EFalse. |
|
140 */ |
|
141 void GetBackupDataSectionL(TPtr8& aBuffer, |
|
142 TBool& aFinished); |
|
143 |
|
144 /** |
|
145 * This method prepares the implementor to receive base restore data |
|
146 * for a drive. It will be followed by a sequence of calls to supply |
|
147 * the actual data. |
|
148 * |
|
149 * @param aDrive the drive being restored. |
|
150 */ |
|
151 void InitialiseRestoreBaseDataL(TDriveNumber aDrive); |
|
152 |
|
153 /** |
|
154 * This method receives a section of base restore data. |
|
155 * InitialiseRestoreBaseDataL() will have been called previously to |
|
156 * specify the drive concerned. |
|
157 * |
|
158 * @param aBuffer a pointer to the base of the location whence data |
|
159 * can be read. |
|
160 * @param aFinished ETrue if all data has been returned for this |
|
161 * drive, else EFalse. |
|
162 */ |
|
163 void RestoreBaseDataSectionL(TDesC8& aBuffer, |
|
164 TBool aFinished); |
|
165 |
|
166 /** |
|
167 * This method prepares the implementor to receive incremental |
|
168 * restore data for a drive. It will be followed by a sequence |
|
169 * of calls to supply the actual data. If multiple increments |
|
170 * are supplied then this methid will be called before each increment |
|
171 * |
|
172 * @param aDrive the drive being restored. |
|
173 */ |
|
174 void InitialiseRestoreIncrementDataL(TDriveNumber aDrive); |
|
175 |
|
176 /** |
|
177 * This method receives a section of increment restore data. |
|
178 * InitialiseRestoreIncrementDataL() will have been called |
|
179 * previously to specify the drive concerned. |
|
180 * |
|
181 * @param aBuffer a pointer to the base of the location whence data |
|
182 * can be read. |
|
183 * @param aFinished ETrue if all data has been returned for this |
|
184 * increment, else EFalse. |
|
185 */ |
|
186 void RestoreIncrementDataSectionL(TDesC8& aBuffer, |
|
187 TBool aFinished); |
|
188 |
|
189 /** |
|
190 * This method is called when all data to be restored has been |
|
191 * supplied. |
|
192 * |
|
193 * @param aDrive the drive being restored. |
|
194 */ |
|
195 void RestoreComplete(TDriveNumber aDrive); |
|
196 |
|
197 /** |
|
198 * This method is called if copying of data is terminated prematurely |
|
199 * to allow the implementor to tidy up. The same method applies to |
|
200 * all types of data and to backup and restore. |
|
201 */ |
|
202 void TerminateMultiStageOperation(); |
|
203 |
|
204 /** |
|
205 * Gets a 32-bit checksum for its private data. |
|
206 * This routine is for test purposes. It must be implemented but an |
|
207 * invariant checksum value can be provided. Some tests may cause |
|
208 * checksum values to be compared. |
|
209 * |
|
210 * @param aDrive the drive containing data being checksummed |
|
211 * @return the 32-bit checksum |
|
212 */ |
|
213 TUint GetDataChecksum(TDriveNumber aDrive); |
|
214 |
|
215 private: |
|
216 |
|
217 CJsbcDataOwner(); |
|
218 |
|
219 void ConstructL(CJsbcActive* aJsbcActive); |
|
220 |
|
221 private: // data |
|
222 |
|
223 /** |
|
224 * MIDP2 Backup Plugin |
|
225 * Own. |
|
226 */ |
|
227 CBackupPlugin* iPlugin; |
|
228 |
|
229 /** |
|
230 * JSBCActive object (which instantiated this object) |
|
231 * Not own. |
|
232 */ |
|
233 CJsbcActive* iJsbcActive; |
|
234 }; |
|
235 |
|
236 } // namespace backup |
|
237 } // namespace java |
|
238 |
|
239 #endif // JSBCDATAOWNER_H |