24 #include <coil/Routing.h> 25 #include <coil/stringutil.h> 41 : m_cosnaming(orb, names), m_endpoint(
""),
42 m_replaceEndpoint(false)
47 coil::toBool(prop[
"corba.nameservice.replace_endpoint"].c_str(),
54 RTC_INFO((
"Endpoint for the CORBA naming service (%s) is %s.",
60 RTC_WARN((
"No endpoint for the CORBA naming service (%s) was found.",
61 host_port[0].c_str()));
74 RTC_TRACE((
"bindObject(name = %s, rtobj)", name));
78 CORBA::Object_var obj(RTObject::_duplicate(rtobj->
getObjRef()));
79 CORBA::String_var
ior;
81 std::string iorstr((
const char*)ior);
83 RTC_DEBUG((
"Original IOR information:\n %s",
87 getORB()->string_to_object(iorstr.c_str());
89 RTC_DEBUG((
"Modified IOR information:\n %s",
95 #endif // ORB_IS_OMNIORB 99 #endif // ORB_IS_OMNIORB 105 RTC_TRACE((
"bindObject(name = %s, mgr)", name));
106 #ifdef ORB_IS_OMNIORB 109 CORBA::Object_var obj(RTM::Manager::_duplicate(mgr->
getObjRef()));
110 CORBA::String_var
ior;
112 std::string iorstr((
const char*)ior);
114 RTC_DEBUG((
"Original IOR information:\n %s",
118 getORB()->string_to_object(iorstr.c_str());
120 RTC_DEBUG((
"Modified IOR information]\n %s",
126 #endif // ORB_IS_OMNIORB 128 #ifdef ORB_IS_OMNIORB 130 #endif // ORB_IS_OMNIORB 142 RTC_TRACE((
"unbindObject(name = %s)", name));
164 :m_manager(manager),
rtclog(
"NamingManager")
187 const char* name_server)
189 RTC_TRACE((
"NamingManager::registerNameServer(%s, %s)",
190 method, name_server));
195 m_names.push_back(
new Names(method, name_server, name));
208 RTC_TRACE((
"NamingManager::bindObject(%s)", name));
211 for (
int i(0), len(
m_names.size()); i < len; ++i)
217 m_names[i]->ns->bindObject(name, rtobj);
231 RTC_TRACE((
"NamingManager::bindObject(%s)", name));
234 for (
int i(0), len(
m_names.size()); i < len; ++i)
240 m_names[i]->ns->bindObject(name, mgr);
265 "YES",
"NO",
false));
266 for (
int i(0), len(
m_names.size()); i < len; ++i)
270 RTC_DEBUG((
"Retrying connection to %s/%s",
282 RTC_INFO((
"Name server: %s (%s) disappeared.",
291 RTC_INFO((
"Name server: %s (%s) disappeared.",
310 RTC_TRACE((
"NamingManager::unbindObject(%s)", name));
313 for (
int i(0), len(
m_names.size()); i < len; ++i)
317 m_names[i]->ns->unbindObject(name);
338 for (
int i(0), len(
m_compNames.size()); i < len; ++i)
342 for (
size_t i(0); i < names.size(); ++i)
352 for (
int i(0), len(
m_mgrNames.size()); i < len; ++i)
356 for (
size_t i(0); i < names.size(); ++i)
372 std::vector<RTObject_impl*> comps;
375 for (
int i(0), len(
m_compNames.size()); i < len; ++i)
377 comps.push_back(const_cast<RTObject_impl*>(
m_compNames[i]->rtobj));
393 const char* name_server)
395 RTC_TRACE((
"createNamingObj(method = %s, nameserver = %s",
396 method, name_server));
397 std::string m(method);
406 if (name == NULL)
return NULL;
407 RTC_INFO((
"NameServer connection succeeded: %s/%s", \
408 method, name_server));
413 RTC_INFO((
"NameServer connection failed: %s/%s", \
414 method, name_server));
430 for (
int i(0), len(
m_compNames.size()); i < len; ++i)
446 for (
int i(0), len(
m_compNames.size()); i < len; ++i)
460 for (
int i(0), len(
m_mgrNames.size()); i < len; ++i)
481 std::vector<Comps*>::iterator it(
m_compNames.begin());
482 for (
int i(0), len(
m_compNames.size()); i < len; ++i, ++it)
495 std::vector<Mgr*>::iterator it(
m_mgrNames.begin());
496 for (
int i(0), len(
m_mgrNames.size()); i < len; ++i, ++it)
518 RTC_INFO((
"Connected to a name server: %s/%s",
526 RTC_DEBUG((
"Name service: %s/%s still not available.",
533 RTC_DEBUG((
"Name server: %s/%s disappeared again.",
std::vector< Mgr * > m_mgrNames
ManagerServant list.
std::vector< Comps * > m_compNames
Component list.
Manager * m_manager
Manager object.
std::vector< RTObject_impl * > getObjects()
Get all bound objects.
bool replaceEndpoint(std::string &iorstr, const std::string &endpoint)
Replace endpoint address in IOR entry.
Mutex m_mgrNamesMutex
Mutex of ManagerServant list.
virtual void bindObject(const char *name, const RTObject_impl *rtobj)=0
Pure virtual function to bind the specified objects to the NamingService.
std::string formatIORinfo(const char *iorstr)
Extracts information from IOR string and returns formatted string.
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
void bindObject(const char *name, const RTObject_impl *rtobj)
Bind the specified objects to NamingService.
Mutex m_compNamesMutex
Mutex of Component list.
void setName(const char *name)
Set suffix of date/time string of header.
void registerNameServer(const char *method, const char *name_server)
Regster the NameServer.
CORBA::ORB_ptr getORB()
Get the pointer to ORB.
NamingOnCorba(CORBA::ORB_ptr orb, const char *names)
Constructor.
virtual void bindObject(const char *name, const RTObject_impl *rtobj)
Bind the specified CORBA objects to NamingService.
static Manager & instance()
Get instance of the manager.
void unregisterMgrName(const char *name)
Unregister the ManagerServants that will be registered to NameServer.
Structure for ManagerServant management.
#define RTC_WARN(fmt)
Warning log output macro.
void registerMgrName(const char *name, const RTM::ManagerServant *mgr)
Configure the ManagerServants that will be registered to NameServer.
RTComponent manager class.
std::vector< std::string > vstring
void unbind(const CosNaming::Name &name)
Unbind a binding specified by NameComponent.
NamingService management abstract class.
coil::Properties & getConfig()
Get the manager configuration.
#define RTC_DEBUG(fmt)
Debug level log output macro.
Mutex m_namesMutex
Mutex of NameServer list.
NamingBase * createNamingObj(const char *method, const char *name_server)
Create objects for NameServer management.
Structure for NameServer management.
void retryConnection(Names *ns)
void registerCompName(const char *name, const RTObject_impl *rtobj)
Configure the components that will be registered to NameServer.
RTObject_ptr getObjRef() const
[local interface] Get the object reference
RTM::Manager_ptr getObjRef() const
Get the reference of Manager.
prop
Organization::get_organization_property ();.
naming Service helper class
CORBA IOR manipulation utility functions.
void bindCompsTo(NamingBase *ns)
Register the configured component to NameServer.
void unregisterCompName(const char *name)
Unregister the components that will be registered to NameServer.
Class represents a set of properties.
Structure for component management.
bool toBool(std::string str, std::string yes, std::string no, bool default_value)
Convert given string into bool value.
void update()
Update information of NamingServer.
virtual ~NamingManager(void)
Destructor.
virtual void unbindObject(const char *name)
Unbind the specified CORBA objects from NamingService.
#define RTC_INFO(fmt)
Information level log output macro.
NamingServer management class for CORBA.
NamingManager(Manager *manager)
Constructor.
std::vector< Names * > m_names
NameServer list.
virtual bool isAlive()
Check if the name service is alive.
void unbindObject(const char *name)
Unbind the specified objects from NamingService.
bool dest_to_endpoint(std::string dest_addr, std::string &endpoint)
Getting network interface name from destination address.
void rebindByString(const char *string_name, CORBA::Object_ptr obj, const bool force=1)
Rebind Object.
void unbindAll()
Unbind all objects from NamingService.