it_bus_pdk/interceptor.h

00001 #ifndef _IT_BUS_PDK_INTERCEPTOR_H_
00002 #define _IT_BUS_PDK_INTERCEPTOR_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #ifndef IT_MINIMISE_INCLUDES
00008 #include <it_wsdl/wsdl_definitions.h>
00009 #endif
00010 
00011 #include <it_bus/api_defines.h>
00012 #include <it_bus/string_map.h>
00013 #include <it_dsa/vector.h>
00014 
00015 namespace IT_WSDL
00016 {
00017     class WSDLOperation;
00018     class WSDLNode;    
00019 }
00020 namespace IT_Bus
00021 {
00022     class Operation;
00023     class ClientOperation;
00024     class ServerOperation;
00025 
00026     class Interceptor;
00027     class InterceptorFactory;
00028     class ServerMessageInterceptorNode;
00029     class ServerRequestInterceptorNode;
00030     class ClientMessageInterceptor;
00031     class ClientRequestInterceptor;
00032 
00033     class ContextContainer;
00034     class DispatchInfo;
00035     class BinaryBuffer;
00036     class String;
00037 
00038     typedef IT_Vector<ServerMessageInterceptorNode*> ServerMessageInterceptorChain;
00039     typedef IT_Vector<ServerRequestInterceptorNode*> ServerRequestInterceptorChain;
00040     typedef IT_Vector<ClientMessageInterceptor*> ClientMessageInterceptorChain;
00041     typedef IT_Vector<ClientRequestInterceptor*> ClientRequestInterceptorChain;
00042 
00053     enum InterceptorType
00054     {
00055         CPP_INTERCEPTOR,
00056         JAVA_INTERCEPTOR
00057     };
00058 
00062     class IT_BUS_API Interceptor
00063     {
00064       public:
00068         Interceptor();
00069 
00075         Interceptor(
00076             InterceptorFactory* factory
00077         );
00078         
00079         virtual ~Interceptor();
00080 
00086         virtual InterceptorFactory*
00087         get_factory();
00088 
00094         virtual InterceptorType
00095         get_type();
00096      
00097       private:      
00098 
00099         InterceptorFactory* m_factory;
00100     };
00101 
00109     class IT_BUS_API ServerMessageInterceptor : public virtual Interceptor
00110     {
00111       public:
00115         ServerMessageInterceptor();
00116 
00122         ServerMessageInterceptor(
00123             InterceptorFactory* factory
00124         );
00125         
00126         virtual ~ServerMessageInterceptor();
00127         
00128         virtual void
00129         chain_assembled(
00130             ServerMessageInterceptorChain& chain
00131         );
00132 
00133         virtual void
00134         chain_finalized(
00135             ServerMessageInterceptor* next_interceptor
00136         );
00137 
00145         virtual void
00146         message_received(
00147             BinaryBuffer& in_message,
00148             DispatchInfo& dispatch_context
00149         );
00150         
00158         virtual void
00159         send_message(
00160             BinaryBuffer& out_message,
00161             DispatchInfo& dispatch_context
00162         );
00163 
00164       protected:
00165 
00172         ServerMessageInterceptor* m_in_interceptor;
00173 
00180         ServerMessageInterceptor* m_out_interceptor;
00181     };
00182 
00191     class IT_BUS_API ServerRequestInterceptor : public virtual Interceptor
00192     {
00193       public:
00197         ServerRequestInterceptor();
00198 
00204         ServerRequestInterceptor(
00205             InterceptorFactory* factory
00206         );
00207         
00208         virtual ~ServerRequestInterceptor();
00209 
00210         virtual void
00211         chain_assembled(
00212             ServerRequestInterceptorChain& chain
00213         );
00214 
00215         virtual void
00216         chain_finalized(
00217             ServerRequestInterceptor* next_interceptor
00218         );
00219 
00232         virtual void
00233         intercept_pre_dispatch(
00234             ServerOperation& data
00235         );
00236 
00248         virtual void
00249         intercept_post_dispatch(
00250             ServerOperation& data
00251         );
00252 
00269         virtual void
00270         intercept_around_dispatch(
00271             ServerOperation& data
00272         );
00273 
00274       protected:
00281         ServerRequestInterceptor* m_next_interceptor;
00282 
00289         ServerRequestInterceptor* m_prev_interceptor;
00290     };
00291 
00299     class IT_BUS_API ClientMessageInterceptor : public virtual Interceptor
00300     {
00301       public:
00305         ClientMessageInterceptor();
00306 
00312         ClientMessageInterceptor(
00313             InterceptorFactory* factory
00314         );
00315         
00316         virtual ~ClientMessageInterceptor();
00317 
00318         virtual void
00319         chain_assembled(
00320             ClientMessageInterceptorChain& chain
00321         );
00322 
00323         virtual void
00324         chain_finalized(
00325             ClientMessageInterceptor* next_interceptor
00326         );
00327 
00340         virtual void
00341         intercept_invoke(
00342             const IT_WSDL::WSDLOperation& wsdl_op,
00343             BinaryBuffer&                 request_buffer,
00344             BinaryBuffer&                 response_buffer,
00345                         ContextContainer*             out_container,
00346                         ContextContainer*             in_container
00347         );
00348 
00349       protected:
00356         ClientMessageInterceptor* m_next_interceptor;
00357     };
00358 
00366     class IT_BUS_API ClientRequestInterceptor : public virtual Interceptor
00367     {
00368       public:
00372         ClientRequestInterceptor();
00373 
00379         ClientRequestInterceptor(
00380             InterceptorFactory* factory
00381         );
00382         
00383         virtual ~ClientRequestInterceptor();
00384 
00385         virtual void
00386         chain_assembled(
00387             ClientRequestInterceptorChain& chain
00388         );
00389 
00390         virtual void
00391         chain_finalized(
00392             ClientRequestInterceptor* next_interceptor
00393         );
00394 
00407         virtual void
00408         intercept_invoke(
00409             ClientOperation& data
00410         );
00411 
00412       protected:
00419         ClientRequestInterceptor* m_next_interceptor;
00420     };
00421 
00429     class IT_BUS_API InterceptorFactory
00430     {
00431       public:
00432 
00438         virtual ClientMessageInterceptor *
00439         get_client_message_interceptor(
00440             const IT_WSDL::WSDLNode* const wsdl_node = 0
00441         );
00442 
00448         virtual void
00449         destroy_client_message_interceptor(
00450             ClientMessageInterceptor * message_interceptor
00451         );
00452 
00458         virtual ClientRequestInterceptor *
00459         get_client_request_interceptor(
00460             const IT_WSDL::WSDLNode* const wsdl_node = 0
00461         );
00462 
00468         virtual void
00469         destroy_client_request_interceptor(
00470             ClientRequestInterceptor * request_interceptor
00471         );
00472 
00478         virtual ServerMessageInterceptor*
00479         get_server_message_interceptor(
00480             const IT_WSDL::WSDLNode* const wsdl_node = 0
00481         );
00482 
00488         virtual void
00489         destroy_server_message_interceptor(
00490             ServerMessageInterceptor* message_interceptor
00491         );
00492 
00498         virtual ServerRequestInterceptor*
00499         get_server_request_interceptor(
00500             const IT_WSDL::WSDLNode* const wsdl_node = 0
00501         );
00502 
00508         virtual void
00509         destroy_server_request_interceptor(
00510             ServerRequestInterceptor* request_interceptor
00511         );
00512 
00519         virtual const String
00520         name() = 0;
00521 
00528         virtual const String&
00529         description() const;
00530 
00531       protected:
00532         InterceptorFactory();
00533 
00534         virtual 
00535         ~InterceptorFactory();
00536 
00537         InterceptorFactory & 
00538         operator = (
00539             const InterceptorFactory& rhs
00540         );
00541 
00542         InterceptorFactory(
00543             const InterceptorFactory& rhs
00544         );
00545     };
00546 
00547     typedef IT_Vector<InterceptorFactory*> InterceptorFactoryList;
00548 }
00549 
00550 #endif  

Generated on Tue Mar 20 15:27:52 2007 for Artix by  doxygen 1.5.1-p1