it_bus_pdk/context_utils.h

00001 #ifndef _IT_CONTEXT_UTILS_H_
00002 #define _IT_CONTEXT_UTILS_H_
00003 
00004 // @Copyright (c) 2003 IONA Technologies PLC. All Rights Reserved.
00005 //
00006 
00007 #include <it_bus_pdk/context.h>
00008 
00009 #include <it_bus_pdk/context_attrs/http_conf_xsdTypes.h>
00010 #include <it_bus_pdk/context_attrs/bus_security_xsdTypes.h>
00011 #include <it_bus_pdk/context_attrs/attachment_parts_info_xsdTypes.h>
00012 #include <it_bus_pdk/context_attrs/corba_xsdTypes.h>
00013 #include <it_bus_pdk/context_attrs/i18n_context_xsdTypes.h>
00014 #include <it_bus_pdk/context_attrs/mq_xsdTypes.h>
00015 
00016 
00017 namespace IT_ContextAttributes 
00018 {
00019     class IT_CONTEXT_ATTRIBUTE_API ContextUtils
00020     {
00021       public:
00022 
00023         static void
00024         clear_qos_contexts(
00025             IT_Bus::ContextContainer* context_container
00026         );
00027         
00028         static void
00029         clear_http_server_context(
00030             serverType* http_server_context
00031         );
00032         
00033         static void
00034         clear_http_client_context(
00035             clientType* http_client_context
00036         );
00037 
00038       private:
00039 
00040         static void
00041         clear_bus_security_context(
00042             BusSecurity* bus_security_context
00043         );
00044 
00045         static void
00046         clear_i18n_server_qname_context(
00047             ServerConfiguration* i18n_server_config
00048         );
00049 
00050         static void
00051         clear_i18n_client_qname_context(
00052             ClientConfiguration* i18n_client_config
00053         );
00054 
00055         static void
00056         clear_attachment_context(
00057             SOAPAttachmentPartInfoArray* attachement_info
00058         );
00059 
00060         static void
00061         clear_corba_context(
00062             CORBAAttributesType* corba_context
00063         );
00064     };
00065 
00066     template<class T>
00067     class ContextHandler
00068     {
00069       public:
00070         ContextHandler(
00071             IT_Bus::ContextContainer* container,
00072             T& context,
00073             const IT_Bus::QName& context_qname
00074         ) : m_container(container),
00075             m_context_qname(context_qname)
00076         {
00077             if (m_container)
00078             {
00079                 m_container->add_context(m_context_qname, context);
00080             }
00081         }
00082 
00083         ~ContextHandler()
00084         {
00085             if (m_container)
00086             {
00087                 m_container->remove_context(m_context_qname);
00088             }
00089         }
00090 
00091       private:
00092         IT_Bus::ContextContainer* m_container;
00093         IT_Bus::QName m_context_qname;
00094     };
00095 }
00096 
00097 #endif 

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