ncdengine/provider/server/inc/ncdinstalloperationimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDINSTALLOPERATION_H
       
    20 #define C_NCDINSTALLOPERATION_H
       
    21 
       
    22 #include <e32cmn.h>
       
    23 #include "ncdbaseoperation.h"
       
    24 #include "ncdoperationdatatypes.h"
       
    25 #include "ncdreportdefines.h"
       
    26 
       
    27 class CNcdNodeManager;
       
    28 class MNcdStorageClient;
       
    29 class CNcdNodeIdentifier;
       
    30 class MCatalogsContext;
       
    31 class CNcdFileInfo;
       
    32 class MNcdOperationRemoveHandler;
       
    33 class MNcdPurchaseDetails;
       
    34 class MNcdPurchaseInstallInfo;
       
    35 class MCatalogsHttpSession;
       
    36 class MCatalogsAccessPointManager;
       
    37 class MNcdInstallReportObserver;
       
    38 class MNcdInstallationService;
       
    39 
       
    40 /** 
       
    41  * Install operation
       
    42  *
       
    43  */
       
    44 class CNcdInstallOperation : public CNcdBaseOperation
       
    45     {
       
    46 public:
       
    47     
       
    48     /**
       
    49      * NewL
       
    50      *
       
    51      */
       
    52     static CNcdInstallOperation* NewL(
       
    53         MNcdOperationRemoveHandler& aRemoveHandler, 
       
    54         const CNcdNodeIdentifier& aNodeId,
       
    55         CNcdGeneralManager& aGeneralManager,
       
    56         MCatalogsHttpSession& aHttpSession,
       
    57         MNcdInstallReportObserver& aReportObserver,
       
    58         MCatalogsSession& aSession );
       
    59 
       
    60     
       
    61     /**
       
    62      * Destructor
       
    63      */
       
    64     ~CNcdInstallOperation();
       
    65     
       
    66 public: // New functions
       
    67 
       
    68     /**
       
    69      * Returns the identifier of the node that this operation relates to.
       
    70      *
       
    71      * @return Node identifier.
       
    72      */
       
    73     const CNcdNodeIdentifier& NodeIdentifier() const;
       
    74     
       
    75 public: // From CNcdBaseOperation
       
    76 
       
    77     /**
       
    78      * @see CNcdBaseOperation::Cancel()
       
    79      */
       
    80     void Cancel();    
       
    81     
       
    82     
       
    83     /**
       
    84      * @see CNcdBaseOperation::ReceiveMessage()
       
    85      */
       
    86     void ReceiveMessage( 
       
    87         MCatalogsBaseMessage* aMessage,
       
    88         TInt aFunctionNumber );    
       
    89 
       
    90     /**
       
    91      * @see CNcdBaseOperation::CounterPartLost
       
    92      */
       
    93     void CounterPartLost( const MCatalogsSession& aSession );
       
    94 
       
    95 
       
    96 protected: // From CNcdBaseOperation
       
    97 
       
    98     /**
       
    99      * @see CNcdBaseOperation::RunOperation()
       
   100      */
       
   101     TInt RunOperation();        
       
   102     
       
   103 
       
   104     /**
       
   105      * @see CNcdBaseOperation::Initialize()
       
   106      */    
       
   107     TInt Initialize();
       
   108     
       
   109 protected:
       
   110 
       
   111     // Constructor
       
   112     CNcdInstallOperation( 
       
   113         MNcdOperationRemoveHandler& aRemoveHandler,
       
   114         CNcdGeneralManager& aGeneralManager,
       
   115         MCatalogsHttpSession& aHttpSession,        
       
   116         MNcdInstallReportObserver& aReportObserver,
       
   117         MCatalogsSession& aSession );
       
   118         
       
   119     void ConstructL( const CNcdNodeIdentifier& aNodeId );
       
   120 
       
   121 protected:
       
   122 
       
   123     
       
   124     void GetFileInfoL( MCatalogsBaseMessage& aMessage );
       
   125     
       
   126     void HandleAllFilesInstalledL( 
       
   127         TInt aFinalIndex, 
       
   128         MCatalogsBaseMessage& aMessage );
       
   129     
       
   130     void UpdateInstalledFileInfoL( 
       
   131         MCatalogsBaseMessage& aMessage );
       
   132 
       
   133     void CreateReportL();
       
   134     void StartReportL( MCatalogsBaseMessage& aMessage );
       
   135     void CompleteReportL( MCatalogsBaseMessage& aMessage );
       
   136     void UpdateReportAccessPointL( const TUid& aClientUid );
       
   137 
       
   138 
       
   139     // Updates the file info to purchase history
       
   140     void UpdatePurchaseHistoryL( const CNcdFileInfo& aInfo,
       
   141         const RArray<TUid>& aAppUids, const TUid& aClientUid );
       
   142 
       
   143 
       
   144     TBool ReplaceInstallInfoL( 
       
   145         MNcdPurchaseDetails& aDetails, 
       
   146         const MNcdPurchaseInstallInfo& aInfo );
       
   147 
       
   148 
       
   149     TBool IsJava( 
       
   150         const TDesC& aMimeType, 
       
   151         TBool aAcceptJad = EFalse ) const;
       
   152 
       
   153     /**
       
   154      * Gets the path of the file that matches the index in the message
       
   155      */
       
   156     HBufC* FilePathLC( 
       
   157         MCatalogsBaseMessage& aMessage );
       
   158 
       
   159     void OpenFileL( 
       
   160         MCatalogsBaseMessage& aMessage );
       
   161     
       
   162     void DoReceiveMessageL( 
       
   163         MCatalogsBaseMessage* aMessage,
       
   164         TInt aFunctionNumber );
       
   165     
       
   166     
       
   167     void DeleteFileL( MCatalogsBaseMessage& aMessage );
       
   168     
       
   169     TInt ReadFileIndexL( MCatalogsBaseMessage& aMessage );
       
   170     
       
   171     // Deletes the JAD from disk, iJadFile is also deleted
       
   172     void DeleteJad();
       
   173 private:
       
   174 
       
   175     MCatalogsHttpSession& iHttpSession;
       
   176     MCatalogsAccessPointManager& iAccessPointManager;
       
   177     MNcdInstallReportObserver& iReportObserver;
       
   178     TNcdReportId iReportId;
       
   179 
       
   180     CNcdNodeIdentifier* iNodeId;   
       
   181 
       
   182     // The message is set when ReceiveMessage is called. The message
       
   183     // is used in the CounterPartLost-function that informs the message
       
   184     // if the session has been lost.
       
   185     MCatalogsBaseMessage* iMessage;
       
   186     
       
   187     TBool iIsDependency;
       
   188         
       
   189     HBufC* iJadFile; // JAD path if installing JAD+JAR
       
   190     MNcdInstallationService* iInstallService; // not owned 
       
   191     };
       
   192 
       
   193 #endif // C_NCDINSTALLOPERATION_H