|
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: Application Management DM Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __AMADAPTER_H__ |
|
21 #define __AMADAPTER_H__ |
|
22 |
|
23 // ------------------------------------------------------------------------------------------------ |
|
24 // Includes |
|
25 // ------------------------------------------------------------------------------------------------ |
|
26 #include <e32base.h> |
|
27 #include <smldmadapter.h> |
|
28 |
|
29 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
30 #include <dmtree.h> |
|
31 #else |
|
32 #include "nsmldmtreedbclient.h" |
|
33 #endif |
|
34 |
|
35 #include "ApplicationManagementClient.h" |
|
36 |
|
37 namespace NApplicationManagement |
|
38 { |
|
39 |
|
40 const TUint KAMAdapterImplUid = 0x10207845; |
|
41 |
|
42 // the DDF version must be changed if any changes in DDF structure ( built in DDFStructureL() function ) |
|
43 _LIT8( KAMDDFVersion, "1.0" ); |
|
44 |
|
45 _LIT8( KAMTextPlain, "text/plain" ); |
|
46 |
|
47 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
48 _LIT8( KAMNodeName, "./SCM" ); |
|
49 #else |
|
50 _LIT8( KAMNodeName, "SCM" ); |
|
51 #endif |
|
52 _LIT8( KAMNodeDescription, "This node is the root node for all application management functionality" ); |
|
53 |
|
54 _LIT8( KAMInventoryNodeName, "Inventory" ); |
|
55 _LIT8( KAMInventoryNodeDescription, "This node is start node of application inventory" ); |
|
56 |
|
57 _LIT8( KAMDeliveredNodeName, "Delivered" ); |
|
58 _LIT8( KAMDeliveredNodeDescription, "This is node under which applications that are delivered but not installed are found." ); |
|
59 |
|
60 _LIT8( KAMDeployedNodeName, "Deployed" ); |
|
61 _LIT8( KAMDeployedNodeDescription, "This is a node under which deployed applications are found" ); |
|
62 |
|
63 _LIT8( KAMDeliveredDynaNodeDescription, "This dynamic node is placeholder applications that are in Delivered state" ); |
|
64 |
|
65 _LIT8( KAMIDNodeName, "ID" ); |
|
66 _LIT8( KAMIDNodeDescription, "This leaf node holds an identifier for an application" ); |
|
67 |
|
68 _LIT8( KAMNameNodeName, "Name" ); |
|
69 _LIT8( KAMNameNodeDescription, "This leaf node holds name of an application" ); |
|
70 |
|
71 _LIT8( KAMVersionNodeName, "Version" ); |
|
72 _LIT8( KAMVersionNodeDescription, "This leaf node holds the version of an application" ); |
|
73 |
|
74 _LIT8( KAMStateValueNodeName, "StateValue" ); |
|
75 _LIT8( KAMStateValueNodeDescription, "This leaf node holds the state value of an application (active/inactive)" ); |
|
76 |
|
77 _LIT8( KAMDataNodeName, "Data" ); |
|
78 _LIT8( KAMDataNodeDescription, "This leaf node holds the data of an application" ); |
|
79 |
|
80 _LIT8( KAMDescriptorNodeName, "Descriptor" ); |
|
81 _LIT8( KAMDescriptorNodeDescription, "This leaf node holds the possible metadata of an application" ); |
|
82 |
|
83 _LIT8( KAMOperationsNodeName, "Operations" ); |
|
84 _LIT8( KAMOperationsNodeDescription, "This is a node under which operations are found" ); |
|
85 |
|
86 _LIT8( KAMInstallOptsNodeName, "InstallOpts" ); |
|
87 _LIT8( KAMInstallOptsNodeDescription, "This is a node that holds the installation options of an application" ); |
|
88 |
|
89 _LIT8( KAMDeployedDynaNodeDescription, "This dynamic node is placeholder applications that are in Inactive state" ); |
|
90 |
|
91 |
|
92 _LIT8( KAMDownloadOperationNodeName, "Download" ); |
|
93 _LIT8( KAMDownloadOperationNodeDescription, "Starts the download" ); |
|
94 |
|
95 _LIT8( KAMConRefNodeName, "ConRef" ); |
|
96 _LIT8( KAMConRefNodeDescription, "Holds reference to IAP" ); |
|
97 |
|
98 |
|
99 _LIT8( KAMLocalOperationsNodeDescription, "This is the root node for local operations" ); |
|
100 |
|
101 _LIT8( KAMActivateNodeName, "Activate" ); |
|
102 _LIT8( KAMActivateNodeDescription, "Exec command causes device to activate an inactive application" ); |
|
103 |
|
104 _LIT8( KAMDeActivateNodeName, "Deactivate" ); |
|
105 _LIT8( KAMDeActivateNodeDescription, "Exec command causes device to stop and deactivate an active application" ); |
|
106 |
|
107 _LIT8( KAMInstallNodeName, "Install" ); |
|
108 _LIT8( KAMInstallNodeDescription, "Exec command causes device to install a delivered application" ); |
|
109 |
|
110 _LIT8( KAMInstallAndActivateNodeName, "InstallAndActivate" ); |
|
111 _LIT8( KAMInstallAndActivateNodeDescription, "Exec command causes device to install a delivered application and activate it" ); |
|
112 |
|
113 _LIT8( KAMUpdateNodeName, "Update" ); |
|
114 _LIT8( KAMUpdateNodeDescription, "Exec command causes device to update an application" ); |
|
115 |
|
116 _LIT8( KAMUpdateAndActivateNodeName, "UpdateAndActivate" ); |
|
117 _LIT8( KAMUpdateAndActivateNodeDescription, "Exec command causes device to update an application and activate it" ); |
|
118 |
|
119 _LIT8( KAMRemoveNodeName, "Remove" ); |
|
120 _LIT8( KAMRemoveNodeDescription, "Exec command causes device to remove an application" ); |
|
121 |
|
122 |
|
123 _LIT8( KAMDownloadNodeName, "Download" ); |
|
124 _LIT8( KAMDownloadNodeDescription, "This node is a root node for application download functionality" ); |
|
125 |
|
126 _LIT8( KAMDownloadAndInstallNodeName, "DownloadAndInstall" ); |
|
127 _LIT8( KAMDownloadAndInstallOperationNodeDescription, "Starts the download and installs component when complete" ); |
|
128 |
|
129 _LIT8( KAMDownloadAndInstallAndActivateNodeName, "DownloadAndInstallAndActivate" ); |
|
130 _LIT8( KAMDownloadAndInstallAndActivateNodeDescription, "Starts the download and installs and activates component when complete" ); |
|
131 |
|
132 _LIT8( KAMDownloadAndUpdateNodeName, "DownloadAndUpdate" ); |
|
133 _LIT8( KAMDownloadAndUpdateNodeDescription, "Starts the download and installs component when complete" ); |
|
134 |
|
135 _LIT8( KAMDownloadAndUpdateAndActivateNodeName, "DownloadAndUpdateAndActivate" ); |
|
136 _LIT8( KAMDownloadAndUpdateAndActivateNodeDescription, "Starts the download and updates and activates component when complete" ); |
|
137 |
|
138 _LIT8( KAMDownloadDynaNodeDescription, "This node is a placeholder for identifier of an application that is to be downloaded" ); |
|
139 |
|
140 _LIT8( KAMURINodeName, "URI" ); |
|
141 _LIT8( KAMURINodeDescription, "This leaf node holds the URL from which the application should be downloaded" ); |
|
142 |
|
143 _LIT8( KAMStatusNodeName, "Status" ); |
|
144 _LIT8( KAMStatusNodeDescription, "This leaf node holds the status of the download" ); |
|
145 |
|
146 #ifdef __AM_LASTERROR_NODE |
|
147 _LIT8( KAMExtNodeName, "Ext" ); |
|
148 _LIT8( KAMExtNodeDescription, "Non std extentions are found under this leaf" ); |
|
149 _LIT8( KAMLastErrorNodeName, "LastError" ); |
|
150 _LIT8( KAMLastErrorDescription, "This leaf node may hold the error" ); |
|
151 #endif |
|
152 |
|
153 _LIT8( KAMDynamicNodeName, "" ); |
|
154 _LIT( KAMSeparator16, "/" ); |
|
155 |
|
156 _LIT8( KAMSeparator8, "/" ); |
|
157 |
|
158 _LIT8( KAMRootChilds, "Inventory/Download" ); |
|
159 _LIT8( KAMInventoryChilds, "Delivered/Deployed" ); |
|
160 //_LIT8( KAMLocalOperationsChilds, "Activate/DeActivate/Install/Update/Remove" ); |
|
161 |
|
162 _LIT8( KAMDownloadDynaChilds, "ID/Name/Version/URI/Status/Operations" ); |
|
163 _LIT8( KAMInventoryDynaChilds, "ID/Name/Version/StateValue/Operations" ); |
|
164 _LIT8( KAMDownloadOperationChilds, "Download/DownloadAndInstall/DownloadAndInstallAndActivate/DownloadAndUpdate/DownloadAndUpdateAndActivate" ); |
|
165 _LIT8( KAMDeployedOperationChilds, "Activate/Deactivate/Remove" ); |
|
166 _LIT8( KAMDeliveredOperationChilds, "Install/Update/InstallAndActivate/UpdateAndActivate/Remove" ); |
|
167 _LIT8( KAMInventoryDeliveredDynaChilds, "ID/Name/Version/Descriptor/Data/InstallOpts/Operations" ); |
|
168 |
|
169 |
|
170 struct TAMCommandBufferElement |
|
171 { |
|
172 TInt iStatusRef; |
|
173 TBuf8<256> iURI; |
|
174 TAMCommandBufferElement( TInt aRef, const TDesC8 &aURI ) |
|
175 : iStatusRef( aRef ), iURI( aURI ) |
|
176 { |
|
177 } |
|
178 }; |
|
179 |
|
180 typedef RArray<TAMCommandBufferElement> TAMCommandBuffer; |
|
181 |
|
182 // ------------------------------------------------------------------------------------------------ |
|
183 // CAmAdapter |
|
184 // ------------------------------------------------------------------------------------------------ |
|
185 class CAmAdapter : public CSmlDmAdapter |
|
186 { |
|
187 public: |
|
188 static CAmAdapter* NewL( MSmlDmCallback* aDmCallback ); |
|
189 static CAmAdapter* NewLC( MSmlDmCallback* aDmCallback ); |
|
190 |
|
191 virtual ~CAmAdapter(); |
|
192 |
|
193 |
|
194 /** |
|
195 The function returns current version of the DDF. |
|
196 By asking current DDF versions from adapters DM Module can control |
|
197 possible changes in the data structure and send the changed DDF |
|
198 description to a management server. |
|
199 This function is always called after DDFStructureL. |
|
200 @param aVersion DDF version of the adapter. (filled by the adapter) |
|
201 @publishedPartner |
|
202 @prototype |
|
203 */ |
|
204 virtual void DDFVersionL( CBufBase& aVersion ); |
|
205 |
|
206 /** |
|
207 The function for filling the DDF structure of the adapter |
|
208 This function is only called once, immediately after the adapter is created. |
|
209 @param aDDFObject Reference to root object. A DM adapter starts filling |
|
210 the data structure by calling AddChildObjectL to the root object and |
|
211 so describes the DDF of the adapter. |
|
212 @publishedPartner |
|
213 @prototype |
|
214 */ |
|
215 virtual void DDFStructureL( MSmlDmDDFObject& aDDF ); |
|
216 |
|
217 /** |
|
218 The function creates new leaf objects, or replaces data in existing leaf |
|
219 objects. The information about the success of the command should be |
|
220 returned by calling SetStatusL function of MSmlDmCallback callback |
|
221 interface. This makes it possible to buffer the commands. However, all |
|
222 the status codes for buffered commands must be returned at the latest when |
|
223 the adapter's CompleteOutstandingCmdsL() is called. |
|
224 @param aURI URI of the object |
|
225 @param aLUID LUID of the object (if the adapter has earlier returned a |
|
226 LUID to the DM Module). For new objects, this is the LUID |
|
227 inherited through the parent node. |
|
228 @param aObject Data of the object. |
|
229 @param aType MIME type of the object |
|
230 @param aStatusRef Reference to correct command, i.e. this reference |
|
231 must be used when calling the SetStatusL of this command |
|
232 @publishedPartner |
|
233 @prototype |
|
234 */ |
|
235 virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
236 const TDesC8& aObject, const TDesC8& aType, |
|
237 TInt aStatusRef ); |
|
238 |
|
239 /** |
|
240 The function creates new leaf objects, or replaces data in existing leaf |
|
241 objects, in the case where data is large enough to be streamed. The |
|
242 information about the success of the command should be returned by calling |
|
243 SetStatusL function of MSmlDmCallback callback interface. This makes it |
|
244 possible to buffer the commands. However, all the status codes for buffered |
|
245 commands must be returned at the latest when the CompleteOutstandingCmdsL() |
|
246 of adapter is called. |
|
247 @param aURI URI of the object |
|
248 @param aLUID LUID of the object (if the adapter has earlier returned a |
|
249 LUID to the DM Module). For new objects, this is the LUID |
|
250 inherited through the parent node. |
|
251 @param aStream Data of the object. Adapter should create write stream |
|
252 and return, when data is written to stream by DM agent, |
|
253 StreamCommittedL() is called by DM engine |
|
254 @param aType MIME type of the object |
|
255 @param aStatusRef Reference to correct command, i.e. this reference |
|
256 must be used when calling the SetStatusL of this |
|
257 command. |
|
258 @publishedPartner |
|
259 @prototype |
|
260 */ |
|
261 virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
262 RWriteStream*& aStream, const TDesC8& aType, |
|
263 TInt aStatusRef ); |
|
264 |
|
265 /** |
|
266 The function deletes an object and its child objects. The SetStatusL |
|
267 should be used as described in UpdateLeafObjectL() |
|
268 @param aURI URI of the object |
|
269 @param aLUID LUID of the object (if the adapter have earlier returned |
|
270 LUID to the DM Module). |
|
271 @param aStatusRef Reference to correct command, i.e. this reference must |
|
272 be used when calling the SetStatusL of this command. |
|
273 @publishedPartner |
|
274 @prototype |
|
275 */ |
|
276 virtual void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
277 TInt aStatusRef ); |
|
278 |
|
279 /** |
|
280 The function fetches data of a leaf object. The SetStatusL should be used |
|
281 as described in UpdateLeafObjectL(). The data is returned by using the |
|
282 SetResultsL function of MSmlCallback callback interface, and may be streamed. |
|
283 @param aURI URI of the object |
|
284 @param aLUID LUID of the object (if the adapter have earlier |
|
285 returned LUID to the DM Module). |
|
286 @param aType MIME type of the object |
|
287 @param aResultsRef Reference to correct results, i.e. this reference |
|
288 must be used when returning the result by calling |
|
289 the SetResultsL. |
|
290 @param aStatusRef Reference to correct command, i.e. this reference |
|
291 must be used when calling the SetStatusL of this |
|
292 command. |
|
293 @publishedPartner |
|
294 @prototype |
|
295 */ |
|
296 virtual void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
297 const TDesC8& aType, TInt aResultsRef, |
|
298 TInt aStatusRef ); |
|
299 |
|
300 /** |
|
301 The function fetches the size of the data of a leaf object. The size is |
|
302 in bytes, and must reflect the number of bytes that will be transferred |
|
303 when the framework calls FetchLeafObjectL. The SetStatusL should be used |
|
304 as described in FetchLeafObjectL(). The size value is returned by using |
|
305 the SetResultsL function of MSmlCallback callback interface, and must be |
|
306 a decimal integer expressed as a string, eg. "1234". |
|
307 Results from this call MUST NOT be streamed. |
|
308 @param aURI URI of the object |
|
309 @param aLUID LUID of the object (if the adapter have earlier |
|
310 returned LUID to the DM Module). |
|
311 @param aType MIME type of the object |
|
312 @param aResultsRef Reference to correct results, i.e. this reference |
|
313 must be used when returning the result by calling |
|
314 the SetResultsL. |
|
315 @param aStatusRef Reference to correct command, i.e. this reference |
|
316 must be used when calling the SetStatusL of this |
|
317 command. |
|
318 @publishedPartner |
|
319 @prototype |
|
320 */ |
|
321 virtual void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, |
|
322 const TDesC8& aType, TInt aResultsRef, |
|
323 TInt aStatusRef ); |
|
324 /** |
|
325 The function fetches URI list. An adapter returns the list of URI segments |
|
326 under the given URI be separated by slash ("/"). The URI segment names for |
|
327 new objects must be given by the adapter. |
|
328 The list is returned by calling the SetResultsL function of MSmlCallback |
|
329 callback interface. Results from this call MUST NOT be streamed. |
|
330 @param aParentURI URI of the parent object |
|
331 @param aParentLUID LUID of the parent object (if the |
|
332 adapter have earlier returned LUID to |
|
333 the DM Module). |
|
334 @param aPreviousURISegmentList URI list with mapping LUID information, |
|
335 which is known by DM engine. An adapter |
|
336 can use this information when verifying |
|
337 if old objects still exists. An adapter |
|
338 also knows what objects are new to DM |
|
339 engine and can provide LUID mapping for |
|
340 them. aPreviousURISegmentList parameter |
|
341 (see above) helps to recognise new |
|
342 objects. |
|
343 @param aResultsRef Reference to correct results, i.e. this |
|
344 reference must be used when returning |
|
345 the result by calling the SetResultsL. |
|
346 @param aStatusRef Reference to correct command, i.e. this |
|
347 reference must be used when calling the |
|
348 SetStatusL of this command. |
|
349 @publishedPartner |
|
350 @prototype |
|
351 */ |
|
352 virtual void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, |
|
353 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
354 TInt aResultsRef, TInt aStatusRef ); |
|
355 |
|
356 /** |
|
357 The function adds node object. In some cases an implementation of the |
|
358 function may be empty function, if the node object does not need concrete |
|
359 database update. Still this function may be helpful to an adapter, i.e. in |
|
360 passing mapping LUID of the node to DM Module. The SetStatusL should be |
|
361 used as described in UpdateLeafObjectL() |
|
362 @param aURI URI of the object |
|
363 @param aParentLUID LUID of the parent object (if the adapter have |
|
364 earlier returned LUID to the DM Module). |
|
365 @param aStatusRef Reference to correct command, i.e. this reference |
|
366 must be used when calling the SetStatusL of this |
|
367 command. |
|
368 @publishedPartner |
|
369 @prototype |
|
370 */ |
|
371 virtual void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, |
|
372 TInt aStatusRef ); |
|
373 |
|
374 /** |
|
375 The function implements execute command. The information about the success |
|
376 of the command should be returned by calling SetStatusL function of |
|
377 MSmlDmCallback callback interface. This makes it possible to buffer the |
|
378 commands. |
|
379 However, all the status codes for buffered commands must be returned at |
|
380 the latest when the CompleteOutstandingCmdsL() of adapter is called. |
|
381 @param aURI URI of the command |
|
382 @param aLUID LUID of the object (if the adapter have earlier |
|
383 returned LUID to the DM Module). |
|
384 @param aArgument Argument for the command |
|
385 @param aType MIME type of the object |
|
386 @param aStatusRef Reference to correct command, i.e. this reference |
|
387 must be used when calling the SetStatusL of this |
|
388 command. |
|
389 @publishedPartner |
|
390 @prototype |
|
391 */ |
|
392 virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
393 const TDesC8& aArgument, const TDesC8& aType, |
|
394 TInt aStatusRef ); |
|
395 |
|
396 /** |
|
397 The function implements execute command. The information about the |
|
398 success of the command should be returned by calling SetStatusL function |
|
399 of MSmlDmCallback callback interface. This makes it possible to buffer the |
|
400 commands. |
|
401 However, all the status codes for buffered commands must be returned at |
|
402 the latest when the CompleteOutstandingCmdsL() of adapter is called. |
|
403 @param aURI URI of the command |
|
404 @param aLUID LUID of the object (if the adapter have earlier |
|
405 returned LUID to the DM Module). |
|
406 @param aStream Argument for the command. Adapter should create |
|
407 write stream and return, when data is written to |
|
408 stream by DM agent, StreamCommittedL() is called by |
|
409 DM engine |
|
410 @param aType MIME type of the object |
|
411 @param aStatusRef Reference to correct command, i.e. this reference |
|
412 must be used when calling the SetStatusL of this |
|
413 command. |
|
414 @publishedPartner |
|
415 @prototype |
|
416 */ |
|
417 virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
418 RWriteStream*& aStream, const TDesC8& aType, |
|
419 TInt aStatusRef ); |
|
420 |
|
421 /** |
|
422 The function implements copy command. The information about the success of |
|
423 the command should be returned by calling SetStatusL function of |
|
424 MSmlDmCallback callback interface. This makes it possible to buffer the |
|
425 commands. |
|
426 However, all the status codes for buffered commands must be returned at |
|
427 the latest when the CompleteOutstandingCmdsL() of adapter is called. |
|
428 @param aTargetURI Target URI for the command |
|
429 @param aSourceLUID LUID of the target object (if one exists, and if the adapter |
|
430 has earlier returned a LUID to the DM Module). |
|
431 @param aSourceURI Source URI for the command |
|
432 @param aSourceLUID LUID of the source object (if the adapter has |
|
433 earlier returned a LUID to the DM Module). |
|
434 @param aType MIME type of the objects |
|
435 @param aStatusRef Reference to correct command, i.e. this reference |
|
436 must be used when calling the SetStatusL of this |
|
437 command. |
|
438 @publishedPartner |
|
439 @prototype |
|
440 */ |
|
441 virtual void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, |
|
442 const TDesC8& aSourceURI, const TDesC8& aSourceLUID, |
|
443 const TDesC8& aType, TInt aStatusRef ); |
|
444 |
|
445 /** |
|
446 The function indicates start of Atomic command. |
|
447 @publishedPartner |
|
448 @prototype |
|
449 */ |
|
450 virtual void StartAtomicL(); |
|
451 |
|
452 /** |
|
453 The function indicates successful end of Atomic command. The adapter |
|
454 should commit all changes issued between StartAtomicL() and |
|
455 CommitAtomicL() |
|
456 @publishedPartner |
|
457 @prototype |
|
458 */ |
|
459 virtual void CommitAtomicL(); |
|
460 |
|
461 /** |
|
462 The function indicates unsuccessful end of Atomic command. The adapter |
|
463 should rollback all changes issued between StartAtomicL() and |
|
464 RollbackAtomicL(). If rollback fails for a command, adapter should use |
|
465 SetStatusL() to indicate it. |
|
466 @publishedPartner |
|
467 @prototype |
|
468 */ |
|
469 virtual void RollbackAtomicL(); |
|
470 |
|
471 /** |
|
472 Returns ETrue if adapter supports streaming otherwise EFalse. |
|
473 @param aItemSize size limit for stream usage |
|
474 @return TBool ETrue for streaming support |
|
475 @publishedPartner |
|
476 @prototype |
|
477 */ |
|
478 virtual TBool StreamingSupport( TInt& aItemSize ) ; |
|
479 |
|
480 /** |
|
481 Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has |
|
482 been written to and committed. Not called when fetching item. |
|
483 @publishedPartner |
|
484 @prototype |
|
485 */ |
|
486 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
487 virtual void StreamCommittedL( RWriteStream& aStream ); |
|
488 #else |
|
489 virtual void StreamCommittedL(); |
|
490 #endif |
|
491 /** |
|
492 The function tells the adapter that all the commands of the message that |
|
493 can be passed to the adapter have now been passed. This indciates that |
|
494 the adapter must supply status codes and results to any buffered commands. |
|
495 This must be done at latest by the time this function returns. |
|
496 This function is used at the end of SyncML messages, and during processing |
|
497 of Atomic. In the case of Atomic processing, the function will be |
|
498 followed by a call to CommitAtomicL or RollbackAtomicL. |
|
499 @publishedPartner |
|
500 @prototype |
|
501 */ |
|
502 virtual void CompleteOutstandingCmdsL(); |
|
503 |
|
504 private: |
|
505 CAmAdapter( TAny* aDmCallback ); |
|
506 void ConstructL(); |
|
507 TInt DesToIntL( const TDesC8& aLuid ); |
|
508 HBufC8* IntToDes8LC( const TInt aLuid ); |
|
509 |
|
510 TBool CheckStateL( const TDeploymentComponent &aComp, const TDesC8& aURI ); |
|
511 TBool CheckStateL( const TDesC8& aURI,const TDesC8& aLUID ); |
|
512 /** |
|
513 * UpdateFlagFromMapping Maps a node name to internal attribute flag that |
|
514 * is used by server to identify to data |
|
515 * @param aMapping The SyncML node name |
|
516 * @return TDeplCompAttrType the attribute type |
|
517 */ |
|
518 TDeplCompAttrType UpdateFlagFromMapping( const TDesC8& aMapping ); |
|
519 |
|
520 /** |
|
521 * IdListL Looks up the given state user ids of deployment components, |
|
522 * and places them to currentList in the format specified by SyncML spec |
|
523 * @param aState The deployment component state in which we are interested |
|
524 * @param aCurrentList The buffer where the results are placed |
|
525 * @param aAppend Does the list possibly contain some items already |
|
526 * @return TError EOk if successful |
|
527 */ |
|
528 TError IdListL( TDeploymentComponentState aState, |
|
529 CBufBase &aCurrentList, TBool aAppend = EFalse ); |
|
530 |
|
531 /** |
|
532 * DeliverOrDownloadL Depending on aURI, creates new delivery or download component |
|
533 * |
|
534 * @param aUserId The name of dynamic node. |
|
535 * @param aURI The full URI |
|
536 * @param aCnt Count of URI segments |
|
537 * @param aParentMapping The parent data |
|
538 * @param aStatus A reference to the error which will be set the status of the operation |
|
539 * @return TError EOk if successful |
|
540 */ |
|
541 void DeliverOrDownloadL( const TDesC8 &aUserId, const TDesC8 &aURI, |
|
542 TInt aCnt, const TDesC8 &aParentMapping, |
|
543 MSmlDmAdapter::TError &aStatus ); |
|
544 |
|
545 |
|
546 /** |
|
547 * Fills the node info in ddf structure |
|
548 */ |
|
549 void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, |
|
550 MSmlDmDDFObject::TOccurence aOccurrence, |
|
551 MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat, |
|
552 const TDesC8& aDescription); |
|
553 |
|
554 /** |
|
555 * Fills the node info in ddf structure, without default mime type |
|
556 */ |
|
557 void FillNodeInfoNoDefaultMimeL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, |
|
558 MSmlDmDDFObject::TOccurence aOccurrence, |
|
559 MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat, |
|
560 const TDesC8& aDescription); |
|
561 |
|
562 TBool IsImage(const TDesC8& aMime) ; |
|
563 /** |
|
564 Calls Callback().SetResultsL() |
|
565 */ |
|
566 void SetResultsL( TInt aResultsRef, CBufBase& aObject, |
|
567 const TDesC8& aType ); |
|
568 /** |
|
569 Calls Callback().SetStatusL() |
|
570 */ |
|
571 void SetStatusL( TInt aStatusRef, |
|
572 MSmlDmAdapter::TError aErrorCode ); |
|
573 // TInt FindBuffered( const TDesC8 &aURI ) ; |
|
574 RApplicationManagement &SessionL(); |
|
575 TDeploymentComponentState StateL( const TDesC8& aURI ); |
|
576 |
|
577 void CheckStateChangesL(); |
|
578 void CheckStateChangesInternalL(); |
|
579 |
|
580 |
|
581 TPtrC8 URISegsUpTo(const TDesC8& aURI, TInt aUpTo, TBool aInclKeno=EFalse); |
|
582 |
|
583 /** |
|
584 * Helper method to move acl. Copies acl of node aFrom to acl of aTo, |
|
585 * and removes acl from aFrom. |
|
586 * |
|
587 * @param aFrom The source uri |
|
588 * @param aTo The target uri |
|
589 */ |
|
590 void MoveAclL( const TDesC8 &aFrom, const TDesC8 &aTo ); |
|
591 |
|
592 /** |
|
593 * Helper method to move nodes in SCM tree |
|
594 * |
|
595 * 1. Sets mapping of aOriginal to null. |
|
596 * 2. If aNewURI is null, constructs new uri depending on aTargetstate. |
|
597 * 3. Sets mapping of aNewURI to aLUID |
|
598 * 4. Moves acls of aOriginal to aNewURI (using MoveAclL) |
|
599 * |
|
600 * @param aOriginal The uri of original node to be moved |
|
601 * @param aTargetstate The target state the node is moving to |
|
602 * @param aLUID The luid of the original node |
|
603 * @param aNewUri The new uri of the node (will be constructed and left to stack if null) |
|
604 */ |
|
605 void SetMappingLC( const TDesC8 &aOriginal, |
|
606 const TDeploymentComponentState aTargetstate, const TDesC8 &aLUID, |
|
607 HBufC8 *&aNewUri ); |
|
608 |
|
609 /** |
|
610 * Helper method to move nodes in SCM tree |
|
611 * |
|
612 * 1. Sets mapping of aOriginal to null. |
|
613 * 2. Sets mapping of a uri constructed using aTargetState to aLUID |
|
614 * 2. Moves acls of aOriginal to a uri constructed using aTargetState (using MoveAclL) |
|
615 * |
|
616 * @param aOriginal The uri of original node to be moved |
|
617 * @param aTargetstate The target state the node is moving to |
|
618 * @param aLUID The luid of the original node |
|
619 */ |
|
620 void SetMappingL( const TDesC8 &aOriginalURI, |
|
621 const TDeploymentComponentState aTargetState, const TDesC8 &aLUID ) ; |
|
622 |
|
623 /** |
|
624 * Helper method to set DM LUID mappings directly database. |
|
625 * |
|
626 * @param aURI The uri of node whose mapping is to be set |
|
627 * @param aLUID The new mapping value |
|
628 * @return Possible database error - KErrNone if successful |
|
629 */ |
|
630 TInt DirectSetMappingL( const TDesC8 &aURI, const TDesC8 &aLUID ); |
|
631 |
|
632 TInt DirectRemoveMappingL(const TDesC8 &aURI); |
|
633 /** |
|
634 * Helper method to get DM LUID mappings directly from database. |
|
635 * |
|
636 * @param aURI The uri of node whose mapping is to be found |
|
637 * @return The luid mapping - Empty string if not found. |
|
638 */ |
|
639 HBufC8 *DirectGetLuidAllocLC( const TDesC8 &aURI ); |
|
640 |
|
641 |
|
642 /** |
|
643 * Helper method to perform install |
|
644 * |
|
645 * @param aLuidi The mapping value of component as integer |
|
646 * @param aURI The uri of node that is to be installed |
|
647 * @param aLUID The mapping value of component as text |
|
648 * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) |
|
649 * @param aRet The SyncML Error code - value will be updated according to success |
|
650 */ |
|
651 void InstallL( const TUint aLuidi, const TDesC8& aURI, const TDesC8& aLUID, |
|
652 const TDeploymentComponentState aTargetState, TError &aRet ); |
|
653 |
|
654 /** |
|
655 * Helper method to perform update |
|
656 * |
|
657 * @param aLuidi The mapping value of component as integer |
|
658 * @param aURI The uri of node that is to be installed |
|
659 * @param aLUID The mapping value of component as text |
|
660 * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) |
|
661 * @param aRet The SyncML Error code - value will be updated according to success |
|
662 */ |
|
663 void UpdateL( const TUint aLuidi, const TDesC8& aURI, const TDesC8& aSourceLUID, |
|
664 const TDeploymentComponentState aTargetState, TError &aRet ); |
|
665 /** |
|
666 maps symbian error code to DM error code as follows: |
|
667 Kerrnone-> EOk |
|
668 Kerrnotfound ->Enotfound |
|
669 all oether -> EError |
|
670 */ |
|
671 void DefaultMapError( const TInt aErr, TError &aRet, const TDesC8& aDes = KNullDesC8 ); |
|
672 |
|
673 /** |
|
674 * Deactivates given component if given state is inactive |
|
675 */ |
|
676 void DeactivateIfInactive( const TUint aLuidi, const TDeploymentComponentState aTargetState ); |
|
677 |
|
678 /** |
|
679 * Finds luid from app mgmt server to given userid |
|
680 */ |
|
681 TUint32 GetLuidForUserIdL( const TDesC8 &aUserId, const TDeploymentComponentState aState ); |
|
682 |
|
683 TUint32 GetLuidL( const TDesC8 &aDMLuid, const TDesC8 &aUserId, |
|
684 const TDeploymentComponentState aState ); |
|
685 |
|
686 /** |
|
687 * places result in current |
|
688 * @param aParent The deployment component identifying uri |
|
689 * @param aMapping The user id part of the deployment component uri |
|
690 * @param aLuid Internal id of the deployment compoennt |
|
691 * @param aCurrentList The list that will get the data |
|
692 * @param aStatus The syncml status |
|
693 */ |
|
694 void GetComponentDataL( const TDesC8& aParent, const TDesC8& aMapping, const TUint32 aLuid, |
|
695 CBufBase &aCurrentList, CBufBase ¤tMime, TError &aStatus ); |
|
696 /** |
|
697 * returns luid of leaf node, or 0 |
|
698 */ |
|
699 TInt GetLeafLuidL( const TDesC8 &aURI, const TDesC8 & aParentMapping ) ; |
|
700 /** |
|
701 * returns length of result |
|
702 */ |
|
703 TInt GetSizeL( const TDeplCompAttrType aDataType, const TInt aLuid, TError &aRet ); |
|
704 |
|
705 /** |
|
706 * places installoptions of given aLuid to aBuf |
|
707 */ |
|
708 void InstallOptionsDataL(const TUint32 aLuid, const TDeplCompAttrType& aDataType, |
|
709 CBufBase &aBuf, CBufBase *aRaw = NULL); |
|
710 |
|
711 /** |
|
712 * Gets the luid using GetLuidL, and updates aStatus to ENotFound if not found... |
|
713 */ |
|
714 TUint32 GetLuid2L( const TDesC8 &aDMLuid, const TDesC8 &aUserId, |
|
715 const TDeploymentComponentState aState, TError &aStatus ); |
|
716 |
|
717 /** |
|
718 * Finds out correct download target based on download operation |
|
719 */ |
|
720 TDownloadTarget DownloadTargetL( const TDesC8& aOperation ); |
|
721 |
|
722 TPtrC8 LastURISeg(const TDesC8& aURI); |
|
723 TInt DesToInt(const TDesC8& aLuid); |
|
724 |
|
725 #ifdef __AM_LASTERROR_NODE |
|
726 void SetLastErrorL( const TDesC8& aLastError, const TInt aErr ); |
|
727 const TDesC8& LastError(); |
|
728 void SetErrorL( const TDesC8& aDes, const TInt aErr ); |
|
729 #endif |
|
730 |
|
731 |
|
732 |
|
733 /** |
|
734 The function creates new leaf objects, or replaces data in existing leaf |
|
735 objects. The information about the success of the command should be |
|
736 returned by calling SetStatusL function of MSmlDmCallback callback |
|
737 interface. This makes it possible to buffer the commands. However, all |
|
738 the status codes for buffered commands must be returned at the latest when |
|
739 the adapter's CompleteOutstandingCmdsL() is called. |
|
740 @param aURI URI of the object |
|
741 @param aLUID LUID of the object (if the adapter has earlier returned a |
|
742 LUID to the DM Module). For new objects, this is the LUID |
|
743 inherited through the parent node. |
|
744 @param aObject Data of the object. |
|
745 @param aType MIME type of the object |
|
746 @param aStatusRef Reference to correct command, i.e. this reference |
|
747 must be used when calling the SetStatusL of this command |
|
748 @publishedPartner |
|
749 @prototype |
|
750 */ |
|
751 void _UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
752 const TDesC8& aObject, const TDesC8& aType, |
|
753 TInt aStatusRef, MSmlDmAdapter::TError& aStatus ); |
|
754 /** |
|
755 * The function creates new leaf objects, or replaces data in existing leaf |
|
756 */ |
|
757 void CloseStreaming(); |
|
758 TInt GetAdapterValue(); |
|
759 void SetAdapterValue(TInt aAdapterValue); |
|
760 |
|
761 private: |
|
762 |
|
763 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
764 RDmTree iDbSession; |
|
765 #else |
|
766 RNSmlDMCallbackSession iDbSession; // to change acl location |
|
767 #endif |
|
768 |
|
769 RApplicationManagement iManagement ; |
|
770 TBool iSessionOpened ; |
|
771 TAMCommandBuffer iBuffer; |
|
772 TBool iInAtomic ; |
|
773 TBool iUpdated; // have we checked changed state DCs? |
|
774 // Streaming API support |
|
775 TBool iStreamOpen; |
|
776 RFileWriteStream iStream; |
|
777 TInt iStatusRef; |
|
778 RFs iStreamRFs; |
|
779 RFile iStreamFile; |
|
780 TBool iIsStreamedContent; |
|
781 HBufC8* iStreamedURI; |
|
782 HBufC8* iStreamedLuid; |
|
783 HBufC8* iStreamedType; |
|
784 TBool iCertRequired; |
|
785 TBool iTrustAdded; |
|
786 |
|
787 #ifdef __AM_LASTERROR_NODE |
|
788 HBufC8 *iLastError; |
|
789 #endif |
|
790 |
|
791 HBufC8 *iUriDel; |
|
792 }; |
|
793 |
|
794 } // namespace |
|
795 #endif // __AMDMADAPTER_H__ |
|
796 |
|
797 // End of File |