|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Class derives the XML service description and further extends |
|
15 * it by adding consumer policy interface implementation. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #ifndef SEN_SERVICE_PATTERN_H |
|
27 #define SEN_SERVICE_PATTERN_H |
|
28 |
|
29 // INCLUDES |
|
30 #include <e32base.h> |
|
31 #include <s32strm.h> |
|
32 #include "senwsdescription.h" |
|
33 #include <MSenConsumerPolicy.h> |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CSenConsumerPolicy; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Class derives the WS description and further extends |
|
42 * it by implementing consumer policy interface. |
|
43 * |
|
44 * WS pattern is typically used by Basic Web Service consumers, |
|
45 * which often know, which policy to use in the communication with |
|
46 * certain Web Service Provider (WSP). |
|
47 * |
|
48 * For example, a Basic Web Service consumer application might want |
|
49 * strictly define certain Internet Access Point (IAP) to be used when |
|
50 * initializing new service connection. Such an application can simply |
|
51 * instantiate new WSPattern and set pre-known IAP ID into it. |
|
52 * |
|
53 * The main purpose of this class is to simplify the initialization |
|
54 * of service connections for Basic Web Services. |
|
55 * |
|
56 * It is important to note, that all the consumer policy information entered |
|
57 * via WSPattern extending the MSenConsumerPolicy is treated |
|
58 * in "policy-per-client" terms. In other words, any consumer |
|
59 * policy information will not be stored for latter use of other |
|
60 * applications (even they might happen to use same WSP and contract!). |
|
61 * |
|
62 * This is due the nature of Service Pattern: it acts as a consumer |
|
63 * originated filter, after which a service will be resolved. |
|
64 * |
|
65 * Any service which "meets" the Service Pattern "constraints", is |
|
66 * considered as a "match", because such service accepts this |
|
67 * (search) pattern. |
|
68 * |
|
69 * @lib SenServDesc.lib |
|
70 * @since Series60 3.0 |
|
71 */ |
|
72 class CSenWSPattern : public CSenWSDescription, public MSenConsumerPolicy |
|
73 |
|
74 { |
|
75 public: // Constructors and destructor |
|
76 |
|
77 /** |
|
78 * Standard 2 phase constructors |
|
79 */ |
|
80 IMPORT_C static CSenWSPattern* NewL(); |
|
81 |
|
82 /** |
|
83 * Standard 2 phase constructors |
|
84 */ |
|
85 IMPORT_C static CSenWSPattern* NewLC(); |
|
86 |
|
87 /** |
|
88 * Standard 2 phase constructor |
|
89 * @param aNamespaceURI namespace URI for the service pattern. |
|
90 */ |
|
91 IMPORT_C static CSenWSPattern* NewL(const TDesC8& aNamespaceURI); |
|
92 |
|
93 /** |
|
94 * Standard 2 phase constructor |
|
95 * @param aNamespaceURI namespace URI for the service pattern. |
|
96 */ |
|
97 IMPORT_C static CSenWSPattern* NewLC(const TDesC8& aNamespaceURI); |
|
98 |
|
99 /** |
|
100 * Standard 2 phase constructor. |
|
101 * @param aEndPoint service pattern endpoint. |
|
102 * @param aContract service pattern contract. |
|
103 */ |
|
104 IMPORT_C static CSenWSPattern* NewL( const TDesC8& aEndPoint, |
|
105 const TDesC8& aContract ); |
|
106 |
|
107 /** |
|
108 * Standard 2 phase constructor. |
|
109 * @param aEndPoint service pattern endpoint. |
|
110 * @param aContract service pattern contract. |
|
111 */ |
|
112 IMPORT_C static CSenWSPattern* NewLC( const TDesC8& aEndPoint, |
|
113 const TDesC8& aContract ); |
|
114 |
|
115 /** |
|
116 * Destructor. |
|
117 */ |
|
118 IMPORT_C virtual ~CSenWSPattern(); |
|
119 |
|
120 // New functions |
|
121 |
|
122 /** |
|
123 * Convenience method for writing out the consumer policy as XML |
|
124 * in UTF-8 form. |
|
125 * @since Series60 3.0 |
|
126 * @return consumer policy as UTF-8 form XML. |
|
127 */ |
|
128 IMPORT_C HBufC8* ConsumerPolicyAsXmlL(); |
|
129 |
|
130 // Functions from base classes |
|
131 |
|
132 // From CSenWSDescription |
|
133 |
|
134 /** |
|
135 * Compares that both service description and possible |
|
136 * policy inside of it matches with this instance. |
|
137 * @since Series60 3.0 |
|
138 * @param aPattern the service description to compare to |
|
139 * @return ETrue both service description and policy information |
|
140 * matches, otherwise EFalse. If some value is not set |
|
141 * in current instance, it is not compared. |
|
142 */ |
|
143 IMPORT_C TBool Matches(MSenServiceDescription& aWSPattern); |
|
144 |
|
145 /** |
|
146 * Callback function which implements the XML content handler interface. |
|
147 * Parses the consumer policies independently. |
|
148 * @since Series60 3.0 |
|
149 * @param aNsUri The namespace URI of the new element |
|
150 * @param aLocalName The local name of the new element |
|
151 * @param aQName The qualified name of the new element |
|
152 * @param aAttributes The attributes of the new element |
|
153 */ |
|
154 IMPORT_C void StartElementL(const TDesC8& aNsUri, |
|
155 const TDesC8& aLocalName, |
|
156 const TDesC8& aQName, |
|
157 const RAttributeArray& aAttributes); |
|
158 |
|
159 // From MSenConsumerPolicy |
|
160 IMPORT_C virtual void SetConsumerIapIdL(TUint32 aIapId); |
|
161 IMPORT_C virtual TInt ConsumerIapId(TUint32& aCurrentIapId); |
|
162 IMPORT_C virtual void SetConsumerIdentityProviderIdsL( |
|
163 CSenIdentityProviderIdArray8& aList); |
|
164 |
|
165 IMPORT_C virtual TInt AddConsumerIdentityProviderIdL( |
|
166 const TDesC8& aProviderId); |
|
167 |
|
168 IMPORT_C virtual const CSenIdentityProviderIdArray8& |
|
169 ConsumerIdentityProviderIds8L(); |
|
170 |
|
171 IMPORT_C virtual TBool AcceptsConsumerPolicy( |
|
172 MSenConsumerPolicy& aPolicyPattern); |
|
173 |
|
174 IMPORT_C virtual TInt RebuildFromConsumerPolicy( |
|
175 MSenConsumerPolicy& aTemplate); |
|
176 |
|
177 IMPORT_C virtual TBool HasSuperClass( TDescriptionClassType aType ); |
|
178 |
|
179 protected: // New functions |
|
180 |
|
181 /** |
|
182 * C++ constructor. |
|
183 * @since Series60 3.0 |
|
184 * @param aType enumeration defininng the type of this class. |
|
185 */ |
|
186 IMPORT_C CSenWSPattern( |
|
187 MSenServiceDescription::TDescriptionClassType aType); |
|
188 |
|
189 /** |
|
190 * Base constructor offered to sub class implementations. |
|
191 * @since Series60 3.0 |
|
192 */ |
|
193 IMPORT_C void BaseConstructL(); |
|
194 |
|
195 /** |
|
196 * Base constructor offered to sub class implementations. |
|
197 * @since Series60 3.0 |
|
198 * @param aNamespaceURI the localname for XML element representation |
|
199 * of this class. |
|
200 */ |
|
201 IMPORT_C void BaseConstructL(const TDesC8& aNamespaceURI); |
|
202 |
|
203 /** |
|
204 * Base constructor offered to sub class implementations. |
|
205 * @since Series60 3.0 |
|
206 * @param aEndPoint is the actual endpoint to the service |
|
207 * @param aContract of the service, typically some URI |
|
208 */ |
|
209 IMPORT_C void BaseConstructL(const TDesC8& aEndPoint, const TDesC8& aContract); |
|
210 |
|
211 public: |
|
212 /** |
|
213 * Sets the Consumer SNAP ID. |
|
214 * @param aSnapId A TUint32 consumer SNAP ID |
|
215 */ |
|
216 IMPORT_C virtual void SetConsumerSnapIdL(TUint32 aSnapId); |
|
217 /** |
|
218 * Gets the Consumer SNAP ID. |
|
219 * @param aCurrentSnapId A TUint32 reference to be filled in with the |
|
220 * value of the SNAP ID. |
|
221 * @return KErrNone if no error, or some of the system |
|
222 * wide error codes. |
|
223 */ |
|
224 IMPORT_C virtual TInt ConsumerSnapId(TUint32& aCurrentSnapId); |
|
225 |
|
226 protected: // Data |
|
227 |
|
228 // Consumer policy class instance, used as a delegate in parsing |
|
229 CSenConsumerPolicy* iConsumerPolicy; |
|
230 }; |
|
231 |
|
232 #endif SEN_SERVICE_PATTERN_H |
|
233 |
|
234 // End of File |