it_bus/operation.h

00001 #ifndef _IT_BUS_OPERATION_H_
00002 #define _IT_BUS_OPERATION_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <it_bus/api_defines.h>
00008 #include <it_bus/readable_message.h>
00009 #include <it_bus/writable_message.h>
00010 
00011 #ifndef IT_MINIMISE_INCLUDES
00012 #include <it_bus/port.h>
00013 #include <it_wsdl/wsdl_port.h>
00014 #include <it_wsdl/wsdl_operation.h>
00015 #include <it_bus_pdk/interceptor.h>
00016 #endif
00017 
00018 namespace IT_WSDL
00019 {
00020     class WSDLPort;
00021     class WSDLOperation;
00022 }
00023 namespace IT_Bus
00024 {
00025     class QName;
00026     class Port;
00027     class Operation;
00028     class MessageAttributes;
00029     class MessageAttributesHolder;
00030     class ContextContainer;
00031     class ClientOperationPassThrough;
00032     class ServerOperationPassThrough;
00033 
00034     namespace Logging
00035     {
00036         class ServiceNameRetriever;
00037     }
00038 
00039     typedef QNameHashMap<MessageAttributesHolder *> MessageAttributesMap;
00040 
00041     class IT_BUS_API MessageAttributesHolder
00042     {
00043     public:
00044         MessageAttributesHolder(
00045             Operation&         operation,
00046             const QName&       name,
00047             MessageAttributes* data,
00048             IT_Bool            take_ownership = true
00049         );
00050 
00051         ~MessageAttributesHolder();
00052 
00053         void create_reference();
00054         void release_reference();
00055 
00056         MessageAttributes&
00057         get_data();
00058 
00059         const MessageAttributes&
00060         get_data() const;
00061 
00062     private:
00063         MessageAttributesHolder();
00064 
00065         IT_Bool                 m_take_ownership;
00066         IT_ULong                m_ref_count;
00067         MessageAttributes*      m_data;
00068         const QName&            m_name;
00069         Operation&              m_operation;
00070     };
00071 
00075     class IT_BUS_API Operation
00076     {
00077     friend class MessageAttributesHolder;
00078 
00079     public:
00087         Operation(
00088             Port& port,
00089             const IT_WSDL::WSDLPort& wsdl_port
00090         );
00091         
00095         virtual
00096         ~Operation();
00097 
00107         virtual Port&
00108         get_port();
00109 
00116         virtual const IT_WSDL::WSDLPort&
00117         get_wsdl_port() const;
00118 
00119         Logging::ServiceNameRetriever*
00120         get_snr();
00121 
00122       protected:
00123         Port&                           m_port;
00124         const IT_WSDL::WSDLPort&        m_wsdl_port;        
00125         Operation*                      m_source_operation;
00126         Logging::ServiceNameRetriever* m_snr;
00127     };
00128 
00156     class IT_BUS_API ClientOperation : public Operation
00157     {
00158       friend class PDKClientService; 
00159 
00160       public:
00161 
00165         virtual 
00166         ~ClientOperation();
00167 
00174         virtual const IT_WSDL::WSDLOperation&
00175         get_wsdl_operation() const;
00176 
00182         virtual const String &
00183         get_name() const;
00184 
00191         virtual WritableMessage & 
00192         get_input_message() = 0;
00193         
00200         virtual ReadableMessage & 
00201         get_output_message() = 0;
00202 
00209         virtual ContextContainer*
00210         request_contexts() = 0;
00211 
00218         virtual ContextContainer*
00219         reply_contexts() = 0;
00220 
00225         virtual void
00226         invoke(
00227         ) throw((Exception));  
00228 
00229 
00237         virtual ClientOperationPassThrough*
00238         get_client_pass_through() = 0;
00239 
00240       protected:
00241         ClientOperation(
00242             Port&                         port,
00243             const IT_WSDL::WSDLPort&      wsdl_port,
00244             const IT_WSDL::WSDLOperation& wsdl_operation
00245         );
00246 
00247         virtual void
00248         do_invoke(
00249         ) throw((Exception)) = 0;  
00250 
00251       private:
00252 
00253         const IT_WSDL::WSDLOperation& m_wsdl_operation;
00254                      
00255         ClientOperation & 
00256         operator =(
00257             const ClientOperation& rhs
00258         );
00259         
00260         ClientOperation(
00261             const ClientOperation& rhs
00262         );
00263     };
00264 
00266     typedef unsigned long CorrelationId;
00267 
00284     class IT_BUS_API ServerOperation : public Operation
00285     {
00286       public:
00287         
00288         virtual 
00292         ~ServerOperation();
00293 
00300         virtual const IT_WSDL::WSDLOperation&
00301         get_wsdl_operation() const;
00302 
00308         virtual const String &
00309         get_name() const;
00310 
00317         virtual ReadableMessage & 
00318         get_input_message() = 0;
00319         
00326         virtual WritableMessage & 
00327         get_output_message() = 0;
00328 
00335         virtual ContextContainer*
00336         request_contexts() = 0;
00337 
00344         virtual ContextContainer*
00345         reply_contexts() = 0;
00346 
00351         virtual void
00352         read() = 0;
00353 
00358         virtual void
00359         write() = 0;
00360 
00369         virtual void
00370         exception_occured();
00371 
00377         virtual CorrelationId
00378         get_correlation_id() const = 0;
00379 
00387         virtual ServerOperationPassThrough*
00388         get_server_pass_through() = 0;
00389 
00390       protected:
00391         ServerOperation(
00392             Port&                         port,
00393             const IT_WSDL::WSDLPort&      wsdl_port,
00394             const IT_WSDL::WSDLOperation& wsdl_operation
00395         );
00396 
00397       private:
00398         const IT_WSDL::WSDLOperation& m_wsdl_operation;
00399         
00400         ServerOperation & 
00401         operator = (
00402             const ServerOperation& rhs
00403         );
00404         
00405         ServerOperation(
00406             const ServerOperation& rhs
00407         );
00408     };
00409 }
00410 
00411 #endif  

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