00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00032 #include <ssm/ssmcommandlist.h>
00033 #include <ssm/ssmpublishsystemstateinfo.h>
00034 #include <ssm/ssmcommandfactory.h>
00035 #include <ssm/ssmstartupproperties.h>
00036 #include "dummy_restore_statepolicy.h"
00037
00038
00044 EXPORT_C MSsmStatePolicy* CSsmDummyRestoreStatePolicy::NewL()
00045 {
00046 CSsmDummyRestoreStatePolicy* self = new (ELeave) CSsmDummyRestoreStatePolicy;
00047 CleanupStack::PushL(self);
00048 CleanupStack::Pop(self);
00049 return self;
00050 }
00051
00055 CSsmDummyRestoreStatePolicy::CSsmDummyRestoreStatePolicy()
00056 {
00057 }
00058
00062 CSsmDummyRestoreStatePolicy::~CSsmDummyRestoreStatePolicy()
00063 {
00064 delete iCommandList;
00065 }
00066
00070 void CSsmDummyRestoreStatePolicy::Initialize(TRequestStatus& aStatus)
00071 {
00072 TRequestStatus* rs = &aStatus;
00073 User::RequestComplete(rs, KErrNone);
00074 }
00075
00079 void CSsmDummyRestoreStatePolicy::InitializeCancel()
00080 {
00081 }
00082
00088 void CSsmDummyRestoreStatePolicy::Release()
00089 {
00090 delete this;
00091 }
00092
00106 MSsmStatePolicy::TResponse CSsmDummyRestoreStatePolicy::TransitionAllowed(const TSsmStateTransition& , TSsmStateTransition const* , TSsmStateTransition const* , const RMessagePtr2& )
00107 {
00108 return EDefinitelyAllowed;
00109 }
00110
00119 void CSsmDummyRestoreStatePolicy::PrepareCommandList(TSsmState aState, TInt , TRequestStatus& aStatus)
00120 {
00121 TRAPD(err, doPrepareCommandListL(aState));
00122 TRequestStatus* rs = &aStatus;
00123 User::RequestComplete(rs, err);
00124 }
00125
00126 void CSsmDummyRestoreStatePolicy::doPrepareCommandListL(TSsmState aState)
00127 {
00128
00129 delete iCommandList;
00130 iCommandList = NULL;
00131 iCommandList = CSsmCommandList::NewL();
00132 _LIT(KProcessName, "dummybackup.exe");
00133 _LIT(KNullDesc, "");
00134
00135 CSsmStartupProperties* startupProperties = CSsmStartupProperties::NewL(KProcessName,KNullDesc);
00136 CleanupStack::PushL(startupProperties);
00137 TSsmPublishSystemStateInfo info;
00138 TInt16 retries =0;
00139 info.Set(aState, ETraverseParentsFirst, retries);
00140
00141 MSsmCommand* cmd1 = SsmCommandFactory::ConstructPublishSystemStateCommandLC(ECmdCriticalSeverity, ESsmWaitForSignal, info);
00142
00143 MSsmCommand* cmd2 = SsmCommandFactory::ConstructStartProcessCommandLC(ECmdCriticalSeverity,startupProperties);
00144 iCommandList->AppendL(cmd1);
00145 iCommandList->AppendL(cmd2);
00146 CleanupStack::Pop(2);
00147 CleanupStack::PopAndDestroy(startupProperties);
00148 }
00149
00155 void CSsmDummyRestoreStatePolicy::PrepareCommandListCancel()
00156 {
00157 delete iCommandList;
00158 iCommandList = NULL;
00159 }
00160
00166 CSsmCommandList* CSsmDummyRestoreStatePolicy::CommandList()
00167 {
00168 CSsmCommandList* list = iCommandList;
00169 iCommandList = NULL;
00170 return list;
00171 }
00172
00184 TBool CSsmDummyRestoreStatePolicy::GetNextState(TSsmState , TInt , TInt , TInt , TSsmState& )
00185 {
00186 return EFalse;
00187 }