|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // LOGSERVOPERATIONFACTORY.H |
|
15 // |
|
16 // |
|
17 |
|
18 #include "LogServOperationFactory.h" |
|
19 |
|
20 // User includes |
|
21 #include "logservpanic.h" |
|
22 #include "LogServOperations.h" |
|
23 #include "LogServView.h" |
|
24 |
|
25 |
|
26 ///////////////////////////////////////////////////////////////////////////////////////// |
|
27 // -----> LogServFactory (source) |
|
28 ///////////////////////////////////////////////////////////////////////////////////////// |
|
29 |
|
30 CLogServOperationBase* LogServFactory::NewOperationL(const TLogClientServerData& aCliServData, |
|
31 MLogServTaskInterface& aTaskInterface, |
|
32 MLogServOperationManager& aOperationManager, |
|
33 const RMessage2& aMessage, |
|
34 CLogPackage& aLogPackage, |
|
35 TLogServSessionId aSessionId) |
|
36 { |
|
37 // The operations are all owned by the operation queue/manager as soon |
|
38 // as they are contructed (since they are all members of a queue). |
|
39 switch(aCliServData.iOperationType) |
|
40 { |
|
41 case ELogOperationEventAdd: // security checked in CLogAddEvent::StartL |
|
42 return new(ELeave) CLogServOpEventAdd(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
43 aCliServData, aSessionId); |
|
44 case ELogOperationEventGet: // security checked in CLogGetEvent::DoRunL |
|
45 return new(ELeave) CLogServOpEventGet(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
46 aCliServData, aSessionId); |
|
47 case ELogOperationEventChange: // security checked in CLogChangeEvent::DoChangeL |
|
48 return new(ELeave) CLogServOpEventChange(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
49 aCliServData, aSessionId); |
|
50 case ELogOperationEventDelete: // security checked in CLogDeleteEvent::DoRunL |
|
51 return new(ELeave) CLogServOpEventDelete(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
52 aCliServData, aSessionId); |
|
53 case ELogOperationTypeAdd: |
|
54 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
55 { |
|
56 return new(ELeave) CLogServOpTypeAdd(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
57 aCliServData, aSessionId); |
|
58 } |
|
59 break; |
|
60 case ELogOperationTypeGet: // no security check |
|
61 return new(ELeave) CLogServOpTypeGet(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
62 aCliServData, aSessionId); |
|
63 case ELogOperationTypeChange: |
|
64 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
65 { |
|
66 return new(ELeave) CLogServOpTypeChange(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
67 aCliServData, aSessionId); |
|
68 } |
|
69 break; |
|
70 case ELogOperationTypeDelete: |
|
71 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
72 { |
|
73 return new(ELeave) CLogServOpTypeDelete(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
74 aCliServData, aSessionId); |
|
75 } |
|
76 break; |
|
77 case ELogOperationClearLog: |
|
78 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
79 { |
|
80 return new(ELeave) CLogServOpClearLog(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
81 aCliServData, aSessionId); |
|
82 } |
|
83 break; |
|
84 case ELogOperationClearRecent: |
|
85 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
86 { |
|
87 return new(ELeave) CLogServOpClearRecent(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
88 aCliServData, aSessionId); |
|
89 } |
|
90 break; |
|
91 case ELogOperationConfigGet: // no security check |
|
92 return new(ELeave) CLogServOpConfigGet(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
93 aCliServData, aSessionId); |
|
94 case ELogOperationConfigChange: |
|
95 if(aMessage.HasCapability(ECapabilityWriteDeviceData)) |
|
96 { |
|
97 return new(ELeave) CLogServOpConfigChange(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
98 aCliServData, aSessionId); |
|
99 } |
|
100 break; |
|
101 case ELogOperationMaintain: // no security check |
|
102 return new(ELeave) CLogServOpMaintenance(aTaskInterface, aOperationManager, aMessage, aLogPackage, |
|
103 aCliServData, aSessionId); |
|
104 default: |
|
105 ::PanicClientL(aMessage, ELogServFactoryUnrecognizedOperationType); |
|
106 break; |
|
107 } |
|
108 |
|
109 // clients who don't have the required capability need to be informed. |
|
110 User::Leave(KErrPermissionDenied); |
|
111 return NULL; |
|
112 } |
|
113 |
|
114 CLogServOperationBase* LogServFactory::NewViewOperationL(const TLogClientServerData& aCliServData, |
|
115 MLogServTaskInterface& aTaskInterface, |
|
116 MLogServOperationManager& aOperationManager, |
|
117 const RMessage2& aMessage, |
|
118 CLogPackage& aLogPackage, |
|
119 TLogServSessionId aSessionId, |
|
120 CLogServViewBase& aView) |
|
121 { |
|
122 // The operations are all owned by the operation queue/manager as soon |
|
123 // as they are contructed (since they are all members of a queue). |
|
124 switch(aCliServData.iOperationType) |
|
125 { |
|
126 case ELogOperationViewSetup: |
|
127 return new(ELeave) CLogServOpViewSetup(aTaskInterface, aOperationManager, aMessage, aLogPackage, aView, |
|
128 aCliServData, aSessionId); |
|
129 case ELogOperationViewRemoveEvent: |
|
130 return new(ELeave) CLogServOpViewEventRemove(aTaskInterface, aOperationManager, aMessage, aLogPackage, aView, |
|
131 aCliServData, aSessionId); |
|
132 case ELogOperationViewClearDuplicates: |
|
133 return new(ELeave) CLogServOpViewClearDuplicates(aTaskInterface, aOperationManager, aMessage, aLogPackage, aView, |
|
134 aCliServData, aSessionId); |
|
135 case ELogOperationViewSetFlags: |
|
136 return new(ELeave) CLogServOpViewSetFlags(aTaskInterface, aOperationManager, aMessage, aLogPackage, aView, |
|
137 aCliServData, aSessionId); |
|
138 case ELogOperationViewWindowFetch: |
|
139 return new(ELeave) CLogServOpViewWindowFetcher(aTaskInterface, aOperationManager, aMessage, aLogPackage, aView, |
|
140 aCliServData, aSessionId); |
|
141 default: |
|
142 ::PanicClientL(aMessage, ELogServFactoryUnrecognizedOperationType2); |
|
143 break; |
|
144 } |
|
145 return NULL; |
|
146 } |
|
147 |
|
148 CLogServViewBase* LogServFactory::NewViewL(TLogViewType aType, |
|
149 TLogViewId aId, |
|
150 MLogServDatabaseTransactionInterface& aDatabase, |
|
151 MLogServBackupInterface& aBackupInterface, |
|
152 CLogPackage& aPackage, |
|
153 const RMessage2& aMessage) |
|
154 { |
|
155 switch(aType) |
|
156 { |
|
157 case ELogViewTypeEvent: |
|
158 return CLogServViewEvent::NewL(aDatabase, aBackupInterface, aPackage, aId, aMessage); |
|
159 case ELogViewTypeRecent: |
|
160 return CLogServViewRecent::NewL(aDatabase, aBackupInterface, aPackage, aId, aMessage); |
|
161 case ELogViewTypeDuplicate: |
|
162 return CLogServViewDuplicate::NewL(aDatabase, aBackupInterface, aPackage, aId, aMessage); |
|
163 default: |
|
164 ::PanicClientL(aMessage, ELogServFactoryUnrecognizedViewType); |
|
165 break; |
|
166 } |
|
167 return NULL; |
|
168 } |