1 msenmessage.h |
1 /* |
|
2 * Copyright (c) 2006 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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is the superclass interface for wider set of |
|
15 * concrete WSF message classes. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 #ifndef M_SEN_MESSAGE_H |
|
28 #define M_SEN_MESSAGE_H |
|
29 |
|
30 #include <e32std.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSenElement; |
|
34 class CSenXmlReader; |
|
35 |
|
36 //using namespace SenContext; |
|
37 |
|
38 // CONSTANTS |
|
39 //namespace SenContext // consider whether or not to declare new SenMessage c++ namespace |
|
40 // { |
|
41 // // Message class type enumeration for class casting: |
|
42 // } |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class MSenMessageContext; |
|
46 class MSenProperties; |
|
47 |
|
48 // CLASS DECLARATION |
|
49 /** |
|
50 * This is abstract interface defines set of WSF message classes, providing |
|
51 * convenience for other components, which typically cast this to some |
|
52 * subclass via IsSafeToCast() method. |
|
53 * @lib SenMessages.lib |
|
54 * @since Series60 4.0 |
|
55 */ |
|
56 class MSenMessage |
|
57 { |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Class Enumeration |
|
62 */ |
|
63 enum TClass |
|
64 { |
|
65 EMessageBase = 0, |
|
66 EHttpGetMsg = 1, |
|
67 EHttpPostMsg = 2, |
|
68 EHttpPutMsg = 3, |
|
69 EHttpDeleteMsg = 4, |
|
70 ESoapEnvelope = 5, |
|
71 ESoapMessage = 6, |
|
72 ESoapEnvelope2 = 7, |
|
73 ESoapMessage2 = 8, |
|
74 ESoapMessageDom2 = 9, |
|
75 EAtomMessage = 10 |
|
76 }; |
|
77 /** |
|
78 * Direction Enumeration |
|
79 */ |
|
80 enum TDirection |
|
81 { |
|
82 EOutbound = 0, |
|
83 EInbound = 1 |
|
84 }; |
|
85 |
|
86 /** |
|
87 * Gets the Message Type |
|
88 */ |
|
89 virtual TClass Type() = 0; |
|
90 /** |
|
91 * Gets the Message Direction |
|
92 */ |
|
93 virtual TDirection Direction() = 0; |
|
94 |
|
95 |
|
96 /** |
|
97 * Sets message context for this message. If context already |
|
98 * exists, it is discarded and replaced by this context |
|
99 * (context reset is performed). |
|
100 * @param apNotOwnedContext is the context. |
|
101 * Ownership is NOT transferred to this message. |
|
102 * @return |
|
103 * KErrNone on success |
|
104 * KErrArgument if apOwnedContext == NULL |
|
105 * or system-wide errorcode otherwise. |
|
106 */ |
|
107 virtual TInt SetContext(MSenMessageContext* apNotOwnedContext) = 0; |
|
108 |
|
109 /** |
|
110 * Getter for message's context |
|
111 * @return message context, if this message relates to |
|
112 * (has associated with) such context, or NULL. |
|
113 */ |
|
114 virtual MSenMessageContext* Context() = 0; |
|
115 |
|
116 /** |
|
117 * Sets properties for this message. Most typical use case |
|
118 * is to set message spesific transport properties. |
|
119 * @param apOwnedProperties pointer to the properties, which |
|
120 * ownership is transferred to this class. This is performed |
|
121 * in two different manners: |
|
122 * |
|
123 * 1. If message has context, the properties are (re)set into that context, |
|
124 * discarding any pre-existing properties. |
|
125 * |
|
126 * 2. If context is NOT available, properties will be directly owned by |
|
127 * this message. |
|
128 * @return |
|
129 * KErrNone on success |
|
130 * KErrArgument if apOwnedProperties == NULL |
|
131 * or system-wide errorcode otherwise. |
|
132 */ |
|
133 virtual TInt SetProperties(MSenProperties* apOwnedProperties) = 0; |
|
134 |
|
135 /** |
|
136 * Getter for message specific (transport) properties |
|
137 * @return (transport) properties of this message, |
|
138 * if such have been applied to this message |
|
139 * or NULL otherwise. |
|
140 */ |
|
141 virtual MSenProperties* Properties() = 0; |
|
142 |
|
143 virtual TBool IsSafeToCast(TClass aType) = 0; |
|
144 /** |
|
145 * Getter for transaction ID of this message. |
|
146 * In case of receiving a response message from |
|
147 * service provider, this transaction ID may be |
|
148 * used to map the response with request that |
|
149 * the service consumer sent via service connection. |
|
150 * In such case, the consumer can store return |
|
151 * value from SendL method that was invoked in |
|
152 * order maintain this mapping. |
|
153 * @return the transaction ID of this message |
|
154 */ |
|
155 virtual TInt TxnId() = 0; |
|
156 |
|
157 /** |
|
158 * Clone method that duplicates this message |
|
159 * -- including all member data in the message. |
|
160 * For the service consumers, a typical use case |
|
161 * for cloning the message is when there is need |
|
162 * to preserve the received response beyond the |
|
163 * life time of a transaction. Normally, the |
|
164 * response messages, that are owned by service |
|
165 * connection are de-allocated after execution |
|
166 * returns from MSenServiceConsumer interface's |
|
167 * HandleMessageL or HandleErrorL method, back |
|
168 * to the service connection. |
|
169 * @return a pointer to a new message class instance, |
|
170 * which ownership IS transferred to a caller. Note |
|
171 * that caller is expected to cast this pointer to |
|
172 * a proper subclass via the use of IsSafeToCast |
|
173 * method. In case of responses, the message type |
|
174 * is normally equal with the type of the request |
|
175 * message that was sent by the consumer. |
|
176 */ |
|
177 virtual MSenMessage* CloneL() = 0; |
|
178 }; |
|
179 |
|
180 #endif // M_SEN_MESSAGE_H |
|
181 |
|
182 // End of File |
|
183 |
|
184 |