Go to the documentation of this file.00001 
00002 
00003 #include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
00004 #include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
00005 #include "tao/BiDir_GIOP/BiDirGIOP.h"
00006 #include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h"
00007 #include "tao/PI/ORBInitInfo.h"
00008 
00009 #include "tao/ORB_Constants.h"
00010 #include "tao/ORB_Core.h"
00011 
00012 #include "ace/CORBA_macros.h"
00013 
00014 ACE_RCSID (BiDir_GIOP,
00015            BiDir_ORBInitializer,
00016            "$Id: BiDir_ORBInitializer.cpp 80861 2008-03-07 13:48:34Z johnnyw $")
00017 
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 void
00021 TAO_BiDir_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info)
00022 {
00023   
00024   
00025   TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
00026 
00027   if (CORBA::is_nil (tao_info.in ()))
00028     {
00029       if (TAO_debug_level > 0)
00030         ACE_ERROR ((LM_ERROR,
00031                     "(%P|%t) TAO_Bidir_ORBInitializer::pre_init:\n"
00032                     "(%P|%t)    Unable to narrow "
00033                     "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
00034                     "(%P|%t)   \"TAO_ORBInitInfo *.\"\n"));
00035 
00036       throw ::CORBA::INTERNAL ();
00037     }
00038 
00039   
00040   TAO_BiDIR_Service_Context_Handler* h = 0;
00041   ACE_NEW (h,
00042            TAO_BiDIR_Service_Context_Handler());
00043   tao_info->orb_core ()->service_context_registry ().bind (IOP::BI_DIR_IIOP, h);
00044 }
00045 
00046 void
00047 TAO_BiDir_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
00048 {
00049   this->register_policy_factories (info);
00050 }
00051 
00052 void
00053 TAO_BiDir_ORBInitializer::register_policy_factories (
00054   PortableInterceptor::ORBInitInfo_ptr info)
00055 {
00056 
00057   PortableInterceptor::PolicyFactory_ptr temp_factory =
00058     PortableInterceptor::PolicyFactory_ptr ();
00059 
00060   ACE_NEW_THROW_EX (temp_factory,
00061                     TAO_BiDir_PolicyFactory,
00062                     CORBA::NO_MEMORY (
00063                       CORBA::SystemException::_tao_minor_code (
00064                          TAO::VMCID,
00065                          ENOMEM),
00066                       CORBA::COMPLETED_NO));
00067 
00068   PortableInterceptor::PolicyFactory_var policy_factory = temp_factory;
00069 
00070 
00071 
00072 
00073   info->register_policy_factory (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
00074                                  policy_factory.in ());
00075 }
00076 
00077 TAO_END_VERSIONED_NAMESPACE_DECL