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