00001 // $Id: Current_ORBInitializer_Base.cpp 78627 2007-06-28 08:50:01Z johnnyw $ 00002 00003 00004 #include "tao/PI/ORBInitInfo.h" 00005 #include "tao/TransportCurrent/Current_ORBInitializer_Base.h" 00006 00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00008 00009 namespace TAO 00010 { 00011 namespace Transport 00012 { 00013 00014 Current_ORBInitializer_Base::Current_ORBInitializer_Base(const ACE_TCHAR* id) 00015 : id_ (id) 00016 { 00017 // do nothing 00018 } 00019 00020 Current_ORBInitializer_Base::~Current_ORBInitializer_Base(void) 00021 { 00022 // do nothing 00023 } 00024 00025 00026 void 00027 Current_ORBInitializer_Base::pre_init ( 00028 PortableInterceptor::ORBInitInfo_ptr info) 00029 { 00030 // Narrow to a TAO_ORBInitInfo object to get access to the 00031 // allocate_tss_slot_id() TAO extension. 00032 TAO_ORBInitInfo_var tao_info = 00033 TAO_ORBInitInfo::_narrow (info); 00034 00035 if (CORBA::is_nil (tao_info.in ())) 00036 { 00037 if (TAO_debug_level > 0) 00038 ACE_ERROR ((LM_ERROR, 00039 "TAO (%P|%t) TAO::Transport::ORBInitializer::pre_init - " 00040 "Panic: unable to narrow the ORBInitInfo_ptr\n")); 00041 00042 throw ::CORBA::INTERNAL (); 00043 } 00044 00045 // Reserve a TSS slot in the ORB core internal TSS resources for the 00046 // thread-specific portion of the Current object. 00047 size_t tss_slot = tao_info->allocate_tss_slot_id (0); 00048 00049 // Create the Current 00050 Current_var current (this->make_current_instance (tao_info->orb_core (), 00051 tss_slot)); 00052 00053 info->register_initial_reference (ACE_TEXT_ALWAYS_CHAR (this->id_.fast_rep ()), 00054 current.in ()); 00055 } 00056 00057 void 00058 Current_ORBInitializer_Base::post_init ( 00059 PortableInterceptor::ORBInitInfo_ptr) 00060 { 00061 // do nothing 00062 } 00063 00064 } 00065 00066 } 00067 00068 TAO_END_VERSIONED_NAMESPACE_DECL 00069 00070