#include <INS_Locator.h>
Inheritance diagram for INS_Locator:
Public Member Functions | |
INS_Locator (ImR_Locator_i &loc) | |
char * | locate (const char *object_key) |
Locate the appropriate IOR. | |
Private Attributes | |
ImR_Locator_i & | imr_locator_ |
This class provides a callback for the IORTable to call when it needs to dynamically receive a IOR to forward in response to an INS request.
Definition at line 37 of file INS_Locator.h.
INS_Locator::INS_Locator | ( | ImR_Locator_i & | loc | ) |
char * INS_Locator::locate | ( | const char * | object_key | ) |
Locate the appropriate IOR.
Definition at line 23 of file INS_Locator.cpp.
References CORBA::SystemException::_tao_minor_code(), ACE_ASSERT, ACE_DEBUG, ImR_Locator_i::activate_server_by_object(), ACE_String_Base< CHAR >::c_str(), CORBA::COMPLETED_NO, ImR_Locator_i::debug(), ACE_String_Base< CHAR >::find(), imr_locator_, LM_DEBUG, CORBA::string_dup(), ACE_String_Base< CHAR >::substring(), and TAO_IMPLREPO_MINOR_CODE.
00024 { 00025 ACE_ASSERT (object_key != 0); 00026 try 00027 { 00028 ACE_CString key (object_key); 00029 ssize_t poaidx = key.find ('/'); 00030 if (poaidx >= 0) 00031 { 00032 key = key.substring (0, poaidx); 00033 } 00034 00035 if (imr_locator_.debug () > 1) 00036 ACE_DEBUG ((LM_DEBUG, "ImR: Activating server <%s>.\n", key.c_str ())); 00037 00038 CORBA::String_var located = 00039 this->imr_locator_.activate_server_by_object (key.c_str ()); 00040 00041 ACE_CString tmp = located.in (); 00042 tmp += object_key; 00043 00044 if (imr_locator_.debug () > 0) 00045 ACE_DEBUG ((LM_DEBUG, "ImR: Forwarding invocation on <%s> to <%s>\n", key.c_str (), tmp.c_str())); 00046 00047 return CORBA::string_dup (tmp.c_str ()); 00048 } 00049 catch (const ImplementationRepository::CannotActivate&) 00050 { 00051 throw CORBA::TRANSIENT ( 00052 CORBA::SystemException::_tao_minor_code ( 00053 TAO_IMPLREPO_MINOR_CODE, 00054 0), 00055 CORBA::COMPLETED_NO); 00056 } 00057 catch (const ImplementationRepository::NotFound&) 00058 { 00059 throw CORBA::TRANSIENT ( 00060 CORBA::SystemException::_tao_minor_code ( 00061 TAO_IMPLREPO_MINOR_CODE, 00062 0), 00063 CORBA::COMPLETED_NO); 00064 } 00065 }
ImR_Locator_i& INS_Locator::imr_locator_ [private] |