00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IT_WS_ADDRESSING_CONTEXT_SUPPORT_
00009 #define IT_WS_ADDRESSING_CONTEXT_SUPPORT_
00010
00011 #ifndef IT_MINIMISE_INCLUDES
00012 #include <it_bus/bus.h>
00013 #endif
00014
00015 #include <it_bus/wsaddressing_xsdTypes.h>
00016 #include <it_bus_pdk/context_attrs/wsaddressing_xsdTypesFactory.h>
00017 #include <it_bus/bus_type_alias.h>
00018 #include <it_bus/api_defines.h>
00019
00020 namespace IT_WSAddressing
00021 {
00022 enum MessageDirection {Request, Response};
00023
00024 class IT_CONTEXT_ATTRIBUTE_API ContextSupport
00025 {
00026
00027 public:
00028 ContextSupport(
00029 IT_Bus::Bus_ptr bus
00030 );
00031
00032 ~ContextSupport();
00033
00034 const IT_Bus::QName& messageid_name();
00035 const IT_Bus::QName& relatesto_name();
00036 const IT_Bus::QName& to_name();
00037 const IT_Bus::QName& action_name();
00038 const IT_Bus::QName& from_name();
00039 const IT_Bus::QName& replyto_name();
00040 const IT_Bus::QName& faultto_name();
00041 const IT_Bus::QName& reference_parameters_name();
00042
00043 void
00044 set_message_id_header(
00045 MessageDirection direction,
00046 const WS_Addressing::AttributedURIType & message_id
00047 );
00048 WS_Addressing::AttributedURIType*
00049 get_message_id_header(
00050 MessageDirection direction,
00051 bool remove_from_context=false
00052 );
00053
00054 void
00055 set_message_id_header(
00056 IT_Bus::ContextContainer* container,
00057 const WS_Addressing::AttributedURIType & message_id
00058 );
00059 WS_Addressing::AttributedURIType*
00060 get_message_id_header(
00061 IT_Bus::ContextContainer* container,
00062 bool remove_from_context=false
00063 );
00064
00065 void
00066 set_relates_to_header(
00067 MessageDirection direction,
00068 const WS_Addressing::RelatesToType & relates_to
00069 );
00070 WS_Addressing::RelatesToType*
00071 get_relates_to_header(
00072 MessageDirection direction,
00073 bool remove_from_context=false
00074 );
00075
00076 void
00077 set_relates_to_header(
00078 IT_Bus::ContextContainer* container,
00079 const WS_Addressing::RelatesToType & relates_to
00080 );
00081 WS_Addressing::RelatesToType*
00082 get_relates_to_header(
00083 IT_Bus::ContextContainer* container,
00084 bool remove_from_context=false
00085 );
00086
00087 void
00088 set_to_header(
00089 MessageDirection direction,
00090 const WS_Addressing::AttributedURIType & to
00091 );
00092 WS_Addressing::AttributedURIType*
00093 get_to_header(
00094 MessageDirection direction,
00095 bool remove_from_context=false
00096 );
00097
00098 void
00099 set_to_header(
00100 IT_Bus::ContextContainer* container,
00101 const WS_Addressing::AttributedURIType& to
00102 );
00103
00104 WS_Addressing::AttributedURIType*
00105 get_to_header(
00106 IT_Bus::ContextContainer* container,
00107 bool remove_from_context=false
00108 );
00109
00110 void
00111 set_action_header(
00112 MessageDirection direction,
00113 const WS_Addressing::AttributedURIType & action
00114 );
00115 WS_Addressing::AttributedURIType*
00116 get_action_header(
00117 MessageDirection direction,
00118 bool remove_from_context=false
00119 );
00120
00121 void
00122 set_action_header(
00123 IT_Bus::ContextContainer* container,
00124 const WS_Addressing::AttributedURIType& action
00125 );
00126
00127 WS_Addressing::AttributedURIType*
00128 get_action_header(
00129 IT_Bus::ContextContainer* container,
00130 bool remove_from_context=false
00131 );
00132
00133 void
00134 set_from_header(
00135 MessageDirection direction,
00136 const WS_Addressing::EndpointReferenceType & from
00137 );
00138
00139 WS_Addressing::EndpointReferenceType*
00140 get_from_header(
00141 MessageDirection direction,
00142 bool remove_from_context=false
00143 );
00144
00145 void
00146 set_from_header(
00147 IT_Bus::ContextContainer* container,
00148 const WS_Addressing::EndpointReferenceType& from
00149 );
00150 WS_Addressing::EndpointReferenceType*
00151 get_from_header(
00152 IT_Bus::ContextContainer* container,
00153 bool remove_from_context=false
00154 );
00155
00156 void
00157 set_reply_to_header(
00158 MessageDirection direction,
00159 const WS_Addressing::EndpointReferenceType & reply_to
00160 );
00161
00162 WS_Addressing::EndpointReferenceType*
00163 get_reply_to_header(
00164 MessageDirection direction,
00165 bool remove_from_context=false
00166 );
00167
00168 void
00169 set_reply_to_header(
00170 IT_Bus::ContextContainer* container,
00171 const WS_Addressing::EndpointReferenceType& reply_to
00172 );
00173
00174 WS_Addressing::EndpointReferenceType*
00175 get_reply_to_header(
00176 IT_Bus::ContextContainer* container,
00177 bool remove_from_context=false
00178 );
00179
00180 void
00181 set_fault_to_header(
00182 MessageDirection direction,
00183 const WS_Addressing::EndpointReferenceType & fault_to
00184 );
00185
00186 WS_Addressing::EndpointReferenceType*
00187 get_fault_to_header(
00188 MessageDirection direction,
00189 bool remove_from_context=false
00190 );
00191
00192 void
00193 set_fault_to_header(
00194 IT_Bus::ContextContainer* container,
00195 const WS_Addressing::EndpointReferenceType& fault_to
00196 );
00197
00198 WS_Addressing::EndpointReferenceType*
00199 get_fault_to_header(
00200 IT_Bus::ContextContainer* container,
00201 bool remove_from_context=false
00202 );
00203
00204 void
00205 set_reference_parameters_header(
00206 MessageDirection direction,
00207 const WS_Addressing::ReferenceParametersType& ref_props
00208 );
00209
00210 void
00211 set_reference_parameters_header(
00212 IT_Bus::ContextContainer* container,
00213 const WS_Addressing::ReferenceParametersType& ref_props
00214 );
00215
00216 WS_Addressing::ReferenceParametersType*
00217 get_reference_parameters_header(
00218 IT_Bus::ContextContainer* container,
00219 bool remove_from_context=false
00220 );
00221
00222 WS_Addressing::ReferenceParametersType*
00223 get_reference_parameters_header(
00224 MessageDirection direction,
00225 bool remove_from_context=false
00226 );
00227
00228 void
00229 clear_header_contexts(
00230 MessageDirection direction
00231 );
00232
00233 void
00234 clear_header(
00235 MessageDirection direction,
00236 const IT_Bus::QName & header_id
00237 );
00238
00239 void
00240 clear_header(
00241 IT_Bus::ContextContainer* container,
00242 const IT_Bus::QName& header_id
00243 );
00244
00245
00246 void
00247 populate_call_contexts(
00248 const WS_Addressing::AttributedURIType & action,
00249 const WS_Addressing::EndpointReferenceType * to_address,
00250 const WS_Addressing::EndpointReferenceType * from_address,
00251 const WS_Addressing::EndpointReferenceType * reply_to_address,
00252 const WS_Addressing::RelatesToType * relates_to
00253 );
00254
00255 void
00256 clear_call_contexts();
00257
00258 void
00259 set_client_reply_timeout(
00260 IT_Bus::Int & timeout
00261 );
00262
00263 void
00264 set_client_request_timeout(
00265 IT_Bus::Int & timeout
00266 );
00267
00268 IT_Bus::ContextContainer*
00269 context_container(
00270 MessageDirection direction
00271 );
00272
00273 IT_Bus::ContextRegistry*
00274 context_registry();
00275
00276 static const IT_Bus::String WS_AddressingNamespace_ID;
00277 static const IT_Bus::String IT_WSAddressingNamespace_ID;
00278
00279 protected:
00280 void resolve_services();
00281 void register_header_factories();
00282
00283 IT_Bus::String
00284 make_message_id(
00285 const void* ref_object
00286 );
00287
00288 void
00289 populate_epr_ref_params_as_headers(
00290 const WS_Addressing::EndpointReferenceType& epr,
00291 MessageDirection direction = IT_WSAddressing::Request,
00292 IT_Bus::ContextContainer* context_container = 0
00293 );
00294
00295 private:
00296 IT_Bus::Bus_ptr m_bus;
00297 IT_Bus::ContextRegistry* m_context_registry;
00298
00299 IT_Bus::QName m_messageid_name;
00300 IT_Bus::QName m_messageid_message_name;
00301 IT_Bus::QName m_relatesto_name;
00302 IT_Bus::QName m_relatesto_message_name;
00303 IT_Bus::QName m_to_name;
00304 IT_Bus::QName m_to_message_name;
00305 IT_Bus::QName m_action_name;
00306 IT_Bus::QName m_action_message_name;
00307 IT_Bus::QName m_from_name;
00308 IT_Bus::QName m_from_message_name;
00309 IT_Bus::QName m_replyto_name;
00310 IT_Bus::QName m_replyto_message_name;
00311 IT_Bus::QName m_faultto_name;
00312 IT_Bus::QName m_faultto_message_name;
00313 IT_Bus::QName m_reference_parameters_name;
00314 IT_Bus::QName m_reference_paramters_message_name;
00315 };
00316
00317 inline IT_Bus::ContextRegistry*
00318 ContextSupport::context_registry()
00319 {
00320 return m_context_registry;
00321 }
00322
00323 inline const IT_Bus::QName&
00324 ContextSupport::messageid_name()
00325 {
00326 return m_messageid_name;
00327 }
00328
00329 inline const IT_Bus::QName&
00330 ContextSupport::relatesto_name()
00331 {
00332 return m_relatesto_name;
00333 }
00334
00335 inline const IT_Bus::QName&
00336 ContextSupport::to_name()
00337 {
00338 return m_to_name;
00339 }
00340
00341 inline const IT_Bus::QName&
00342 ContextSupport::action_name()
00343 {
00344 return m_action_name;
00345 }
00346
00347 inline const IT_Bus::QName&
00348 ContextSupport::from_name()
00349 {
00350 return m_from_name;
00351 }
00352
00353 inline const IT_Bus::QName&
00354 ContextSupport::replyto_name()
00355 {
00356 return m_replyto_name;
00357 }
00358
00359 inline const IT_Bus::QName&
00360 ContextSupport::faultto_name()
00361 {
00362 return m_faultto_name;
00363 }
00364
00365 inline const IT_Bus::QName&
00366 ContextSupport::reference_parameters_name()
00367 {
00368 return m_reference_parameters_name;
00369 }
00370 }
00371
00372 #endif
00373
00374