Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / DSI_AMI_Gateway / My_DII_Reply_Handler.cpp
blobfa74efaad3d584869309d2b3ab030dedb2c22956
2 // note: This order of header inclusion is required in order to satisfy
3 // template instantiation rules.
4 #include "tao/CORBA_methods.h"
5 #include "tao/AnyTypeCode/NVList.h"
7 #include "My_DII_Reply_Handler.h"
8 #include "ace/Log_Msg.h"
9 #include "tao/AnyTypeCode/Any.h"
11 My_DII_Reply_Handler::My_DII_Reply_Handler(
12 TAO_AMH_DSI_Response_Handler_ptr rph,
13 CORBA::ORB_var orb)
14 : response_handler_ (TAO_AMH_DSI_Response_Handler::_duplicate(rph)),
15 orb_ (orb)
19 My_DII_Reply_Handler::~My_DII_Reply_Handler()
23 void
24 My_DII_Reply_Handler::handle_response(TAO_InputCDR &incoming)
26 CORBA::NVList_var opList;
28 if (!CORBA::is_nil (this->response_handler_.in()))
30 int org_byte_order = this->response_handler_->_tao_byte_order ();
31 try
33 this->orb_->create_list (0, opList.out());
35 bool lazy_evaluation = true;
36 opList->_tao_incoming_cdr (incoming,
37 CORBA::ARG_OUT | CORBA::ARG_INOUT,
38 lazy_evaluation);
40 // make sure the response is sent on in the same byte order
41 // as initially received
42 this->response_handler_->_tao_byte_order (incoming.byte_order ());
44 this->response_handler_->invoke_reply (opList.in(),
45 0); // result
47 catch (const CORBA::SystemException &ex)
49 // in this case the response originates locally so we
50 // need to reset the byte order again
51 this->response_handler_->_tao_byte_order (org_byte_order);
53 TAO_AMH_DSI_Exception_Holder h (ex._tao_duplicate());
54 response_handler_->invoke_excep(&h);
56 catch (...)
58 // in this case the response originates locally so we
59 // need to reset the byte order again
60 this->response_handler_->_tao_byte_order (org_byte_order);
62 ACE_ERROR ((LM_ERROR,
63 "ERROR: Unknown Exception\n"));
64 TAO_AMH_DSI_Exception_Holder h (new CORBA::UNKNOWN());
65 response_handler_->invoke_excep(&h);
70 void
71 My_DII_Reply_Handler::handle_excep (TAO_InputCDR &incoming,
72 CORBA::ULong reply_status)
74 // make sure the response is sent on in the same byte order
75 // as initially received
76 this->response_handler_->_tao_byte_order (incoming.byte_order ());
78 ACE_DEBUG((LM_DEBUG, "calling My_DII_Reply_Handler::handle_excep()\n"));
79 this->response_handler_->gateway_exception_reply (reply_status, incoming);