1 /* |
|
2 * Copyright (c) 2008-2009 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 the License "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 #include "tbackuprestore.h" |
|
20 #include "tbackuprestorestep.h" |
|
21 |
|
22 _LIT(KServerName,"tups_backuprestore"); |
|
23 |
|
24 CTBackupRestoreServer* CTBackupRestoreServer::NewL() |
|
25 { |
|
26 CTBackupRestoreServer * server = new (ELeave) CTBackupRestoreServer(); |
|
27 CleanupStack::PushL(server); |
|
28 |
|
29 // Either use a StartL or ConstructL, the latter will permit Server Logging. |
|
30 |
|
31 //server->StartL(KServerName); |
|
32 server->ConstructL(KServerName); |
|
33 CleanupStack::Pop(server); |
|
34 return server; |
|
35 } |
|
36 |
|
37 LOCAL_C void MainL() |
|
38 { |
|
39 // Leave the hooks in for platform security |
|
40 #if (defined __DATA_CAGING__) |
|
41 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
42 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
43 #endif |
|
44 CActiveScheduler* sched=NULL; |
|
45 sched=new(ELeave) CActiveScheduler; |
|
46 CActiveScheduler::Install(sched); |
|
47 CTBackupRestoreServer* server = NULL; |
|
48 TRAPD(err,server = CTBackupRestoreServer::NewL()); |
|
49 if(!err) |
|
50 { |
|
51 RProcess::Rendezvous(KErrNone); |
|
52 sched->Start(); |
|
53 } |
|
54 delete server; |
|
55 delete sched; |
|
56 } |
|
57 |
|
58 GLDEF_C TInt E32Main() |
|
59 { |
|
60 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
61 if(cleanup == NULL) |
|
62 { |
|
63 return KErrNoMemory; |
|
64 } |
|
65 TRAP_IGNORE(MainL()); |
|
66 delete cleanup; |
|
67 return KErrNone; |
|
68 } |
|
69 |
|
70 CTestStep* CTBackupRestoreServer::CreateTestStep(const TDesC& aStepName) |
|
71 { |
|
72 CTestStep* testStep = NULL; |
|
73 |
|
74 if(aStepName == KTStepInstall) |
|
75 { |
|
76 testStep = new CTStepInstall(); |
|
77 } |
|
78 else if(aStepName == KTStepUninstall) |
|
79 { |
|
80 testStep = new CTStepUninstall(); |
|
81 } |
|
82 else if(aStepName == KTStepBackup) |
|
83 { |
|
84 testStep = new CTStepBackup(); |
|
85 } |
|
86 else if(aStepName == KTStepRestore) |
|
87 { |
|
88 testStep = new CTStepRestore(); |
|
89 } |
|
90 |
|
91 return testStep; |
|
92 } |
|