PI.cpp

Go to the documentation of this file.
00001 #include "tao/PI/PI.h"
00002 #include "tao/PI/ORBInitializer_Registry_Impl.h"
00003 #include "tao/PI/PolicyFactory_Loader.h"
00004 #include "tao/PI/ClientRequestInterceptor_Factory_Impl.h"
00005 #include "tao/PI/PICurrent_Loader.h"
00006 #include "tao/PI/PI_ORBInitializer.h"
00007 #include "tao/ORBInitializer_Registry.h"
00008 #include "tao/ORB_Constants.h"
00009 #include "ace/CORBA_macros.h"
00010 
00011 ACE_RCSID (PI,
00012            PI,
00013            "$Id: PI.cpp 79958 2007-11-09 09:04:45Z johnnyw $")
00014 
00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 
00018 // This initializer is very similar to the ORBInitializer_Registry::init.
00019 // This one is used during static initialization while the other is used
00020 // when PI is a shared library.
00021 int
00022 TAO_PI_Init::Initializer (void)
00023 {
00024 #if TAO_HAS_INTERCEPTORS == 1
00025   ACE_Service_Config::process_directive (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl);
00026 
00027   ACE_Service_Config::process_directive (ace_svc_desc_TAO_PICurrent_Loader);
00028 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00029 
00030   int const status = ACE_Service_Config::process_directive (
00031                             ace_svc_desc_ORBInitializer_Registry);
00032 
00033 #if  TAO_HAS_INTERCEPTORS == 1
00034   PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
00035     PortableInterceptor::ORBInitializer::_nil ();
00036 
00037   PortableInterceptor::ORBInitializer_var orb_initializer;
00038 
00039   try
00040     {
00041       /// Register the PI ORBInitializer.
00042       ACE_NEW_THROW_EX (temp_orb_initializer,
00043                         TAO_PI_ORBInitializer,
00044                         CORBA::NO_MEMORY (
00045                           CORBA::SystemException::_tao_minor_code (
00046                             TAO::VMCID,
00047                             ENOMEM),
00048                           CORBA::COMPLETED_NO));
00049 
00050       orb_initializer = temp_orb_initializer;
00051 
00052       PortableInterceptor::register_orb_initializer (orb_initializer.in ());
00053     }
00054   catch (const ::CORBA::Exception& ex)
00055     {
00056       if (TAO_debug_level > 0)
00057         {
00058           ex._tao_print_exception ("(%P | %t) Caught exception:");
00059         }
00060       return -1;
00061     }
00062 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00063   return status;
00064 }
00065 
00066 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:42:01 2010 for TAO_PI by  doxygen 1.4.7