Go to the documentation of this file.00001
00002
00003 #include "tao/ZIOP/ZIOP_ORBInitializer.h"
00004
00005 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00006
00007 #include "tao/ZIOP/ZIOP.h"
00008 #include "tao/ZIOP/ZIOP_Stub_Factory.h"
00009 #include "tao/ZIOP/ZIOP_PolicyFactory.h"
00010 #include "tao/ZIOP/ZIOP_Service_Context_Handler.h"
00011 #include "tao/ORB_Core.h"
00012 #include "tao/PI/ORBInitInfo.h"
00013
00014 ACE_RCSID (ZIOP,
00015 ZIOP_ORBInitializer,
00016 "$Id: ZIOP_ORBInitializer.cpp 84919 2009-03-20 10:00:34Z johnnyw $")
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 TAO_ZIOP_ORBInitializer::TAO_ZIOP_ORBInitializer (TAO_ZIOP_Loader* loader) : loader_ (loader)
00021 {
00022 }
00023
00024 void
00025 TAO_ZIOP_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info)
00026 {
00027
00028
00029 TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
00030
00031 if (CORBA::is_nil (tao_info.in ()))
00032 {
00033 if (TAO_debug_level > 0)
00034 ACE_ERROR ((LM_ERROR,
00035 "(%P|%t) TAO_ZIOP_ORBInitializer::pre_init:\n"
00036 "(%P|%t) Unable to narrow "
00037 "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
00038 "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
00039
00040 throw ::CORBA::INTERNAL ();
00041 }
00042
00043 tao_info->orb_core ()->ziop_adapter (this->loader_);
00044
00045 tao_info->orb_core ()->orb_params ()->stub_factory_name ("ZIOP_Stub_Factory");
00046 ACE_Service_Config::process_directive (ace_svc_desc_TAO_ZIOP_Stub_Factory);
00047
00048 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00049
00050 TAO_ZIOP_Service_Context_Handler* h = 0;
00051 ACE_NEW (h,
00052 TAO_ZIOP_Service_Context_Handler());
00053 tao_info->orb_core ()->service_context_registry ().bind (IOP::INVOCATION_POLICIES, h);
00054 #endif
00055 }
00056
00057 void
00058 TAO_ZIOP_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
00059 {
00060 this->register_policy_factories (info);
00061 }
00062
00063 void
00064 TAO_ZIOP_ORBInitializer::register_policy_factories (
00065 PortableInterceptor::ORBInitInfo_ptr info)
00066 {
00067
00068 PortableInterceptor::PolicyFactory_ptr policy_factory_ptr;
00069 ACE_NEW_THROW_EX (policy_factory_ptr,
00070 TAO_ZIOP_PolicyFactory,
00071 CORBA::NO_MEMORY (
00072 CORBA::SystemException::_tao_minor_code (
00073 TAO::VMCID,
00074 ENOMEM),
00075 CORBA::COMPLETED_NO));
00076
00077
00078 PortableInterceptor::PolicyFactory_var policy_factory =
00079 policy_factory_ptr;
00080
00081 try
00082 {
00083 info->register_policy_factory (ZIOP::COMPRESSION_ENABLING_POLICY_ID,
00084 policy_factory.in ());
00085
00086 info->register_policy_factory (ZIOP::COMPRESSOR_ID_LEVEL_LIST_POLICY_ID,
00087 policy_factory.in ());
00088
00089 info->register_policy_factory (ZIOP::COMPRESSION_LOW_VALUE_POLICY_ID,
00090 policy_factory.in ());
00091
00092 info->register_policy_factory (ZIOP::COMPRESSION_MIN_RATIO_POLICY_ID,
00093 policy_factory.in ());
00094 }
00095 catch (const CORBA::BAD_INV_ORDER& ex)
00096 {
00097 if (ex.minor () == (CORBA::OMGVMCID | 16))
00098 {
00099
00100
00101
00102
00103 return;
00104 }
00105 throw;
00106 }
00107 catch (...)
00108 {
00109
00110 throw;
00111 }
00112 }
00113
00114 TAO_END_VERSIONED_NAMESPACE_DECL
00115
00116 #endif