it_bus_pdk/messaging_server_operation.h

00001 #ifndef _IT_BUS_PDK_MESSAGING_OP_HANDLER_H_
00002 #define _IT_BUS_PDK_MESSAGING_OP_HANDLER_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <it_bus/api_defines.h>
00008 #include <it_bus/message_writer.h>
00009 #include <it_bus/message_reader.h>
00010 #include <it_bus/operation.h>
00011 #include <it_bus_pdk/transport_readable_message.h>
00012 #include <it_bus_pdk/transport_writable_message.h>
00013 #include <it_bus_pdk/messaging_port.h>
00014 #include <it_bus_pdk/pass_thru_operation.h>
00015 
00016 namespace IT_Bus
00017 {
00018     class BusContextRegistry;
00019     class Endpoint;
00020     class SendMessageContext;
00021     class DispatchInfo;
00022 
00023     class IT_BUS_API MessagingServerOperation : public ServerOperation, public ServerOperationPassThrough
00024     {
00025       public:
00034         MessagingServerOperation(
00035             MessageReader & message_reader,
00036             MessageWriter*  message_writer,
00037             const IT_WSDL::WSDLPort & wsdl_port,
00038             const IT_WSDL::WSDLOperation& wsdl_operation,
00039             MessagingPort & messaging_port,
00040             BusContextRegistry& context_registry,
00041             ContextContainer* request_contexts,
00042             ContextContainer* reply_contexts
00043         );
00044 
00045         virtual 
00046         ~MessagingServerOperation();
00047 
00048         virtual ReadableMessage & 
00049         get_input_message();
00050         
00051         virtual WritableMessage & 
00052         get_output_message();
00053 
00054         virtual TransportReadableMessage & 
00055         get_transport_input_message();
00056         
00057         virtual TransportWritableMessage & 
00058         get_transport_output_message();
00059 
00060         virtual ContextContainer*
00061         request_contexts();
00062 
00063         virtual ContextContainer*
00064         reply_contexts();
00065 
00066         virtual void
00067         read();
00068 
00069         virtual void
00070         write();
00071 
00072         void
00073         exception_occured();
00074 
00075         virtual MessageReader*
00076         get_message_reader();
00077 
00078         virtual MessageWriter*
00079         get_message_writer();
00080 
00081         void
00082         set_contexts(
00083             ContextContainer* request_contexts,
00084             ContextContainer* reply_contexts
00085         );
00086 
00087         virtual ServerOperationPassThrough*
00088         get_server_pass_through();
00089 
00090         // The following 3 methods are implementing the ServerOperationPassThrough API
00091         BinaryBuffer*
00092         get_passthru_reply();
00093 
00094         BinaryBuffer*
00095         get_passthru_request();
00096 
00097         void
00098         enable_passthru();
00099 
00100         // The following 3 methods are needed by the MessagingPort itself for
00101         // support of passthru
00102         void
00103         set_passthru_reply(
00104             BinaryBuffer* buffer
00105         );
00106 
00107         void
00108         set_passthru_request(
00109             BinaryBuffer* buffer
00110         );
00111 
00112         bool
00113         passthru_enabled();
00114 
00115         void
00116         set_message_writer(
00117             MessageWriter*
00118         );
00119 
00120         void
00121         set_send_message_context(
00122             SendMessageContext* message_context
00123         );
00124 
00125         SendMessageContext*
00126         get_send_message_context();
00127 
00128         void
00129         set_dispatch_context(
00130             DispatchInfo* dispatch_context
00131         );
00132 
00133         DispatchInfo*
00134         get_dispatch_context();
00135 
00136         CorrelationId
00137         get_correlation_id() const;
00138 
00139         void
00140         notify_async_dispatch();
00141 
00142         void
00143         set_reply_contexts(
00144             ContextContainer* container
00145         );
00146 
00147       private:
00148         MessagingServerOperation & 
00149         operator = (
00150             const MessagingServerOperation& rhs
00151         );
00152 
00153         MessagingServerOperation(
00154             const MessagingServerOperation& rhs
00155         );
00156 
00157         void
00158         take_contexts();
00159         
00160 
00161         MessageWriter*           m_message_writer;
00162         MessageReader&           m_message_reader;
00163         TransportWritableMessage m_output_message;
00164         TransportReadableMessage m_input_message;
00165 
00166         MessagingPort&      m_messaging_port;
00167         BusContextRegistry& m_context_registry;
00168         ContextContainer*   m_request_contexts;
00169         ContextContainer*   m_reply_contexts;
00170         BinaryBuffer*       m_passthru_request_buffer;
00171         BinaryBuffer*       m_passthru_reply_buffer;
00172         bool                m_passthru_enabled;
00173         bool                m_contexts_in_tls;
00174         SendMessageContext* m_message_context;
00175         DispatchInfo*       m_dispatch_context;
00176         bool                m_async_dispatch;
00177     };
00178 
00179     inline void
00180     MessagingServerOperation::set_reply_contexts(
00181         ContextContainer* container
00182     )
00183     {
00184         assert(m_async_dispatch);
00185         assert(m_reply_contexts == 0);
00186         m_reply_contexts = container;
00187     }
00188 }
00189 
00190 #endif  

Generated on Thu Sep 7 11:39:34 2006 for Artix by  doxygen 1.4.7