commands/restore/restore.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // restore.h
       
     2 // 
       
     3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #include <fshell/ioutils.h>
       
    14 #include <babackup.h>
       
    15 
       
    16 using namespace IoUtils;
       
    17 
       
    18 _LIT(KArgStart, 			"start");
       
    19 _LIT(KArgStop,	 			"stop");
       
    20 _LIT(KBackupProcessName,	"backup_child");
       
    21 _LIT(KBackupSemaphore,		"AutometricBackup");
       
    22 
       
    23 class MBackupParent
       
    24 	{
       
    25 public:
       
    26 	virtual void Finished(const TInt aError) = 0;	
       
    27 	};
       
    28 
       
    29 class CRestoreDriver : public CActive
       
    30 	{
       
    31 public:
       
    32 	static CRestoreDriver* NewL(MBackupParent& aParent);
       
    33 	~CRestoreDriver();
       
    34 	void SendInstructionL(MBackupObserver::TFileLockFlags aInstruction);
       
    35 private:
       
    36 	CRestoreDriver(MBackupParent& aParent);
       
    37 	void ConstructL();
       
    38 	void SelfComplete(const TInt aError);
       
    39 	void LaunchProcessL();
       
    40 	void TerminateProcessL();
       
    41 	TBool ChildProcessExists();
       
    42 
       
    43 	// from CActive
       
    44 	void DoCancel();
       
    45 	void RunL();
       
    46 private:
       
    47 	MBackupParent& iParent;
       
    48 	RProcess iChild;
       
    49 	MBackupObserver::TFileLockFlags iInstruction;
       
    50 	};
       
    51 
       
    52 class CCmdRestore : public CCommandBase, public MBackupParent
       
    53 	{
       
    54 public:
       
    55 	static CCommandBase* NewLC();
       
    56 	~CCmdRestore();
       
    57 private:
       
    58 	CCmdRestore();
       
    59 
       
    60 	// From CCommandBase.
       
    61 	virtual const TDesC& Name() const;
       
    62 	virtual void DoRunL();
       
    63 	virtual void ArgumentsL(RCommandArgumentList& aArguments);
       
    64 	virtual void OptionsL(RCommandOptionList& aOptions);
       
    65 
       
    66 	// From MBackupParent
       
    67 	virtual void Finished(const TInt aError);
       
    68 private:
       
    69 	CRestoreDriver* iRestore;
       
    70 	enum
       
    71 		{
       
    72 		EStart,
       
    73 		EStop
       
    74 		} iOperation;
       
    75 	};