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