1 #include "tao/Dynamic_TP/DTP_ORB_Loader.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/Dynamic_TP/DTP_ORBInitializer.h"
8 #include "tao/ORB_Constants.h"
9 #include "tao/ORBInitializer_Registry.h"
10 #include "tao/SystemException.h"
11 #include "ace/Dynamic_Service.h"
12 #include "ace/OS_NS_strings.h"
13 #include "ace/Arg_Shifter.h"
15 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
17 TAO_DTP_ORB_Loader::TAO_DTP_ORB_Loader ()
18 : initialized_ (false)
22 TAO_DTP_ORB_Loader::~TAO_DTP_ORB_Loader ()
27 TAO_DTP_ORB_Loader::init (int argc
, ACE_TCHAR
* argv
[])
29 ACE_TRACE ("TAO_DTP_ORB_Loader::init");
31 // Only allow initialization once.
32 if (this->initialized_
)
34 this->initialized_
= true;
37 for (curarg
= 0; curarg
< argc
; ++curarg
)
39 if (ACE_OS::strcasecmp (argv
[curarg
], ACE_TEXT ("-DTPORB")) == 0)
44 if (TAO_debug_level
> 0)
46 TAOLIB_DEBUG ((LM_DEBUG
,
47 ACE_TEXT ("TAO (%P|%t) - DTP_ORB_Loader - ")
48 ACE_TEXT ("DTPORB argument missing value\n")));
55 if (TAO_debug_level
> 0)
57 TAOLIB_DEBUG ((LM_DEBUG
,
58 ACE_TEXT ("TAO (%P|%t) - DTP_ORB_Loader -")
59 ACE_TEXT (" Unrecognized argv[%d], %C\n"),
60 curarg
, argv
[curarg
]));
66 // Register the ORB initializer.
69 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer
=
70 PortableInterceptor::ORBInitializer::_nil ();
72 /// Register the DynamicTP ORBInitializer.
73 ACE_NEW_THROW_EX (temp_orb_initializer
,
74 TAO_DTP_ORBInitializer (),
76 CORBA::SystemException::_tao_minor_code (
79 CORBA::COMPLETED_NO
));
81 PortableInterceptor::ORBInitializer_var orb_initializer
;
82 orb_initializer
= temp_orb_initializer
;
84 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
86 catch (const ::CORBA::Exception
& ex
)
88 ex
._tao_print_exception (
89 "Unexpected exception caught while "
90 "initializing the RTORB");
98 /////////////////////////////////////////////////////////////////////
100 ACE_FACTORY_DEFINE (TAO_Dynamic_TP
, TAO_DTP_ORB_Loader
)
101 ACE_STATIC_SVC_DEFINE (TAO_DTP_ORB_Loader
,
102 ACE_TEXT ("DTP_ORB_Loader"),
104 &ACE_SVC_NAME (TAO_DTP_ORB_Loader
),
105 ACE_Service_Type::DELETE_THIS
106 | ACE_Service_Type::DELETE_OBJ
,
108 TAO_END_VERSIONED_NAMESPACE_DECL
110 #endif /* (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 */