Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / INS_Locator.cpp
blobd2da4e94eb29e9dfe20c0b48f56d0eb709025850
1 //=============================================================================
2 /**
3 * @file INS_Locator.cpp
5 * @brief Implementation of the ImR's INS Locator class
7 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
8 */
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)
18 : imr_locator_ (loc)
22 char *
23 INS_Locator::locate (const char* object_key)
25 ACE_ASSERT (object_key != 0);
26 try
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),
36 CORBA::COMPLETED_NO);
40 void
41 INS_Locator::async_locate (::IORTable::Locate_ResponseHandler handler,
42 const char* object_key)
44 ACE_ASSERT (object_key != 0);
46 Server_Info_Ptr si;
47 ACE_CString key;
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);
55 else
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)
67 : key_str_(key),
68 rh_ (handler)
72 void
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
78 // missing ObjectKey.
79 if (ior.find ("corbaloc:") == 0 && ior[ior.length () -1] == '/')
81 ior += key_str_;
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);
92 else
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));
106 delete this;
109 void
110 INS_Loc_ResponseHandler::send_exception (CORBA::Exception *ex)
112 delete ex;
113 rh_->raise_excep (CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code
114 (TAO_IMPLREPO_MINOR_CODE, 0),
115 CORBA::COMPLETED_NO));
116 delete this;