diff options
Diffstat (limited to 'flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp')
-rw-r--r-- | flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp b/flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp index 57e4c34cd88..7c7043f89fa 100644 --- a/flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp +++ b/flat/CIAO/DAnCE/DomainApplicationManager/Node_Locator.cpp @@ -11,20 +11,20 @@ namespace DAnCE CosNaming::NamingContext_var nc) : orb_ (CORBA::ORB::_duplicate (orb)), nc_ (CosNaming::NamingContext::_duplicate (nc)) - { + { } - + ::Deployment::NodeManager_ptr Node_Locator::locate_node (const ACE_TCHAR *name) { ACE_CString ior; - + if (this->nodes_.find (name, ior) == 0) return this->resolve_ior (name, ior.c_str ()); else return this->ns_lookup (name); } - + bool Node_Locator::process_node_map (const ACE_TCHAR *filename) { @@ -36,9 +36,9 @@ namespace DAnCE "Error: Provided with nil filename\n")); return false; } - + FILE *inf = ACE_OS::fopen (filename, "r"); - + if (inf == 0) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::process_node_map - " @@ -48,7 +48,7 @@ namespace DAnCE } ACE_Read_Buffer reader (inf, true); - + char* string = 0; // Read from the file line by line while ((string = reader.read ('\n')) != 0) @@ -59,33 +59,33 @@ namespace DAnCE const char* ior_start = ACE_OS::strrchr (string, ' '); // Search from the left to the first space const char* dest_end = ACE_OS::strchr (string, ' '); - + // The destination is first followed by some spaces ACE_CString destination (string, dest_end - string); // And then the IOR ACE_CString ior (ior_start + 1, ACE_OS::strlen (ior_start + 1)); reader.alloc ()->free (string); - + DANCE_DEBUG ((LM_INFO, DLINFO "Node_Locator::process_node_map - " - "Storing IOR %s for destination %s\n", + "Storing IOR %C for destination %C\n", ior.c_str (), destination.c_str ())); this->nodes_.bind (destination, ior); } - + return true; } - + ::Deployment::NodeManager_ptr Node_Locator::resolve_ior (const ACE_TCHAR *name, const ACE_TCHAR *ior) { DANCE_TRACE ("Node_Locator::resolve_ior"); - + DANCE_DEBUG ((LM_DEBUG, DLINFO "Node_Locator::resolve_ior - " "Resolving ior %s for destination %s\n", ior, name)); - + CORBA::Object_var obj = this->orb_->string_to_object (ior); - + if (CORBA::is_nil (obj.in ())) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::resolve_ior - " @@ -94,9 +94,9 @@ namespace DAnCE name, ior)); return false; } - + ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); - + if (CORBA::is_nil (nm.in ())) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::resolve_ior - " @@ -105,22 +105,22 @@ namespace DAnCE name, ior)); return false; } - + return nm._retn (); } - + void Node_Locator::store_ior (const ACE_TCHAR *name, const ACE_TCHAR *ior) { DANCE_TRACE ("Node_Locator::store_ior"); this->nodes_.bind (name, ior); } - + ::Deployment::NodeManager_ptr Node_Locator::ns_lookup (const ACE_TCHAR *nodename) { DANCE_TRACE ("Node_Locator::ns_lookup"); - + if (CORBA::is_nil (this->nc_.in ())) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " @@ -128,17 +128,17 @@ namespace DAnCE nodename)); return ::Deployment::NodeManager::_nil (); } - + try { CosNaming::Name name; name.length (1); - + name[0].id = nodename; - + CORBA::Object_var obj = this->nc_->resolve (name); ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); - + if (CORBA::is_nil (nm.in ())) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " @@ -146,20 +146,20 @@ namespace DAnCE nodename)); return ::Deployment::NodeManager::_nil (); } - + return nm._retn (); } catch (CORBA::Exception &e) { DANCE_ERROR ((LM_ERROR, DLINFO "Node_Locator::ns_lookup - " - "Caught CORBA exception while looking up name %s:%s\n", + "Caught CORBA exception while looking up name %s:%C\n", nodename, e._info ().c_str ())); } catch (...) { - + } - + return ::Deployment::NodeManager::_nil (); } } |