|
1 /* |
|
2 * Copyright (c) 2006 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: Contains CNcdOperationManagerProxy class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_OPERATION_MANAGER_PROXY_H |
|
20 #define NCD_OPERATION_MANAGER_PROXY_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32cmn.h> |
|
25 |
|
26 #include "ncdbaseproxy.h" |
|
27 #include "ncdoperationproxyremovehandler.h" |
|
28 #include "ncdnodefunctionids.h" |
|
29 #include "ncdoperationdatatypes.h" |
|
30 #include "ncdchildloadmode.h" |
|
31 #include "ncdsearchfilter.h" |
|
32 #include "ncdsubscriptionoperation.h" |
|
33 #include "ncddownloadoperationobserver.h" |
|
34 |
|
35 class MNcdOperation; |
|
36 class CNcdLoadNodeOperationProxy; |
|
37 class CNcdNodeProxy; |
|
38 class CNcdDownloadOperationProxy; |
|
39 class CNcdFileDownloadOperationProxy; |
|
40 class MNcdDownloadOperationObserver; |
|
41 class MNcdFileDownloadOperationObserver; |
|
42 class CNcdPurchaseOperationProxy; |
|
43 class MNcdPurchaseOperationObserver; |
|
44 class CNcdNodeManagerProxy; |
|
45 class CNcdNodeIdentifier; |
|
46 class CNcdPurchaseOptionProxy; |
|
47 class CNcdInstallOperationProxy; |
|
48 class CNcdSilentInstallOperationProxy; |
|
49 class MNcdInstallOperationObserver; |
|
50 class CNcdRightsObjectOperationProxy; |
|
51 class MNcdRightsObjectOperationObserver; |
|
52 class CNcdSubscriptionOperationProxy; |
|
53 class MNcdSubscriptionOperationObserver; |
|
54 class MNcdInstallationService; |
|
55 class MNcdClientLocalizer; |
|
56 class MNcdCreateAccessPointOperationObserver; |
|
57 class CNcdCreateAccessPointOperationProxy; |
|
58 class MNcdSendHttpRequestOperationObserver; |
|
59 class CNcdSendHttpRequestOperationProxy; |
|
60 class TNcdConnectionMethod; |
|
61 class CNcdServerReportOperationProxy; |
|
62 class MNcdServerReportOperationObserver; |
|
63 |
|
64 |
|
65 // Forward declaration for silent install |
|
66 // SwiUI::TInstallOptions |
|
67 namespace SwiUI |
|
68 { |
|
69 class TInstallOptions; |
|
70 } |
|
71 |
|
72 /** |
|
73 * CNodeManagerProxy provides functions to ... |
|
74 * @lib ?library |
|
75 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
76 */ |
|
77 class CNcdOperationManagerProxy : public CNcdBaseProxy, |
|
78 public MNcdOperationProxyRemoveHandler, |
|
79 public MNcdDownloadOperationObserver |
|
80 { |
|
81 |
|
82 public: |
|
83 |
|
84 /** |
|
85 * NewL |
|
86 * |
|
87 * @return CNcdOperationManagerProxy* Pointer to the created object |
|
88 * of this class. |
|
89 */ |
|
90 static CNcdOperationManagerProxy* NewL( MCatalogsClientServer& aSession, |
|
91 TInt aHandle ); |
|
92 |
|
93 /** |
|
94 * NewLC |
|
95 * |
|
96 * @return CNcdOperationManagerProxy* Pointer to the created object |
|
97 * of this class. |
|
98 */ |
|
99 static CNcdOperationManagerProxy* NewLC( MCatalogsClientServer& aSession, |
|
100 TInt aHandle ); |
|
101 |
|
102 |
|
103 /** |
|
104 * Destructor |
|
105 * |
|
106 * Deletes the nodes from the node cache. |
|
107 */ |
|
108 virtual ~CNcdOperationManagerProxy(); |
|
109 |
|
110 /** |
|
111 * Sets the localizer object. |
|
112 * |
|
113 * @param aLocalizer The localizer. |
|
114 */ |
|
115 void SetClientLocalizer( MNcdClientLocalizer& aLocalizer ); |
|
116 |
|
117 |
|
118 /** |
|
119 * Creates a load node children operation. |
|
120 * |
|
121 * @leave |
|
122 * @param aNode The node to be loaded. |
|
123 * @return Load node operation. |
|
124 */ |
|
125 virtual CNcdLoadNodeOperationProxy* CreateLoadNodeOperationL( |
|
126 CNcdNodeProxy& aNode, TBool aLoadChildren = EFalse, TInt aPageSize = 0, |
|
127 TInt aPageStart = 0, TInt aDepth = 0, |
|
128 TNcdChildLoadMode aMode = ELoadStructure, |
|
129 MNcdSearchFilter* aSearchFilter = NULL ); |
|
130 |
|
131 /** |
|
132 * Creates a load root node operation. |
|
133 * |
|
134 * @leave |
|
135 * @param aNode The node to be loaded. |
|
136 * @return Load node operation. |
|
137 */ |
|
138 virtual CNcdLoadNodeOperationProxy* CreateLoadRootNodeOperationL( |
|
139 CNcdNodeProxy& aNode ); |
|
140 |
|
141 /** |
|
142 * Creates a load bundle node operation. |
|
143 * |
|
144 * @leave |
|
145 * @param aNode The node to be loaded. |
|
146 * @return Load node operation. |
|
147 */ |
|
148 virtual CNcdLoadNodeOperationProxy* CreateLoadBundleNodeOperationL( |
|
149 CNcdNodeProxy& aNode ); |
|
150 |
|
151 /** |
|
152 * Creates download operation |
|
153 * |
|
154 * @param aType Type of the download |
|
155 * @param aNode Proxy of the node that provides information for the operation |
|
156 * @param aDataId Identifier for the data the download is downloading. |
|
157 * @param aObserver Observer |
|
158 * @param aDownloadIndex Index of the item that will be downloaded |
|
159 * @return A download proxy. Returns an existing download if type and |
|
160 * data ID match with an existing download, |
|
161 * |
|
162 * Data ID is used only on the proxyside for comparing downloads. |
|
163 */ |
|
164 virtual CNcdDownloadOperationProxy* CreateDownloadOperationL( |
|
165 TNcdDownloadDataType aType, |
|
166 CNcdNodeProxy& aNode, |
|
167 const TDesC& aDataId, |
|
168 MNcdDownloadOperationObserver* aObserver, |
|
169 TInt aDownloadIndex = 0 ); |
|
170 |
|
171 /** |
|
172 * Creates a file download operation |
|
173 * |
|
174 * @param aType Type of the download |
|
175 * @param aNode Node |
|
176 * @param aTargetPath Download target |
|
177 * @return a new file download |
|
178 */ |
|
179 virtual CNcdFileDownloadOperationProxy* CreateFileDownloadOperationL( |
|
180 TNcdDownloadDataType aType, |
|
181 CNcdNodeProxy& aNode, |
|
182 MNcdFileDownloadOperationObserver* aObserver, |
|
183 const TDesC& aTargetPath ); |
|
184 |
|
185 |
|
186 /** |
|
187 * Creates a generic file download operation |
|
188 * |
|
189 * @param aUri Source URI |
|
190 * @param aTargetPath Download target |
|
191 * @return a new file download |
|
192 */ |
|
193 virtual CNcdFileDownloadOperationProxy* CreateFileDownloadOperationL( |
|
194 TNcdDownloadDataType aType, |
|
195 const TDesC& aUri, |
|
196 const TDesC& aTargetPath, |
|
197 MNcdFileDownloadOperationObserver* aObserver ); |
|
198 |
|
199 |
|
200 /** |
|
201 * Creates a purchase operation |
|
202 * |
|
203 * @param |
|
204 * @return |
|
205 */ |
|
206 virtual CNcdPurchaseOperationProxy* CreatePurchaseOperationL( |
|
207 CNcdNodeProxy& aNode, |
|
208 CNcdPurchaseOptionProxy& aSelectedPurchaseOption, |
|
209 MNcdPurchaseOperationObserver* aObserver ); |
|
210 |
|
211 |
|
212 |
|
213 /** |
|
214 * Creates an install operation |
|
215 * |
|
216 * @param |
|
217 * @return |
|
218 */ |
|
219 virtual CNcdInstallOperationProxy* CreateInstallOperationL( |
|
220 CNcdNodeProxy& aNode, |
|
221 MNcdInstallOperationObserver* aObserver ); |
|
222 |
|
223 |
|
224 /** |
|
225 * Creates an install operation |
|
226 * |
|
227 * @param |
|
228 * @return |
|
229 */ |
|
230 virtual CNcdSilentInstallOperationProxy* CreateSilentInstallOperationL( |
|
231 CNcdNodeProxy& aNode, |
|
232 MNcdInstallOperationObserver* aObserverconst, |
|
233 const SwiUI::TInstallOptions& aInstallOptions ); |
|
234 |
|
235 |
|
236 /** |
|
237 * Creates a DRM rights object download & install operation. |
|
238 * |
|
239 * @param |
|
240 * @return |
|
241 */ |
|
242 virtual CNcdRightsObjectOperationProxy* CreateRightsObjectOperationL( |
|
243 const TDesC& aDownloadUri, |
|
244 const TDesC& aMimeType, |
|
245 const TNcdConnectionMethod& aConnectionMethod, |
|
246 MNcdRightsObjectOperationObserver& aObserver ); |
|
247 |
|
248 /** |
|
249 * Creates a subscription refresh operation. |
|
250 * |
|
251 * @param aObserver |
|
252 * @return Subscription operation. |
|
253 */ |
|
254 virtual CNcdSubscriptionOperationProxy* |
|
255 CreateSubscriptionRefreshOperationL( |
|
256 MNcdSubscriptionOperationObserver& aObserver ); |
|
257 |
|
258 |
|
259 /** |
|
260 * Creates a subscription refresh operation. |
|
261 * |
|
262 * @param aObserver |
|
263 * @return Subscription operation. |
|
264 */ |
|
265 virtual CNcdSubscriptionOperationProxy* |
|
266 CreateSubscriptionUnsubscribeOperationL( |
|
267 const TDesC& aPurchaseOptionId, |
|
268 const TDesC& aEntityId, |
|
269 const TDesC& aNamespace, |
|
270 const TDesC& aServerUri, |
|
271 MNcdSubscriptionOperationObserver& aObserver ); |
|
272 |
|
273 |
|
274 /** |
|
275 * Creates a server report operation. |
|
276 * |
|
277 * @param |
|
278 * @return |
|
279 */ |
|
280 virtual CNcdServerReportOperationProxy* |
|
281 CreateServerReportOperationL( |
|
282 MNcdServerReportOperationObserver& aObserver ); |
|
283 |
|
284 |
|
285 /** |
|
286 * Creates an access point creation operation |
|
287 * |
|
288 * @param |
|
289 * @return |
|
290 */ |
|
291 CNcdCreateAccessPointOperationProxy* CreateCreateAccessPointOperationL( |
|
292 const TDesC& aAccessPointData, |
|
293 MNcdCreateAccessPointOperationObserver& aObserver ); |
|
294 |
|
295 |
|
296 /** |
|
297 * Creates a HTTP request sending operation |
|
298 * |
|
299 * @param |
|
300 * @return |
|
301 */ |
|
302 CNcdSendHttpRequestOperationProxy* CreateSendHttpRequestOperationL( |
|
303 const TDesC8& aUri, |
|
304 const TDesC8& aRequest, |
|
305 const TNcdConnectionMethod& aConnectionMethod, |
|
306 MNcdSendHttpRequestOperationObserver& aObserver ); |
|
307 |
|
308 |
|
309 /** |
|
310 * Restores serialized content downloads |
|
311 * |
|
312 * The operations can be retrieved through Operations() |
|
313 */ |
|
314 void RestoreContentDownloadsL(); |
|
315 |
|
316 |
|
317 /** |
|
318 * Returns the ongoing operations. |
|
319 */ |
|
320 const RPointerArray<MNcdOperation>& Operations() const; |
|
321 |
|
322 |
|
323 /** |
|
324 * @param aNodeManager Ownership is not transferred. |
|
325 */ |
|
326 void SetNodeManager( CNcdNodeManagerProxy* aNodeManager ); |
|
327 |
|
328 /** |
|
329 * @return CNcdNodeManagerProxy* Ownership is not transferred. |
|
330 */ |
|
331 CNcdNodeManagerProxy* NodeManager(); |
|
332 |
|
333 |
|
334 /** |
|
335 * Installation service getter |
|
336 * |
|
337 * @return Installation service |
|
338 */ |
|
339 MNcdInstallationService& InstallationServiceL(); |
|
340 |
|
341 |
|
342 /** |
|
343 * Cancels all operations |
|
344 * |
|
345 * @note Releases operations with 0 refcount |
|
346 */ |
|
347 void CancelAllOperations(); |
|
348 |
|
349 |
|
350 /** |
|
351 * Releases operations that had not been used by any |
|
352 * client. |
|
353 */ |
|
354 void ReleaseUnusedOperations(); |
|
355 |
|
356 |
|
357 public: // MNcdOperationProxyRemoveHandler |
|
358 |
|
359 /** |
|
360 * @see MNcdOperationProxyRemoveHandler::RemoveOperationProxy |
|
361 */ |
|
362 virtual void RemoveOperationProxy( |
|
363 CNcdBaseOperationProxy& aOperationProxy ); |
|
364 |
|
365 public: // MNcdDownloadOperationObserver |
|
366 |
|
367 |
|
368 /** |
|
369 * @see MNcdDownloadOperationObserver::DownloadProgress() |
|
370 */ |
|
371 virtual void DownloadProgress( MNcdDownloadOperation& aOperation, |
|
372 TNcdProgress aProgress ); |
|
373 |
|
374 /** |
|
375 * @see MNcdDownloadOperationObserver::QueryReceived() |
|
376 */ |
|
377 virtual void QueryReceived( MNcdDownloadOperation& aOperation, |
|
378 MNcdQuery* aQuery ); |
|
379 |
|
380 /** |
|
381 * @see MNcdDownloadOperationObserver::OperationComplete() |
|
382 */ |
|
383 virtual void OperationComplete( MNcdDownloadOperation& aOperation, |
|
384 TInt aError ); |
|
385 |
|
386 |
|
387 protected: |
|
388 |
|
389 /** |
|
390 * Constructor |
|
391 */ |
|
392 CNcdOperationManagerProxy( MCatalogsClientServer& aSession, |
|
393 TInt aHandle ); |
|
394 |
|
395 /** |
|
396 * ConstructL |
|
397 */ |
|
398 virtual void ConstructL(); |
|
399 |
|
400 |
|
401 private: |
|
402 |
|
403 // Prevent if not implemented |
|
404 CNcdOperationManagerProxy( const CNcdOperationManagerProxy& aObject ); |
|
405 CNcdOperationManagerProxy& operator =( const CNcdOperationManagerProxy& aObject ); |
|
406 |
|
407 private: // New methods |
|
408 |
|
409 /** |
|
410 * Creates an identification stream for the node |
|
411 * |
|
412 * @param aNode |
|
413 * @return Id stream |
|
414 */ |
|
415 HBufC8* CreateNodeIdentifierDataLC( CNcdNodeProxy& aNode ); |
|
416 |
|
417 |
|
418 |
|
419 /** |
|
420 * Creates an operation on the server side |
|
421 * |
|
422 * @param aNode Node used by the operation |
|
423 * @param aFunction Operation manager function used to create the operation |
|
424 * @param aRemoveHandler Remove handler is assigned to this |
|
425 * @return Operation handle |
|
426 */ |
|
427 TInt CreateOperationL( CNcdNodeProxy& aNode, |
|
428 NcdNodeFunctionIds::TNcdOperationManagerFunctionNumber aFunction, |
|
429 MNcdOperationProxyRemoveHandler*& aRemoveHandler ); |
|
430 |
|
431 |
|
432 /** |
|
433 * Creates an operation on the server side |
|
434 * |
|
435 * @param aNode Node used by the operation |
|
436 * @param aSelectedPurchaseOption Selected purchase option |
|
437 * @param aFunction Operation manager function used to create the operation |
|
438 * @param aRemoveHandler Remove handler is assigned to this |
|
439 * @return Operation handle |
|
440 */ |
|
441 TInt CreateServerSidePurchaseOperationL( CNcdNodeProxy& aNode, |
|
442 const CNcdPurchaseOptionProxy& aSelectedPurchaseOption, |
|
443 NcdNodeFunctionIds::TNcdOperationManagerFunctionNumber aFunction, |
|
444 MNcdOperationProxyRemoveHandler*& aRemoveHandler ); |
|
445 |
|
446 |
|
447 |
|
448 // Create a download operation on the server side |
|
449 TInt CreateServerSideDownloadOperationL( |
|
450 TNcdDownloadDataType aType, const CNcdNodeIdentifier& aNodeId, |
|
451 TInt aDownloadIndex ); |
|
452 |
|
453 // Searches for an existing download operation |
|
454 CNcdDownloadOperationProxy* FindExistingDownloadOperation( |
|
455 TInt aHandle ) const; |
|
456 |
|
457 |
|
458 private: // data |
|
459 |
|
460 // This array contains all the operations that have been created. |
|
461 // When the operation is finished its job it should inform |
|
462 // this manager that it is going to delete itself and delete itself. |
|
463 RPointerArray<MNcdOperation> iOperationCache; |
|
464 |
|
465 TBool iRemovingAllOperations; |
|
466 |
|
467 CNcdNodeManagerProxy* iNodeManager; |
|
468 |
|
469 /** |
|
470 * Client localizer, not own. |
|
471 */ |
|
472 MNcdClientLocalizer* iClientLocalizer; |
|
473 |
|
474 /** |
|
475 * Installation service, own |
|
476 */ |
|
477 MNcdInstallationService* iInstallationService; |
|
478 |
|
479 }; |
|
480 |
|
481 |
|
482 #endif // NCD_OPERATION_MANAGER_PROXY_H |