filemanager/src/fmbkupengine/inc/CMMCScBkupEngineImpl.h
branchRCL_3
changeset 20 491b3ed49290
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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 *     Scans for names of the files according to array.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CMMCSCBKUPENGINEIMPL_H__
       
    20 #define __CMMCSCBKUPENGINEIMPL_H__
       
    21 
       
    22 // System includes
       
    23 #include <connect/sbeclient.h>
       
    24 
       
    25 // User includes
       
    26 #include "MMCScBkupConfig.h"
       
    27 #include "MMMCScBkupDriver.h"
       
    28 #include "MMCScBkupStateIds.h"
       
    29 #include "MMCScBkupOperations.h"
       
    30 #include "MMMCScBkupEngineObserver.h"
       
    31 #include "MMMCScBkupProgressObserver.h"
       
    32 
       
    33 // Namespaces
       
    34 using namespace conn;
       
    35 
       
    36 // Classes referenced
       
    37 class RFs;
       
    38 class CMMCScBkupState;
       
    39 class CMMCScBkupArchive;
       
    40 class CMMCScBkupStateFactory;
       
    41 class CMMCScBkupOpParamsBase;
       
    42 class MMMCScBkupEngineObserver;
       
    43 class CMMCScBkupFileListCollection;
       
    44 class CMMCScBkupDataOwnerCollection;
       
    45 class MMMCScBkupArchiveDataInterface;
       
    46 class CMMCScBkupArchiveInfo;
       
    47 
       
    48 
       
    49 /**
       
    50 *
       
    51 *
       
    52 * @since 3.0
       
    53 */
       
    54 NONSHARABLE_CLASS(CMMCScBkupEngineImpl) : public CActive, public MMMCScBkupDriver, public MMMCScBkupProgressObserver
       
    55     {
       
    56     public:
       
    57 
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         */
       
    61         static CMMCScBkupEngineImpl* NewL( RFs& aFsSession );
       
    62 
       
    63         /**
       
    64         * Destructor
       
    65         */
       
    66         ~CMMCScBkupEngineImpl();
       
    67 
       
    68     private:
       
    69 
       
    70         /**
       
    71         * C++ default constructor
       
    72         */
       
    73         CMMCScBkupEngineImpl( RFs& aFsSession );
       
    74 
       
    75         /**
       
    76         * Second phase constructor
       
    77         */
       
    78         void ConstructL( );
       
    79 
       
    80 
       
    81     public: // API
       
    82 
       
    83         /**
       
    84         *
       
    85         */
       
    86         void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams );
       
    87 
       
    88         /**
       
    89         *
       
    90         */
       
    91         void CleanupL( TInt aError = KErrNone );
       
    92         
       
    93         /**
       
    94         *
       
    95         */
       
    96         TBool ValidArchiveForRestoreL( const TDesC& aFileName );
       
    97         
       
    98         /**
       
    99         *
       
   100         */
       
   101         TInt64 TotalOperationSizeL() const;
       
   102  
       
   103         /**
       
   104         *
       
   105         */
       
   106         TBool RebootRequired() const;
       
   107         
       
   108         /**
       
   109         *
       
   110         */
       
   111         TBool DeleteArchivesL( RPointerArray< CMMCScBkupArchiveInfo >& aArchives ) const;
       
   112         
       
   113         /**
       
   114         *
       
   115         */
       
   116         void ListArchivesL(
       
   117             RPointerArray< CMMCScBkupArchiveInfo >& aArchives,
       
   118             CMMCScBkupOpParamsBase* aParams,
       
   119             const TUint32 aDriveAttMatch,
       
   120             const TInt aDriveMatch );
       
   121         
       
   122     private: // From MMMCScBkupDriver
       
   123         void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState );
       
   124         void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState, TMMCScBkupStateId aNextState );
       
   125         void DrvHandleStateExecutionErrorL( const CMMCScBkupState& aState, TInt aError );
       
   126     
       
   127     private: // From MMMCScBkupDriver
       
   128         MMMCScBkupArchiveDataInterface& DrvADI() const;
       
   129         CMMCScBkupArchive& DrvArchive() const;
       
   130         CSBEClient& DrvSecureBackupClient() const;
       
   131         TMMCScBkupOperationType DrvOperation() const;
       
   132         CMMCScBkupOpParamsBase& DrvParamsBase() const;
       
   133         CMMCScBkupDataOwnerCollection& DrvDataOwners() const;
       
   134         RPointerArray<CMMCScBkupDataOwnerCollection>& DrvDataOwnersAll();
       
   135         CMMCScBkupFileListCollection& DrvFileList() const;
       
   136         TBool DrvLastCategory() const;
       
   137         void DrvStoreTotalProgress(TInt64 aProgress);
       
   138         TInt64 DrvTotalProgress() const;
       
   139         MMMCScBkupProgressObserver& DrvProgressHandler() const;
       
   140     
       
   141     private: // From MMMCScBkupProgressObserver
       
   142         void MMCScBkupHandleProgress( TInt aAmountCompleted );
       
   143         void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount );
       
   144         TInt MMCScBkupHandleFreeSpace( TInt aPercentualFree );
       
   145         void MMCScBkupStartBackuping( TBool aProceed );
       
   146 
       
   147     private: // From CActive
       
   148         void RunL();
       
   149         void DoCancel();
       
   150         TInt RunError(TInt aError);
       
   151 
       
   152     private: // Internal
       
   153 
       
   154         /**
       
   155         *
       
   156         */
       
   157         void CompleteOwnRequest(TInt aCompletionCode = KErrNone, TBool aSetActive = ETrue);
       
   158 
       
   159         /**
       
   160         *
       
   161         */
       
   162         void NotifyObserver(MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData = KErrNone);
       
   163 
       
   164         /**
       
   165         *
       
   166         */
       
   167         void PrepareForBackupL(TBool aPartial);
       
   168 
       
   169         /**
       
   170         *
       
   171         */
       
   172         void PrepareForRestoreL(TBool aPartial);
       
   173 
       
   174         /**
       
   175         *
       
   176         */
       
   177         void SetParameters(CMMCScBkupOpParamsBase* aParameters);
       
   178 
       
   179         /**
       
   180         *
       
   181         */
       
   182         void CreateFactoryL(TMMCScBkupOperationType aOperation);
       
   183 
       
   184         /**
       
   185         *
       
   186         */
       
   187         TBool CurrentStateAvailable() const;
       
   188 
       
   189         /**
       
   190         *
       
   191         */
       
   192         TMMCScBkupStateId CurrentStateId() const;
       
   193 
       
   194         /**
       
   195         *
       
   196         */
       
   197         CMMCScBkupState& CurrentState();
       
   198 
       
   199         /**
       
   200         *
       
   201         */
       
   202         const CMMCScBkupState& CurrentState() const;
       
   203 
       
   204         /**
       
   205         *
       
   206         */
       
   207         void PrepareNextStateL( TMMCScBkupStateId aCurrentStateId );
       
   208 
       
   209         /**
       
   210         *
       
   211         */
       
   212         void DestroyCurrentState();
       
   213 
       
   214         /**
       
   215         *
       
   216         */
       
   217         void ExecuteStateL();
       
   218 
       
   219         /**
       
   220         *
       
   221         */
       
   222         void PrepareObjectsL();
       
   223 
       
   224 #ifdef DEBUGGING_DATA_TRANSFER
       
   225 
       
   226         /**
       
   227         *
       
   228         */
       
   229         void CleanBackupFilesL();
       
   230         
       
   231         /**
       
   232         *
       
   233         */
       
   234         void ClearRestoreFilesL();
       
   235 #endif
       
   236 
       
   237     private: // Member data
       
   238 
       
   239         // Referenced objects
       
   240         // file server session
       
   241         RFs& iFsSession;
       
   242         // backup engine observer
       
   243         MMMCScBkupEngineObserver* iObserver;
       
   244 
       
   245         // Owned objects
       
   246         //
       
   247         TInt64 iCumulativeProgress;
       
   248         // Secure backup engine client
       
   249         CSBEClient* iSBEClient;
       
   250         // Archive array
       
   251         RMMCScBkupPointerArray<CMMCScBkupArchive> iArchives;
       
   252         // Current operation
       
   253         TMMCScBkupOperationType iOperationType;
       
   254         // Operational parameters
       
   255         CMMCScBkupOpParamsBase* iParameters;
       
   256         //
       
   257         CMMCScBkupState* iCurrentState;
       
   258         // Current factory
       
   259         CMMCScBkupStateFactory* iFactory;
       
   260         //
       
   261         RPointerArray<CMMCScBkupDataOwnerCollection> iDataOwners;
       
   262         //
       
   263         RPointerArray<CMMCScBkupFileListCollection> iFileLists;
       
   264         //
       
   265         TInt iCurrentArchive;
       
   266         //
       
   267         TInt64 iTotalProgress;
       
   268         //
       
   269         TBool iActiveDataProcessingOngoing;
       
   270     };
       
   271 
       
   272 
       
   273 
       
   274 
       
   275 #endif // __CMMCSCBKUPENGINEIMPL_H__
       
   276 
       
   277 //End of File