00001 #ifndef _IT_BUS_PDK_MESSAGING_TRANSPORT_H_
00002 #define _IT_BUS_PDK_MESSAGING_TRANSPORT_H_
00003
00004
00005
00006
00007 #include <orbix/workqueue.hh>
00008 #include <it_bus/types.h>
00009 #include <it_bus/api_defines.h>
00010 #include <it_bus/connect_exception.h>
00011 #include <it_bus/transport_exception.h>
00012 #include <it_bus/port.h>
00013 #include <it_bus/threading_model.h>
00014 #include <it_bus/operation.h>
00015
00016 #include <it_wsdl/wsdl_factory.h>
00017 #include <it_wsdl/wsdl_port.h>
00018 #include <it_wsdl/wsdl_operation.h>
00019 #include <it_wsdl/wsdl_extension_factory.h>
00020 #include <it_wsdl/wsdl_extension_element.h>
00021
00022 namespace WS_Addressing_2004
00023 {
00024 class AttributedURI;
00025 }
00026
00027 namespace IT_Bus
00028 {
00029 enum ThreadingResourcesPolicy
00030 {
00031 MESSAGING_PORT_DRIVEN = 0,
00032 BORROWS_WORKQUEUE_SELF_DRIVEN,
00033 EXTERNALLY_DRIVEN
00034 };
00035
00036 class IT_BUS_API TransportPolicyList
00037 {
00038 public:
00039 virtual ~TransportPolicyList();
00040
00041 virtual void
00042 set_policy_threading_resources(
00043 const ThreadingResourcesPolicy policy
00044 ) = 0;
00045
00046 virtual const ThreadingResourcesPolicy
00047 get_policy_threading_resources() const = 0;
00048
00049 virtual void
00050 set_policy_messaging_port_threading(
00051 const ThreadingModel policy
00052 ) = 0;
00053
00054 virtual const ThreadingModel
00055 get_policy_messaging_port_threading() const = 0;
00056
00057 virtual void
00058 set_policy_requires_stack_unwind(
00059 const bool policy
00060 ) = 0;
00061
00062 virtual const bool
00063 get_policy_requires_stack_unwind() const = 0;
00064 };
00065
00066 class ContextContainer;
00067 class IT_BUS_API ClientTransport
00068 {
00069 public:
00070 ClientTransport() {}
00071 virtual ~ClientTransport();
00072
00073 virtual void
00074 initialize(
00075 const IT_WSDL::WSDLPort& Configuration
00076 ) = 0;
00077
00078 virtual IT_WSDL::WSDLExtensionElement&
00079 get_configuration() = 0;
00080
00081 virtual void
00082 connect(
00083 ContextContainer* out_context_container
00084 ) = 0;
00085
00086 virtual void
00087 disconnect() = 0;
00088
00089 virtual void
00090 invoke_oneway(
00091 const IT_WSDL::WSDLOperation& wsdl_operation,
00092 const BinaryBuffer& request_buffer,
00093 ContextContainer* out_container,
00094 ContextContainer* in_container
00095 ) = 0;
00096
00097 virtual void
00098 invoke(
00099 const IT_WSDL::WSDLOperation& wsdl_operation,
00100 const BinaryBuffer& request_buffer,
00101 BinaryBuffer& response_buffer,
00102 ContextContainer* out_container,
00103 ContextContainer* in_container
00104 ) = 0;
00105
00106 virtual const WS_Addressing_2004::AttributedURI&
00107 get_address();
00108 };
00109
00110 class IT_BUS_API DispatchInfo
00111 {
00112 public:
00113
00123 virtual CorrelationId
00124 get_correlation_id() const = 0;
00125
00131 virtual ContextContainer&
00132 get_incoming_context_container() = 0;
00133
00139 virtual ContextContainer&
00140 get_outgoing_context_container() = 0;
00141
00150 virtual bool
00151 is_oneway() const = 0;
00152
00159 virtual const IT_Bus::Exception*
00160 get_exception() = 0;
00161
00175 virtual void
00176 provide_response_buffer(
00177 BinaryBuffer& response_buffer
00178 ) = 0;
00179
00184 virtual bool
00185 is_transactional_transport() = 0;
00186
00187 protected:
00188 DispatchInfo() {}
00189 virtual ~DispatchInfo();
00190
00191 private:
00192
00193 DispatchInfo(const DispatchInfo&);
00194 void operator=(const DispatchInfo&);
00195 };
00196
00197 class IT_BUS_API TransportCallback
00198 {
00199 public:
00200 TransportCallback() {}
00201 virtual ~TransportCallback();
00202
00203
00204
00205
00206
00207 virtual void
00208 transport_activated() = 0;
00209
00210
00211
00212
00213 virtual void
00214 transport_deactivated() = 0;
00215
00216 virtual void
00217 transport_activation_failed(
00218 const TransportException& ex
00219 ) = 0;
00220
00221 virtual void
00222 asynchronous_exception(
00223 IT_Bus::Exception& ex
00224 ) = 0;
00225
00226
00227
00228
00229
00230 virtual void
00231 transport_shutdown_complete() = 0;
00232
00233
00234
00235
00236
00237
00238
00239 virtual DispatchInfo&
00240 get_dispatch_context() = 0;
00241
00242
00243
00244
00245
00246
00247
00248
00249 virtual void
00250 dispatch(
00251 BinaryBuffer& request_message,
00252 DispatchInfo& dispatch_context,
00253 bool dispatch_acynchronously_if_possible = 0
00254 ) = 0;
00255 };
00256
00257 class IT_BUS_API ServerTransport
00258 {
00259 public:
00260 ServerTransport() {}
00261 virtual ~ServerTransport();
00262
00263 virtual void
00264 activate(
00265 TransportCallback& callback,
00266 IT_WorkQueue::WorkQueue_ptr work_queue = 0
00267 ) = 0;
00268
00269 virtual void
00270 deactivate() = 0;
00271
00272 virtual IT_WSDL::WSDLExtensionElement&
00273 get_configuration() = 0;
00274
00275 virtual void
00276 shutdown() = 0;
00277
00278
00279
00280
00281
00282 virtual void
00283 send(
00284 BinaryBuffer& reply_message,
00285 DispatchInfo& dispatch_context
00286 ) = 0;
00287
00288 virtual void
00289 run();
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 virtual void
00305 set_multiaddress_dispatch()
00306 {
00307 }
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318 virtual void
00319 get_address_from_id(
00320 const String& ,
00321 IT_WSDL::WSDLPort&
00322 )
00323 {
00324 }
00325
00326 virtual void
00327 activate(
00328 TransportCallback& callback,
00329 IT_WorkQueue::WorkQueue_ptr work_queue,
00330 const WS_Addressing_2004::AttributedURI& listento_address
00331 );
00332
00333 virtual const WS_Addressing_2004::AttributedURI&
00334 get_address();
00335 };
00336
00337 class IT_BUS_API ClientTransactionalTransport
00338 : public ClientTransport,
00339 public TransactionInterface
00340 {
00341 };
00342
00343 class IT_BUS_API ServerTransactionalTransport
00344 : public ServerTransport,
00345 public TransactionInterface
00346 {
00347 };
00348
00349 class IT_BUS_API TransportFactory
00350 {
00351 public:
00352
00353 virtual ClientTransport*
00354 create_client_transport() = 0;
00355
00356 virtual void
00357 destroy_client_transport(
00358 ClientTransport * transport
00359 ) = 0;
00360
00361 virtual ThreadingModel
00362 get_client_threading_model() = 0;
00363
00364 virtual ServerTransport*
00365 create_server_transport(
00366 const IT_WSDL::WSDLPort& configuration
00367 ) = 0;
00368
00369 virtual void
00370 destroy_server_transport(
00371 ServerTransport* transport
00372 ) = 0;
00373
00374 virtual void
00375 register_wsdl_extension_factories(
00376 IT_WSDL::WSDLFactory & factory
00377 ) const = 0;
00378
00379 virtual void
00380 deregister_wsdl_extension_factories(
00381 IT_WSDL::WSDLFactory & factory
00382 ) const = 0;
00383
00384 virtual const TransportPolicyList*
00385 get_policies() = 0;
00386
00387 protected:
00388 TransportFactory() {}
00389 virtual ~TransportFactory();
00390
00391 private:
00392
00393 TransportFactory(const TransportFactory&);
00394 void operator=(const TransportFactory&);
00395 };
00396 }
00397
00398 #endif