00001 #ifndef _IT_BUS_PDK_INTERCEPTOR_H_
00002 #define _IT_BUS_PDK_INTERCEPTOR_H_
00003
00004
00005
00006
00007 #include <it_bus/api_defines.h>
00008 #include <it_wsdl/wsdl_definitions.h>
00009 #include <it_dsa/vector.h>
00010
00011 namespace IT_Bus
00012 {
00013 class Operation;
00014 class ClientOperation;
00015 class ServerOperation;
00016
00017 class Interceptor;
00018 class InterceptorFactory;
00019 class ServerMessageInterceptorNode;
00020 class ServerRequestInterceptorNode;
00021 class ClientMessageInterceptor;
00022 class ClientRequestInterceptor;
00023
00024 class ContextContainer;
00025 class DispatchInfo;
00026
00027 typedef IT_Vector<ServerMessageInterceptorNode*> ServerMessageInterceptorChain;
00028 typedef IT_Vector<ServerRequestInterceptorNode*> ServerRequestInterceptorChain;
00029 typedef IT_Vector<ClientMessageInterceptor*> ClientMessageInterceptorChain;
00030 typedef IT_Vector<ClientRequestInterceptor*> ClientRequestInterceptorChain;
00031
00042 enum InterceptorType
00043 {
00044 CPP_INTERCEPTOR,
00045 JAVA_INTERCEPTOR
00046 };
00047
00051 class IT_BUS_API Interceptor
00052 {
00053 public:
00057 Interceptor();
00058
00064 Interceptor(
00065 InterceptorFactory* factory
00066 );
00067
00068 virtual ~Interceptor();
00069
00075 virtual InterceptorFactory*
00076 get_factory();
00077
00083 virtual InterceptorType
00084 get_type();
00085
00086 private:
00087
00088 InterceptorFactory* m_factory;
00089 };
00090
00098 class IT_BUS_API ServerMessageInterceptor : public virtual Interceptor
00099 {
00100 public:
00104 ServerMessageInterceptor();
00105
00111 ServerMessageInterceptor(
00112 InterceptorFactory* factory
00113 );
00114
00115 virtual ~ServerMessageInterceptor();
00116
00117 virtual void
00118 chain_assembled(
00119 ServerMessageInterceptorChain& chain
00120 );
00121
00122 virtual void
00123 chain_finalized(
00124 ServerMessageInterceptor* next_interceptor
00125 );
00126
00134 virtual void
00135 message_received(
00136 BinaryBuffer& in_message,
00137 DispatchInfo& dispatch_context
00138 );
00139
00147 virtual void
00148 send_message(
00149 BinaryBuffer& out_message,
00150 DispatchInfo& dispatch_context
00151 );
00152
00153 protected:
00154
00161 ServerMessageInterceptor* m_in_interceptor;
00162
00169 ServerMessageInterceptor* m_out_interceptor;
00170 };
00171
00180 class IT_BUS_API ServerRequestInterceptor : public virtual Interceptor
00181 {
00182 public:
00186 ServerRequestInterceptor();
00187
00193 ServerRequestInterceptor(
00194 InterceptorFactory* factory
00195 );
00196
00197 virtual ~ServerRequestInterceptor();
00198
00199 virtual void
00200 chain_assembled(
00201 ServerRequestInterceptorChain& chain
00202 );
00203
00204 virtual void
00205 chain_finalized(
00206 ServerRequestInterceptor* next_interceptor
00207 );
00208
00221 virtual void
00222 intercept_pre_dispatch(
00223 ServerOperation& data
00224 );
00225
00237 virtual void
00238 intercept_post_dispatch(
00239 ServerOperation& data
00240 );
00241
00258 virtual void
00259 intercept_around_dispatch(
00260 ServerOperation& data
00261 );
00262
00263 protected:
00270 ServerRequestInterceptor* m_next_interceptor;
00271
00278 ServerRequestInterceptor* m_prev_interceptor;
00279 };
00280
00288 class IT_BUS_API ClientMessageInterceptor : public virtual Interceptor
00289 {
00290 public:
00294 ClientMessageInterceptor();
00295
00301 ClientMessageInterceptor(
00302 InterceptorFactory* factory
00303 );
00304
00305 virtual ~ClientMessageInterceptor();
00306
00307 virtual void
00308 chain_assembled(
00309 ClientMessageInterceptorChain& chain
00310 );
00311
00312 virtual void
00313 chain_finalized(
00314 ClientMessageInterceptor* next_interceptor
00315 );
00316
00329 virtual void
00330 intercept_invoke(
00331 const IT_WSDL::WSDLOperation& wsdl_op,
00332 BinaryBuffer& request_buffer,
00333 BinaryBuffer& response_buffer,
00334 ContextContainer* out_container,
00335 ContextContainer* in_container
00336 );
00337
00338 protected:
00345 ClientMessageInterceptor* m_next_interceptor;
00346 };
00347
00355 class IT_BUS_API ClientRequestInterceptor : public virtual Interceptor
00356 {
00357 public:
00361 ClientRequestInterceptor();
00362
00368 ClientRequestInterceptor(
00369 InterceptorFactory* factory
00370 );
00371
00372 virtual ~ClientRequestInterceptor();
00373
00374 virtual void
00375 chain_assembled(
00376 ClientRequestInterceptorChain& chain
00377 );
00378
00379 virtual void
00380 chain_finalized(
00381 ClientRequestInterceptor* next_interceptor
00382 );
00383
00396 virtual void
00397 intercept_invoke(
00398 ClientOperation& data
00399 );
00400
00401 protected:
00408 ClientRequestInterceptor* m_next_interceptor;
00409 };
00410
00418 class IT_BUS_API InterceptorFactory
00419 {
00420 public:
00421
00427 virtual ClientMessageInterceptor *
00428 get_client_message_interceptor(
00429 const IT_WSDL::WSDLNode* const wsdl_node = 0
00430 );
00431
00437 virtual void
00438 destroy_client_message_interceptor(
00439 ClientMessageInterceptor * message_interceptor
00440 );
00441
00447 virtual ClientRequestInterceptor *
00448 get_client_request_interceptor(
00449 const IT_WSDL::WSDLNode* const wsdl_node = 0
00450 );
00451
00457 virtual void
00458 destroy_client_request_interceptor(
00459 ClientRequestInterceptor * request_interceptor
00460 );
00461
00467 virtual ServerMessageInterceptor*
00468 get_server_message_interceptor(
00469 const IT_WSDL::WSDLNode* const wsdl_node = 0
00470 );
00471
00477 virtual void
00478 destroy_server_message_interceptor(
00479 ServerMessageInterceptor* message_interceptor
00480 );
00481
00487 virtual ServerRequestInterceptor*
00488 get_server_request_interceptor(
00489 const IT_WSDL::WSDLNode* const wsdl_node = 0
00490 );
00491
00497 virtual void
00498 destroy_server_request_interceptor(
00499 ServerRequestInterceptor* request_interceptor
00500 );
00501
00508 virtual const String
00509 name() = 0;
00510
00517 virtual const String&
00518 description() const;
00519
00520 protected:
00521 InterceptorFactory();
00522
00523 virtual
00524 ~InterceptorFactory();
00525
00526 InterceptorFactory &
00527 operator = (
00528 const InterceptorFactory& rhs
00529 );
00530
00531 InterceptorFactory(
00532 const InterceptorFactory& rhs
00533 );
00534 };
00535
00536 typedef IT_Vector<InterceptorFactory*> InterceptorFactoryList;
00537 }
00538
00539 #endif