filemanager/bkupengine/inc/CMMCScBkupEngineImpl.h
changeset 0 6a9f87576119
child 19 5181328fad28
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     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         void ListArchivesL(
       
   112             RPointerArray< CMMCScBkupArchiveInfo >& aArchives,
       
   113             CMMCScBkupOpParamsBase* aParams,
       
   114             const TUint32 aDriveAttMatch,
       
   115             const TInt aDriveMatch );
       
   116         
       
   117     private: // From MMMCScBkupDriver
       
   118         void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState );
       
   119         void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState, TMMCScBkupStateId aNextState );
       
   120         void DrvHandleStateExecutionErrorL( const CMMCScBkupState& aState, TInt aError );
       
   121     
       
   122     private: // From MMMCScBkupDriver
       
   123         MMMCScBkupArchiveDataInterface& DrvADI() const;
       
   124         CMMCScBkupArchive& DrvArchive() const;
       
   125         CSBEClient& DrvSecureBackupClient() const;
       
   126         TMMCScBkupOperationType DrvOperation() const;
       
   127         CMMCScBkupOpParamsBase& DrvParamsBase() const;
       
   128         CMMCScBkupDataOwnerCollection& DrvDataOwners() const;
       
   129         RPointerArray<CMMCScBkupDataOwnerCollection>& DrvDataOwnersAll();
       
   130         CMMCScBkupFileListCollection& DrvFileList() const;
       
   131         TBool DrvLastCategory() const;
       
   132         void DrvStoreTotalProgress(TInt64 aProgress);
       
   133         TInt64 DrvTotalProgress() const;
       
   134         MMMCScBkupProgressObserver& DrvProgressHandler() const;
       
   135     
       
   136     private: // From MMMCScBkupProgressObserver
       
   137         void MMCScBkupHandleProgress( TInt aAmountCompleted );
       
   138         void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount );
       
   139         TInt MMCScBkupHandleFreeSpace( TInt aPercentualFree );
       
   140         void MMCScBkupStartBackuping( TBool aProceed );
       
   141 
       
   142     private: // From CActive
       
   143         void RunL();
       
   144         void DoCancel();
       
   145         TInt RunError(TInt aError);
       
   146 
       
   147     private: // Internal
       
   148 
       
   149         /**
       
   150         *
       
   151         */
       
   152         void CompleteOwnRequest(TInt aCompletionCode = KErrNone, TBool aSetActive = ETrue);
       
   153 
       
   154         /**
       
   155         *
       
   156         */
       
   157         void NotifyObserver(MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData = KErrNone);
       
   158 
       
   159         /**
       
   160         *
       
   161         */
       
   162         void PrepareForBackupL(TBool aPartial);
       
   163 
       
   164         /**
       
   165         *
       
   166         */
       
   167         void PrepareForRestoreL(TBool aPartial);
       
   168 
       
   169         /**
       
   170         *
       
   171         */
       
   172         void SetParameters(CMMCScBkupOpParamsBase* aParameters);
       
   173 
       
   174         /**
       
   175         *
       
   176         */
       
   177         void CreateFactoryL(TMMCScBkupOperationType aOperation);
       
   178 
       
   179         /**
       
   180         *
       
   181         */
       
   182         TBool CurrentStateAvailable() const;
       
   183 
       
   184         /**
       
   185         *
       
   186         */
       
   187         TMMCScBkupStateId CurrentStateId() const;
       
   188 
       
   189         /**
       
   190         *
       
   191         */
       
   192         CMMCScBkupState& CurrentState();
       
   193 
       
   194         /**
       
   195         *
       
   196         */
       
   197         const CMMCScBkupState& CurrentState() const;
       
   198 
       
   199         /**
       
   200         *
       
   201         */
       
   202         void PrepareNextStateL( TMMCScBkupStateId aCurrentStateId );
       
   203 
       
   204         /**
       
   205         *
       
   206         */
       
   207         void DestroyCurrentState();
       
   208 
       
   209         /**
       
   210         *
       
   211         */
       
   212         void ExecuteStateL();
       
   213 
       
   214         /**
       
   215         *
       
   216         */
       
   217         void PrepareObjectsL();
       
   218 
       
   219 #ifdef DEBUGGING_DATA_TRANSFER
       
   220 
       
   221         /**
       
   222         *
       
   223         */
       
   224         void CleanBackupFilesL();
       
   225         
       
   226         /**
       
   227         *
       
   228         */
       
   229         void ClearRestoreFilesL();
       
   230 #endif
       
   231 
       
   232     private: // Member data
       
   233 
       
   234         // Referenced objects
       
   235         // file server session
       
   236         RFs& iFsSession;
       
   237         // backup engine observer
       
   238         MMMCScBkupEngineObserver* iObserver;
       
   239 
       
   240         // Owned objects
       
   241         //
       
   242         TInt64 iCumulativeProgress;
       
   243         // Secure backup engine client
       
   244         CSBEClient* iSBEClient;
       
   245         // Archive array
       
   246         RMMCScBkupPointerArray<CMMCScBkupArchive> iArchives;
       
   247         // Current operation
       
   248         TMMCScBkupOperationType iOperationType;
       
   249         // Operational parameters
       
   250         CMMCScBkupOpParamsBase* iParameters;
       
   251         //
       
   252         CMMCScBkupState* iCurrentState;
       
   253         // Current factory
       
   254         CMMCScBkupStateFactory* iFactory;
       
   255         //
       
   256         RPointerArray<CMMCScBkupDataOwnerCollection> iDataOwners;
       
   257         //
       
   258         RPointerArray<CMMCScBkupFileListCollection> iFileLists;
       
   259         //
       
   260         TInt iCurrentArchive;
       
   261         //
       
   262         TInt64 iTotalProgress;
       
   263         //
       
   264         TBool iActiveDataProcessingOngoing;
       
   265     };
       
   266 
       
   267 
       
   268 
       
   269 
       
   270 #endif // __CMMCSCBKUPENGINEIMPL_H__
       
   271 
       
   272 //End of File