|
1 /* |
|
2 * Copyright (c) 2004 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 "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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef SEN_WSI_PLUGIN_H |
|
26 #define SEN_WSI_PLUGIN_H |
|
27 |
|
28 #include <e32std.h> |
|
29 #include <flogger.h> |
|
30 #include "SenXmlUtils.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class MSenCoreServiceManager; |
|
34 class CSenBaseFragment; |
|
35 class MSenTransport; |
|
36 class CSenBasicWebServiceSession; |
|
37 |
|
38 // CONSTANTS |
|
39 |
|
40 _LIT8(KWsiFrameworkVersion, "1.0"); |
|
41 _LIT8(KWsiFrameworkXMLNS, "urn:com.nokia.Sen.wsi.config.1.0"); |
|
42 _LIT8(KWsiFrameworkCue, "com.nokia.Sen.wsi.WSIBasicFramework"); |
|
43 |
|
44 // INCLUDES |
|
45 #include "senserviceinvocationframework.h" // internal Framework\inc |
|
46 |
|
47 /** |
|
48 * Class: CSenIdWsfPlugin |
|
49 * |
|
50 * Description: An implementation of the CSIF definition. This is concrete |
|
51 * class, instance of which ECOM framework gives to ECOM clients. |
|
52 */ |
|
53 class CSenWsiPlugin : public CSIF |
|
54 { |
|
55 public: |
|
56 /** |
|
57 * Function: NewL |
|
58 * |
|
59 * Description: Create instance of concrete implementation. Note that ECOM |
|
60 * interface implementations can only have two signatures for |
|
61 * NewL: |
|
62 * - NewL without parameters (used here) |
|
63 * - NewL with TAny* pointer, which may provide some client |
|
64 * data |
|
65 * |
|
66 * Returns: Instance of this class. |
|
67 * |
|
68 * Note: The interface, which is abstract base class of this |
|
69 * implementation, also provides NewL method. Normally abstract |
|
70 * classes do not provide NewL, because they cannot create |
|
71 * instances of themselves. |
|
72 */ |
|
73 static CSenWsiPlugin* NewL(TAny* aManager); |
|
74 |
|
75 |
|
76 public: // Methods implementing CSIF ECOM interface |
|
77 // For convenience of components classes |
|
78 //RFileLogger* Log() const; |
|
79 |
|
80 /** |
|
81 * Return a system wide unique string to identify this framework |
|
82 * |
|
83 * @return TDesC8 that uniquely identifies this framework. |
|
84 */ |
|
85 virtual const TDesC8& Id(); |
|
86 |
|
87 /** |
|
88 * Try to find one or more services that match the given |
|
89 * ServiceDescription. |
|
90 * Register ServiceDescriptions for these to the owner of the framework, |
|
91 * i.e. to the ServiceManager. Return the number of ServiceDescriptions |
|
92 * that were added. |
|
93 * |
|
94 * @param aPattern - A ServiceDescriptin that should be treated as a |
|
95 * pattern |
|
96 * |
|
97 * @param |
|
98 * return (TInt) count of matching ServiceDescriptions that were added |
|
99 */ |
|
100 virtual TInt AddServiceDescriptionL( MSenServiceDescription& aPattern, |
|
101 MSenRemoteServiceConsumer& aRemoteConsumer, |
|
102 HBufC8*& aErrorMsg ); |
|
103 |
|
104 /* virtual TInt AddServiceDescriptionL( */ |
|
105 /* const TDesC8& aServiceTypeContract, */ |
|
106 /* MSenRemoteServiceConsumer& aRemoteConsumer); */ |
|
107 |
|
108 /** |
|
109 * Attempt to register the ServiceDescription to the ServiceManager that |
|
110 * owns the framework. |
|
111 * This is a callback used by the ServiceManager to give frameworks a |
|
112 * chance to replace a generic ServiceDescription into something that is |
|
113 * more specific, and more useful, to the ServiceInvocationFramework. |
|
114 * |
|
115 * @param aServiceDescription A ServiceDescription |
|
116 * |
|
117 * return TInt aError - indicates the error or KErrNone if successful |
|
118 */ |
|
119 virtual TInt RegisterServiceDescriptionL( |
|
120 MSenServiceDescription& aServiceDescription); |
|
121 |
|
122 |
|
123 /** |
|
124 * Attempt to unregister the ServiceDescription from the ServiceManager |
|
125 * that owns the framework. |
|
126 * This is a callback used by the ServiceManager. |
|
127 * |
|
128 * @param aServiceDescription A ServiceDescription |
|
129 * |
|
130 * return TInt aError - indicates the error or KErrNone if successful |
|
131 */ |
|
132 virtual TInt UnregisterServiceDescriptionL( |
|
133 MSenServiceDescription& aServiceDescription); |
|
134 |
|
135 /** |
|
136 * Create a ServiceSession based upon the given ServiceDescription. |
|
137 * The ServiceSession is expected to be "valid", i.e. ready for use |
|
138 * by a client. |
|
139 * |
|
140 * @param aServiceDescription A ServiceDescription |
|
141 * |
|
142 * @param aNewSession (CSenServiceSession) |
|
143 * |
|
144 * return TInt error or KErrNone if successful |
|
145 */ |
|
146 virtual TInt CreateServiceSessionL( MSenServiceDescription& aServiceDescription, |
|
147 MSenServiceDescription& aPattern, |
|
148 CSenServiceSession*& aNewSession, |
|
149 MSenRemoteServiceConsumer& aRemoteConsumer, |
|
150 HBufC8*& aErrorMsg ); |
|
151 |
|
152 /** |
|
153 * Return a new instance of a framework specific class that |
|
154 * implements the ServiceDesccription interface. |
|
155 * |
|
156 * @param new service description |
|
157 * (which typically derives from CSenServiceSession) |
|
158 * |
|
159 * return TInt error or KErrNone if successful |
|
160 */ |
|
161 virtual CSenWSDescription* NewServiceDescriptionL(); |
|
162 |
|
163 /** |
|
164 * Return the ServiceManager for which this instance is working. |
|
165 * This is used by the ServiceSession instances created by this framework. |
|
166 * |
|
167 * Note, in Sen, MSenCoreServiceManager IS SINGLETON(!), so all Frameworks |
|
168 * return their "owner" - that is - the only service manager in |
|
169 * Sen Framework |
|
170 * |
|
171 * @return (MSenCoreServiceManager) |
|
172 */ |
|
173 virtual MSenCoreServiceManager& Manager(); |
|
174 |
|
175 |
|
176 /** |
|
177 * Set the ServiceManager to which this instance reports. |
|
178 * The (singleton) ServiceManager calls this method when |
|
179 * it instantiates a framework. |
|
180 * |
|
181 * @param aServiceManager The singleton ServiceManager in the system. |
|
182 */ |
|
183 virtual void SetManager(MSenCoreServiceManager& aServiceManager); |
|
184 |
|
185 |
|
186 /** |
|
187 * Return an object that can do SAX based parsing of a XML fragment |
|
188 * that contains framework specific configuration information. |
|
189 * The ServiceManager asks for this BaseFragment upon startup |
|
190 * in order to give this framework a chance to read its configuration |
|
191 * information from the central ServiceManager configuration document. |
|
192 * |
|
193 * @return (CSenBaseFragment) |
|
194 */ |
|
195 virtual CSenBaseFragment& ConfigParser(); |
|
196 |
|
197 /** |
|
198 * Write the ServiceInvocationFramework configuration as XML to a HBufC8. |
|
199 * |
|
200 * This method is invoked by the ServiceManager when it saves |
|
201 * its state and/or configuration. |
|
202 * |
|
203 * Upon startup the chunk of XML that is written will be passed back to |
|
204 * the configuation parser of the framework. |
|
205 * |
|
206 * The "schema" that shall be adhered to is: |
|
207 * <pre> |
|
208 * <element name="Framework"> |
|
209 * <any/><!-- this is where implementations write additional |
|
210 * information --> |
|
211 * <attribute name="class" type="String"> |
|
212 * <!-- In Syimbian the class attribute is used as cue for the |
|
213 * ECOM Resolver --> |
|
214 * </element> |
|
215 * </pre> |
|
216 * |
|
217 * @param aTo - a HBufC8 to which the framework should write its |
|
218 * configuration |
|
219 */ |
|
220 |
|
221 virtual HBufC8* AsXmlL(); |
|
222 virtual HBufC* AsXmlUnicodeL(); |
|
223 virtual void EndElementL( const TDesC8& aNsUri, |
|
224 const TDesC8& aLocalName, |
|
225 const TDesC8& aQName); |
|
226 |
|
227 virtual TInt OnEvent(const TInt aEvent, |
|
228 TAny* /* aArgument */); |
|
229 |
|
230 virtual TAny* ExtendedInterface(); |
|
231 |
|
232 /** |
|
233 * WS-I Basic Profile SIF specifies at least following, empty |
|
234 * SOAPAction HTTP header value: |
|
235 * |
|
236 * KSenSoapActionHeaderValueEmpty == "" |
|
237 * @return KErrNone on success, system-wide error code otherwise |
|
238 */ |
|
239 virtual TInt SetTransportPropertiesL(MSenTransport& aTransport); |
|
240 |
|
241 public: // destructor |
|
242 virtual ~CSenWsiPlugin(); |
|
243 |
|
244 |
|
245 protected: |
|
246 /** |
|
247 * Function: CSenWsiPlugin |
|
248 * |
|
249 * Discussion: Perform the first phase of two phase construction |
|
250 */ |
|
251 CSenWsiPlugin(MSenCoreServiceManager& aManager); |
|
252 |
|
253 /** |
|
254 * Function: ConstructL |
|
255 * |
|
256 * Discussion: Perform the second phase construction of a |
|
257 * CImplementationClassPlus object. |
|
258 */ |
|
259 void ConstructL(); |
|
260 |
|
261 private: // data |
|
262 MSenCoreServiceManager& iManager; |
|
263 }; |
|
264 |
|
265 |
|
266 #endif // SEN_WSI_PLUGIN_H |
|
267 |