1 #include "NamingTask.h"
2 #include "tao/Version.h"
3 #include "orbsvcs/Naming/Naming_Server.h"
4 #include "ace/OS_NS_unistd.h"
5 #include "ace/Argv_Type_Converter.h"
7 NamingTask::NamingTask (const char* orbname
, int argc
, ACE_TCHAR
** argv
)
10 ACE_Argv_Type_Converter
satc (argc
, argv
);
11 orb_
= CORBA::ORB_init(satc
.get_argc (), satc
.get_TCHAR_argv (), orbname
);
14 void NamingTask::waitInit ()
16 // Wait for Naming Service initialized.
17 while (! initialized_
) {
18 ACE_OS::sleep(ACE_Time_Value(0, 100 * 1000));
22 void NamingTask::end()
28 CosNaming::NamingContext_ptr
29 NamingTask::root (void) const
31 return CosNaming::NamingContext::_duplicate (root_
);
37 // Get reference to Root POA
38 CORBA::Object_var obj
= orb_
->resolve_initial_references("RootPOA");
39 PortableServer::POA_var poa
= PortableServer::POA::_narrow(obj
.in());
41 // Activate POA Manager
42 PortableServer::POAManager_var poaManager
= poa
->the_POAManager();
43 poaManager
->activate();
45 // Initialize the naming service
46 // We are not going to look for other naming servers
47 TAO_Naming_Server naming
;
48 if (naming
.init(orb_
.in(),
57 ACE_DEBUG ((LM_DEBUG
, "The Naming Service Task is ready.\n"));
58 root_
= CosNaming::NamingContext::_duplicate (naming
.operator->());
66 ACE_ERROR ((LM_ERROR
, "Error, Unable to initialize the Naming Service.\n"));
69 catch (const CORBA::Exception
& ex
) {
70 ex
._tao_print_exception ("CORBA exception: NamingTask::svc() ");