1 //=============================================================================
3 * @file INS_Locator.cpp
5 * @brief Implementation of the ImR's INS Locator class
7 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
9 //=============================================================================
11 #include "INS_Locator.h"
12 #include "ImR_Locator_i.h"
13 #include "tao/ORB_Constants.h"
14 #include "tao/ORB_Core.h"
15 #include "orbsvcs/Log_Macros.h"
17 INS_Locator::INS_Locator (ImR_Locator_i
& loc
)
23 INS_Locator::locate (const char* object_key
)
25 ACE_ASSERT (object_key
!= 0);
28 CORBA::String_var located
=
29 this->imr_locator_
.activate_server_by_object (object_key
);
30 return located
._retn();
32 catch (const CORBA::Exception
&)
34 throw CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code
35 (TAO_IMPLREPO_MINOR_CODE
, 0),
41 INS_Locator::async_locate (::IORTable::Locate_ResponseHandler handler
,
42 const char* object_key
)
44 ACE_ASSERT (object_key
!= 0);
48 ACE_CString
full (object_key
);
49 if (this->imr_locator_
.split_key (full
, key
, si
))
51 ImR_ResponseHandler
*rh
= 0;
52 ACE_NEW (rh
, INS_Loc_ResponseHandler (key
.c_str(), handler
));
53 this->imr_locator_
.activate_server_by_info (si
, rh
);
57 handler
->raise_excep (CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code
58 (TAO_IMPLREPO_MINOR_CODE
, 0),
59 CORBA::COMPLETED_NO
));
64 //----------------------------------------------------------------------------------------
65 INS_Loc_ResponseHandler::INS_Loc_ResponseHandler (const char *key
,
66 ::IORTable::Locate_ResponseHandler handler
)
73 INS_Loc_ResponseHandler::send_ior (const char *pior
)
75 ACE_CString ior
= pior
;
77 // Check that the returned ior is the expected partial ior with
79 if (ior
.find ("corbaloc:") == 0 && ior
[ior
.length () -1] == '/')
83 if (ImR_Locator_i::debug () > 5)
85 ORBSVCS_DEBUG ((LM_DEBUG
,
86 ACE_TEXT ("(%P|%t) INS_Loc_ResponseHandler::send_ior (): Forwarding ")
87 ACE_TEXT ("key <%C> to IOR <%C>\n"),
88 key_str_
.in (), ior
.c_str ()));
90 rh_
->forward_ior (ior
.c_str(), false);
94 if (ImR_Locator_i::debug () > 1)
96 ORBSVCS_ERROR ((LM_ERROR
,
97 ACE_TEXT ("(%P|%t) INS_Loc_ResponseHandler::send_ior (): Invalid corbaloc ior for key <%C> IOR <%C>\n"),
98 key_str_
.in (), pior
));
101 rh_
->raise_excep (CORBA::OBJECT_NOT_EXIST (CORBA::SystemException::_tao_minor_code
102 ( TAO_IMPLREPO_MINOR_CODE
, 0),
103 CORBA::COMPLETED_NO
));
110 INS_Loc_ResponseHandler::send_exception (CORBA::Exception
*ex
)
113 rh_
->raise_excep (CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code
114 (TAO_IMPLREPO_MINOR_CODE
, 0),
115 CORBA::COMPLETED_NO
));