|
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 * This file implements a server for the Reference Installer. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <usif/sif/siftransportserverstartup.h> |
|
21 #include "sifrefinstallerclientserver.h" |
|
22 #include "sifrefinstallertask.h" |
|
23 #include "sifrefuihandler.h" |
|
24 |
|
25 using namespace Usif; |
|
26 |
|
27 namespace |
|
28 { |
|
29 |
|
30 /** |
|
31 A factory function that instantiates a UI handler. Reference Installer tasks |
|
32 call this function when they need UI interaction. |
|
33 |
|
34 @return Pointer to a MInstallerUIHandler object. |
|
35 @leave System wide error code |
|
36 */ |
|
37 MInstallerUIHandler* NewSifRefUiHandlerL() |
|
38 { |
|
39 return new (ELeave) MSifRefUIHandler; |
|
40 } |
|
41 |
|
42 /** |
|
43 A factory function that instantiates Reference Installer tasks. The CSifTransportRequest |
|
44 class calls this function in order to process incoming software management requests. |
|
45 */ |
|
46 CSifTransportTask* RefInstallerTaskFactoryL(TransportTaskFactory::TTaskType aTaskType, TTransportTaskParams& aParams) |
|
47 { |
|
48 // Security check - the client must have the SIF Server SID |
|
49 if (aParams.iSecurityContext->SecureId() != KSifServerUid) |
|
50 { |
|
51 User::Leave(KErrPermissionDenied); |
|
52 } |
|
53 |
|
54 // Instantiate an appropriate task |
|
55 switch (aTaskType) |
|
56 { |
|
57 case TransportTaskFactory::EGetComponentInfo: |
|
58 return CSifRefGetComponentInfoTask::NewL(aParams); |
|
59 |
|
60 case TransportTaskFactory::EInstall: |
|
61 return CSifRefInstallTask::NewL(aParams, NewSifRefUiHandlerL); |
|
62 |
|
63 case TransportTaskFactory::EUninstall: |
|
64 return CSifRefUninstallTask::NewL(aParams, NewSifRefUiHandlerL); |
|
65 |
|
66 case TransportTaskFactory::EActivate: |
|
67 return new (ELeave) CSifRefActivateDeactivateTask(aParams, EActivated); |
|
68 |
|
69 case TransportTaskFactory::EDeactivate: |
|
70 return new (ELeave) CSifRefActivateDeactivateTask(aParams, EDeactivated); |
|
71 |
|
72 default: |
|
73 User::Leave(KErrArgument); |
|
74 } |
|
75 return NULL; |
|
76 } |
|
77 |
|
78 } |
|
79 |
|
80 /** |
|
81 Executable entrypoint of the Reference Installer Server. |
|
82 |
|
83 @return Symbian OS error code where KErrNone indicates |
|
84 success and any other value indicates failure. |
|
85 */ |
|
86 TInt E32Main() |
|
87 { |
|
88 return StartTransportServer(KSifRefInstallerServerName, Version(), RefInstallerTaskFactoryL); |
|
89 } |