|
1 /* |
|
2 * Copyright (c) 2002-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 "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 M_SEN_MESSAGE_CONTEXT_H |
|
26 #define M_SEN_MESSAGE_CONTEXT_H |
|
27 |
|
28 // INCLUDES |
|
29 #include <e32std.h> |
|
30 #include <e32std.h> |
|
31 #include "msencontext.h" |
|
32 #include "MSenProperties.h" |
|
33 #include "MSenMessage.h" |
|
34 |
|
35 |
|
36 // CONSTANTS |
|
37 namespace SenContext |
|
38 { |
|
39 _LIT8(KSenCurrentSoapMessageCtxKey, "urn:com.nokia.serene:message:soap:current"); |
|
40 _LIT8(KRemoteConsumer, "RemoteConsumer"); |
|
41 } |
|
42 |
|
43 /** |
|
44 * This is the message context interface, which is visible to CSenMessageHandler ECOM plug-in implementations. |
|
45 */ |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 class CSenSoapEnvelope; |
|
49 class CSenSoapMessage; |
|
50 class CSenChunk; |
|
51 |
|
52 // CLASS DECLARATION |
|
53 class MSenMessageContext : public MSenContext |
|
54 { |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Getter for the current message held by this message context. |
|
59 * @return pointer to MSenMessage, or NULL if message is not |
|
60 * within this context at the moment. |
|
61 */ |
|
62 virtual MSenMessage* MessageL() = 0; //codescannerwarnigns |
|
63 |
|
64 /** |
|
65 * Sets the current message for this context, potentially freeing |
|
66 * currently owned message (de-alloc) if such exists. |
|
67 * @param apMessage provides pointer to new message. Note that |
|
68 * by default the ownership *is* passed to this context. |
|
69 * @return status code: |
|
70 * KErrArgument if argument is NULL. |
|
71 * KErrNone on success. |
|
72 */ |
|
73 virtual TInt SetMessage(MSenMessage* apMessage, TBool aOwned = ETrue) = 0; |
|
74 |
|
75 |
|
76 /** |
|
77 * Getter for chunk which representates of the main message, |
|
78 * held by this message context. |
|
79 * @return pointer to CSenChunk, or NULL if message is not |
|
80 * within this context at the moment. |
|
81 */ |
|
82 virtual CSenChunk* ChunkL() = 0; //codescannerwarnings |
|
83 |
|
84 |
|
85 /** |
|
86 * Sets the current message (as chunk) for this context, potentially freeing |
|
87 * currently owned message (de-alloc) if such exists. |
|
88 * @param apMsgAsChunk provides pointer to chunk. Note that |
|
89 * by default the ownership *is* passed to this context. |
|
90 * @return status code: |
|
91 * KErrArgument if argument is NULL. |
|
92 * KErrNone on success. |
|
93 */ |
|
94 virtual TInt SetChunk(CSenChunk* apMsgAsChunk, TBool aOwned = ETrue) = 0; |
|
95 |
|
96 /* |
|
97 * Setter for message specific (transport) properties |
|
98 * @param apProperties is the pointer to properties. |
|
99 * Note that by default the ownership *is* passed to this context. |
|
100 * @return status code: |
|
101 * KErrArgument if argument is NULL. |
|
102 * KErrNone on success. |
|
103 */ |
|
104 virtual TInt SetProperties(MSenProperties* apProperties, TBool aOwned = ETrue) = 0; |
|
105 |
|
106 /* |
|
107 * Getter for message specific (transport) properties |
|
108 * @return transport properites as MSenProperties pointer, or NULL |
|
109 * if properties object does not exist. |
|
110 */ |
|
111 virtual MSenProperties* Properties() = 0; |
|
112 |
|
113 |
|
114 virtual TInt Add(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue) = 0; |
|
115 virtual TInt Update(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue) = 0; |
|
116 virtual MSenMessage* GetMessageL(const TDesC8& aKey) = 0; //codescannerwarnings |
|
117 |
|
118 |
|
119 // --- |
|
120 |
|
121 // Old, deprecated methods |
|
122 |
|
123 /* |
|
124 * Method returns "current" CSenSoapMessage*. |
|
125 * @return value, or NULL, if not found. |
|
126 * Ownership is not transferred, but remains to be held by this context. |
|
127 * Caller is supposed to know the type (class) of returned value from |
|
128 * the pre-defined binding to certain key. |
|
129 * @deprecated: use Message() getter instead! |
|
130 */ |
|
131 virtual CSenSoapMessage* GetCurrentSoapMessage() = 0; // DEPRECATED: remove this method; replace with MSenMessage variant |
|
132 |
|
133 |
|
134 |
|
135 /* |
|
136 * Method returns original message serialized into UCS8 by |
|
137 * service consumer (msg=request), or service (msg=response), |
|
138 * depending direction of this context. |
|
139 * @return serialized message (outgoing one from |
|
140 * service consumer, or incoming, original response |
|
141 * which transport has received from (remote) service. |
|
142 * - or KNullDesC8, if not set. |
|
143 * Ownership is NOT transferred, but remains to be held by this context. |
|
144 * Caller is supposed to know the type (class) of returned |
|
145 * value from the pre-defined binding to certain key. |
|
146 */ |
|
147 virtual TPtrC8 GetMessageL() = 0; // DEPRECATED: keep but rename this method |
|
148 |
|
149 /* |
|
150 * Adds new CSenSoapEnvelope* type value into context, identified by given key. |
|
151 * @param aKey identifies new value |
|
152 * @param aValue is the value being added. Ownership is transferred |
|
153 * to this context. |
|
154 * @return KErrNone on success, |
|
155 * KErrAlreadyExists, if the key is reserved, |
|
156 * or some other system-wide error code. |
|
157 */ |
|
158 virtual TInt Add(const TDesC8& aKey, CSenSoapEnvelope* aValue) = 0; // DEPRECATED: remove this method; replace with MSenMessage variant |
|
159 |
|
160 /* |
|
161 * Updates new CSenSoapEnvelope* type value into context, identified by given key. |
|
162 * If some value for the same key already exists, it is destroyed and replaced |
|
163 * by the new value. |
|
164 * @param aKey identifies new value |
|
165 * @param aValue is the updated value, which may replace |
|
166 * any existing value, which used same key. |
|
167 * Ownership is transferred to this context. |
|
168 * @return KErrNone on success, |
|
169 * or some other system-wide error code. |
|
170 */ |
|
171 virtual TInt Update(const TDesC8& aKey, CSenSoapEnvelope* aValue) = 0; // DEPRECATED: remove this method; replace with MSenMessage variant |
|
172 |
|
173 /* |
|
174 * Method returns CSenSoapEnvelope* type value. |
|
175 * |
|
176 * @param aKey identifies SOAP envelope object |
|
177 * |
|
178 * @return value behind given key, or NULL, if not found. |
|
179 * Ownership is NOT transferred, but remains to be held by |
|
180 * this context. |
|
181 * Method leaves with KErrSenTypeMismatch error code, |
|
182 * if value at this index is not CSenSoapEnvelope* type. |
|
183 */ |
|
184 virtual const CSenSoapEnvelope* GetSenSoapEnvelopeL(const TDesC8& aKey) = 0; // DEPRECATED: remove this method; replace with MSenMessage variant |
|
185 }; |
|
186 |
|
187 #endif // M_SEN_MESSAGE_CONTEXT_H |
|
188 |
|
189 // End of File |