appinstaller/AppMngr2/SWInstAdapter/inc/cswinstadapter.h
changeset 0 ba25891c3a9e
child 21 de6723242771
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   OMA DM adapter for SW Installer configuration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CSWINSTADAPTER_H
       
    20 #define C_CSWINSTADAPTER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <smldmadapter.h>
       
    24 #include <centralrepository.h>
       
    25 
       
    26 /**
       
    27 * SW Installer DM Adapter
       
    28 * This adapter implements remote configuration for SW Installer settings.
       
    29 * @since S60 v3.2
       
    30 */
       
    31 class CSWInstAdapter : public CSmlDmAdapter
       
    32     {
       
    33     public: // Constructors, destructor
       
    34         /**
       
    35         * Create instance of CSWInstAdapter
       
    36         * @param aDmCallBack
       
    37         * @return Instance of CSWInstAdapter
       
    38         */    
       
    39         static CSWInstAdapter* NewL( MSmlDmCallback* aDmCallback );
       
    40 
       
    41         /**
       
    42         * Create instance of CSWInstAdapter
       
    43         * @param aDmCallBack
       
    44         * @return Instance of CSWInstAdapter
       
    45         */   
       
    46         static CSWInstAdapter* NewLC( MSmlDmCallback* aDmCallback );
       
    47 
       
    48         /**
       
    49         * C++ Destructor
       
    50         */
       
    51         virtual ~CSWInstAdapter();
       
    52 
       
    53     public:
       
    54         /**
       
    55         * The function returns current version of the DDF.
       
    56         * By asking current DDF versions from adapters DM Module can control
       
    57         * possible changes in the data structure and send the changed DDF
       
    58         * description to a management server.
       
    59         * This function is always called after DDFStructureL.
       
    60         * @param aVersion DDF version of the adapter. (filled by the adapter)
       
    61         * @publishedPartner
       
    62         * @prototype
       
    63         */
       
    64         void DDFVersionL( CBufBase& aVersion );
       
    65     
       
    66         /**
       
    67         * The function for filling the DDF structure of the adapter
       
    68         * This function is only called once, immediately after the adapter is created.
       
    69         * @param aDDFObject Reference to root object. A DM adapter starts filling
       
    70                  the data structure by calling AddChildObjectL to the root object and
       
    71                  so describes the DDF of the adapter. 
       
    72         * @publishedPartner
       
    73         * @prototype
       
    74         */
       
    75         void DDFStructureL( MSmlDmDDFObject& aDDF );
       
    76     
       
    77         /**
       
    78         * The function creates new leaf objects, or replaces data in existing leaf
       
    79         * objects. The information about the success of the command should be
       
    80         * returned by calling SetStatusL function of MSmlDmCallback callback
       
    81         * interface. This makes it possible to buffer the commands. However, all
       
    82         * the status codes for buffered commands must be returned at the latest when
       
    83         * the adapter's CompleteOutstandingCmdsL() is called.
       
    84         * @param aURI       URI of the object
       
    85         * @param aLUID      LUID of the object (if the adapter has earlier returned a
       
    86                             LUID to the DM Module). For new objects, this is the LUID
       
    87                             inherited through the parent node.
       
    88         * @param aObject    Data of the object. 
       
    89         * @param aType      MIME type of the object
       
    90         * @param aStatus    Ref Reference to correct command, i.e. this reference
       
    91                             must be used when calling the SetStatusL of this command
       
    92         * @publishedPartner
       
    93         * @prototype
       
    94         */
       
    95         void UpdateLeafObjectL( const TDesC8& aURI, 
       
    96                                 const TDesC8& aLUID,
       
    97                                 const TDesC8& aObject, 
       
    98                                 const TDesC8& aType,
       
    99                                 TInt aStatusRef 
       
   100                               );
       
   101         
       
   102         /**
       
   103         * The function creates new leaf objects, or replaces data in existing leaf
       
   104         * objects, in the case where data is large enough to be streamed. The
       
   105         * information about the success of the command should be returned by calling
       
   106         * SetStatusL function of MSmlDmCallback callback interface. This makes it
       
   107         * possible to buffer the commands.  However, all the status codes for buffered
       
   108         * commands must be returned at the latest when the CompleteOutstandingCmdsL()
       
   109         * of adapter is called.
       
   110         * @param aURI       URI of the object
       
   111         * @param aLUID      LUID of the object (if the adapter has earlier returned a
       
   112                             LUID to the DM Module). For new objects, this is the LUID
       
   113                             inherited through the parent node.
       
   114         * @param aStream    Data of the object. Adapter should create write stream
       
   115                             and return, when data is written to stream by DM agent,
       
   116                             StreamCommittedL() is called by DM engine
       
   117         * @param aType      MIME type of the object
       
   118         * @param aStatusRef Reference to correct command, i.e. this reference
       
   119                             must be used when calling the SetStatusL of this
       
   120                             command.
       
   121         * @publishedPartner
       
   122         * @prototype
       
   123         */
       
   124         void UpdateLeafObjectL( const TDesC8& aURI, 
       
   125                                 const TDesC8& aLUID,
       
   126                                 RWriteStream*& aStream, 
       
   127                                 const TDesC8& aType,
       
   128                                 TInt aStatusRef 
       
   129                               );
       
   130     
       
   131         /**
       
   132         * The function deletes an object and its child objects. The SetStatusL
       
   133         * should be used as described in UpdateLeafObjectL()
       
   134         * @param aURI       URI of the object
       
   135         * @param aLUID      LUID of the object (if the adapter have earlier returned
       
   136                             LUID to the DM Module).
       
   137         * @param aStatusRef Reference to correct command, i.e. this reference must
       
   138                         be used when calling the SetStatusL of this command.
       
   139         * @publishedPartner
       
   140         * @prototype
       
   141         */
       
   142         void DeleteObjectL( const TDesC8& aURI, 
       
   143                             const TDesC8& aLUID,
       
   144                             TInt aStatusRef 
       
   145                           );
       
   146     
       
   147         /**
       
   148         * The function fetches data of a leaf object. The SetStatusL should be used
       
   149         * as described in UpdateLeafObjectL(). The data is returned by using the
       
   150         * SetResultsL function of MSmlCallback callback interface, and may be streamed.
       
   151         * @param aURI           URI of the object
       
   152         * @param aLUID          LUID of the object (if the adapter have earlier
       
   153                                 returned LUID to the DM Module).   
       
   154         * @param aType          MIME type of the object
       
   155         * @param aResultsRef    Reference to correct results, i.e. this reference
       
   156                                 must be used when returning the result by calling
       
   157                                 the SetResultsL.
       
   158         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   159                                 must be used when calling the SetStatusL of this
       
   160                                 command.
       
   161         * @publishedPartner
       
   162         * @prototype
       
   163         */
       
   164         void FetchLeafObjectL( const TDesC8& aURI, 
       
   165                                const TDesC8& aLUID,
       
   166                                const TDesC8& aType, 
       
   167                                TInt aResultsRef,
       
   168                                TInt aStatusRef 
       
   169                              );
       
   170     
       
   171         /**
       
   172         * The function fetches the size of the data of a leaf object. The size is
       
   173         * in bytes, and must reflect the number of bytes that will be transferred
       
   174         * when the framework calls FetchLeafObjectL. The SetStatusL should be used
       
   175         * as described in FetchLeafObjectL(). The size value is returned by using
       
   176         * the SetResultsL function of MSmlCallback callback interface, and must be
       
   177         * a decimal integer expressed as a string, eg. "1234".
       
   178         * Results from this call MUST NOT be streamed.
       
   179         * @param aURI           URI of the object
       
   180         * @param aLUID          LUID of the object (if the adapter have earlier
       
   181                                 returned LUID to the DM Module).   
       
   182         * @param aType          MIME type of the object
       
   183         * @param aResultsRef    Reference to correct results, i.e. this reference
       
   184                                 must be used when returning the result by calling
       
   185                                 the SetResultsL.
       
   186         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   187                                 must be used when calling the SetStatusL of this
       
   188                                 command.
       
   189         * @publishedPartner
       
   190         * @prototype
       
   191         */
       
   192         void FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   193                                    const TDesC8& aLUID,
       
   194                                    const TDesC8& aType, 
       
   195                                    TInt aResultsRef,
       
   196                                    TInt aStatusRef 
       
   197                                  );
       
   198         /**
       
   199         * The function fetches URI list. An adapter returns the list of URI segments
       
   200         * under the given URI be separated by slash ("/"). The URI segment names for
       
   201         * new objects must be given by the adapter.
       
   202         * The list is returned by calling the SetResultsL function of MSmlCallback
       
   203         * callback interface.   Results from this call MUST NOT be streamed.
       
   204         * @param aParentURI                 URI of the parent object
       
   205         * @param aParentLUID                LUID of the parent object (if the
       
   206                                             adapter have earlier returned LUID to
       
   207                                             the DM Module).   
       
   208         * @param aPreviousURISegmentList    URI list with mapping LUID information,
       
   209                                             which is known by DM engine. An adapter
       
   210                                             can use this information when verifying
       
   211                                             if old objects still exists. An adapter
       
   212                                             also knows what objects are new to DM
       
   213                                             engine and can provide LUID mapping for
       
   214                                             them. aPreviousURISegmentList parameter
       
   215                                             (see above) helps to recognise new
       
   216                                             objects.
       
   217         * @param aResultsRef                Reference to correct results, i.e. this
       
   218                                             reference must be used when returning
       
   219                                             the result by calling the SetResultsL.
       
   220         * @param aStatusRef                 Reference to correct command, i.e. this
       
   221                                             reference must be used when calling the
       
   222                                             SetStatusL of this command.
       
   223         * @publishedPartner
       
   224         * @prototype
       
   225         */
       
   226         void ChildURIListL( const TDesC8& aURI, 
       
   227                             const TDesC8& aLUID,
       
   228                             const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
       
   229                             TInt aResultsRef, 
       
   230                             TInt aStatusRef 
       
   231                           );
       
   232     
       
   233         /**
       
   234         * The function adds node object. In some cases an implementation of the
       
   235         * function may be empty function, if the node object does not need concrete
       
   236         * database update. Still this function may be helpful to an adapter, i.e. in
       
   237         * passing mapping LUID of the node to DM Module. The SetStatusL should be
       
   238         * used as described in UpdateLeafObjectL()
       
   239         * @param aURI           URI of the object
       
   240         * @param aParentLUID    LUID of the parent object (if the adapter have
       
   241                                 earlier returned LUID to the DM Module).   
       
   242         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   243                                 must be used when calling the SetStatusL of this
       
   244                                 command.
       
   245         * @publishedPartner
       
   246         * @prototype
       
   247         */
       
   248         void AddNodeObjectL( const TDesC8& aURI, 
       
   249                              const TDesC8& aParentLUID,
       
   250                              TInt aStatusRef 
       
   251                            );
       
   252 
       
   253         /**
       
   254         * The function implements execute command. The information about the success
       
   255         * of the command should be returned by calling SetStatusL function of
       
   256         * MSmlDmCallback callback interface. This makes it possible to buffer the
       
   257         * commands.
       
   258         * However, all the status codes for buffered commands must be returned at
       
   259         * the latest when the CompleteOutstandingCmdsL() of adapter is called.
       
   260         * @param aURI           URI of the command
       
   261         * @param aLUID          LUID of the object (if the adapter have earlier
       
   262                                 returned LUID to the DM Module).   
       
   263         * @param aArgument      Argument for the command
       
   264         * @param aType          MIME type of the object 
       
   265         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   266                                 must be used when calling the SetStatusL of this
       
   267                                 command.
       
   268         * @publishedPartner
       
   269         * @prototype
       
   270         */
       
   271         void ExecuteCommandL( const TDesC8& aURI, 
       
   272                               const TDesC8& aLUID,
       
   273                               const TDesC8& aArgument, 
       
   274                               const TDesC8& aType,
       
   275                               TInt aStatusRef 
       
   276                             );
       
   277 
       
   278         /**
       
   279         * The function implements execute command. The information about the
       
   280         * success of the command should be returned by calling SetStatusL function
       
   281         * of MSmlDmCallback callback interface. This makes it possible to buffer the
       
   282         * commands.
       
   283         * However, all the status codes for buffered commands must be returned at
       
   284         * the latest when the CompleteOutstandingCmdsL() of adapter is called.
       
   285         * @param aURI           URI of the command
       
   286         * @param aLUID          LUID of the object (if the adapter have earlier
       
   287                                 returned LUID to the DM Module).   
       
   288         * @param aStream        Argument for the command. Adapter should create
       
   289                                 write stream and return, when data is written to
       
   290                                 stream by DM agent, StreamCommittedL() is called by
       
   291                                 DM engine
       
   292         * @param aType          MIME type of the object 
       
   293         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   294                                 must be used when calling the SetStatusL of this
       
   295                                 command.
       
   296         * @publishedPartner
       
   297         * @prototype
       
   298         */
       
   299         void ExecuteCommandL( const TDesC8& aURI, 
       
   300                               const TDesC8& aLUID,
       
   301                               RWriteStream*& aStream, 
       
   302                               const TDesC8& aType,
       
   303                               TInt aStatusRef 
       
   304                             );
       
   305 
       
   306         /**
       
   307         * The function implements copy command. The information about the success of
       
   308         * the command should be returned by calling SetStatusL function of
       
   309         * MSmlDmCallback callback interface. This makes it possible to buffer the
       
   310         * commands.
       
   311         * However, all the status codes for buffered commands must be returned at
       
   312         * the latest when the CompleteOutstandingCmdsL() of adapter is called.
       
   313         * @param aTargetURI     Target URI for the command
       
   314         * @param aSourceLUID    LUID of the target object (if one exists, and if the adapter
       
   315                                 has earlier returned a LUID to the DM Module).   
       
   316         * @param aSourceURI     Source URI for the command
       
   317         * @param aSourceLUID    LUID of the source object (if the adapter has
       
   318                                 earlier returned a LUID to the DM Module).   
       
   319         * @param aType          MIME type of the objects
       
   320         * @param aStatusRef     Reference to correct command, i.e. this reference
       
   321                                 must be used when calling the SetStatusL of this
       
   322                                 command.
       
   323         * @publishedPartner
       
   324         * @prototype
       
   325         */
       
   326         void CopyCommandL( const TDesC8& aTargetURI, 
       
   327                            const TDesC8& aTargetLUID,
       
   328                            const TDesC8& aSourceURI, 
       
   329                            const TDesC8& aSourceLUID,
       
   330                            const TDesC8& aType, 
       
   331                            TInt aStatusRef 
       
   332                          );
       
   333 
       
   334         /**
       
   335         * The function indicates start of Atomic command.
       
   336         * @publishedPartner
       
   337         * @prototype
       
   338         */
       
   339         void StartAtomicL();
       
   340     
       
   341         /**
       
   342         * The function indicates successful end of Atomic command. The adapter
       
   343         * should commit all changes issued between StartAtomicL() and
       
   344         * CommitAtomicL()
       
   345         * @publishedPartner
       
   346         * @prototype
       
   347         */
       
   348         void CommitAtomicL();
       
   349     
       
   350         /**
       
   351         * The function indicates unsuccessful end of Atomic command. The adapter
       
   352         * should rollback all changes issued between StartAtomicL() and
       
   353         * RollbackAtomicL(). If rollback fails for a command, adapter should use
       
   354         * SetStatusL() to indicate it.
       
   355         * @publishedPartner
       
   356         * @prototype
       
   357         */
       
   358         void RollbackAtomicL();
       
   359     
       
   360         /**
       
   361         * Returns ETrue if adapter supports streaming otherwise EFalse.
       
   362         * @param aItemSize size limit for stream usage
       
   363         * @return TBool ETrue for streaming support
       
   364         * @publishedPartner
       
   365         * @prototype
       
   366         */
       
   367         TBool StreamingSupport( TInt& aItemSize );
       
   368     
       
   369         /**
       
   370         * Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has
       
   371         * been written to and committed. Not called when fetching item.
       
   372         * @publishedPartner
       
   373         * @prototype
       
   374         */  
       
   375         void StreamCommittedL();
       
   376     
       
   377         /**
       
   378         * The function tells the adapter that all the commands of the message that
       
   379         * can be passed to the adapter have now been passed.  This indicates that
       
   380         * the adapter must supply status codes and results to any buffered commands.
       
   381         * This must be done at latest by the time this function returns.
       
   382         * This function is used at the end of SyncML messages, and during processing
       
   383         * of Atomic.   In the case of Atomic processing, the function will be
       
   384         * followed by a call to CommitAtomicL or RollbackAtomicL.
       
   385         * @publishedPartner
       
   386         * @prototype
       
   387         */
       
   388         void CompleteOutstandingCmdsL();
       
   389 
       
   390     private: // New methods
       
   391         void CSWInstAdapter::FillNodeInfoL( MSmlDmDDFObject& aDDFObject, 
       
   392                                             TSmlDmAccessTypes& aAccessTypes, 
       
   393                                             MSmlDmDDFObject::TScope aScope,
       
   394                                             MSmlDmDDFObject::TDFFormat aFormat, 
       
   395                                             MSmlDmDDFObject::TOccurence aOccurence,
       
   396                                             const TDesC8& aDescription,
       
   397                                             const TDesC8& aMIMEType );
       
   398     private: // Constructor
       
   399         /**
       
   400         * Symbian 2nd phase constructor
       
   401         */
       
   402         void ConstructL();
       
   403 
       
   404         /**
       
   405         * C++ Constructor
       
   406         */    
       
   407         CSWInstAdapter( TAny* aEcomArguments );
       
   408                                                                                  
       
   409     private: // Data
       
   410         CRepository* iSettingsCenRep;
       
   411         CRepository* iLocalVarCenRep;
       
   412     };
       
   413 
       
   414 #endif // C_CSWINSTADAPTER_H
       
   415 
       
   416 // End Of File
       
   417