void ImR_DSI_Forwarder::invoke (CORBA::ServerRequest_ptr request, TAO_AMH_DSI_Response_Handler_ptr resp) { bool is_oneway = !(request->_tao_server_request().response_expected() || request->_tao_server_request().sync_with_server()); if (is_oneway) { return; // nothing else to do, the client isn't waiting so no forwarding // will happen. } PortableServer::POA_var poa = this->poa_current_var_->get_POA(); PortableServer::ObjectId_var oid = this->poa_current_var_->get_object_id (); CORBA::String_var server_name = poa->the_name(); CORBA::String_var key_str; // Unlike POA Current, this implementation cannot be cached. TAO::Portable_Server::POA_Current* tao_current = dynamic_cast <TAO::Portable_Server::POA_Current*> (this->poa_current_var_.in ()); ACE_ASSERT(tao_current != 0); TAO::Portable_Server::POA_Current_Impl* impl = tao_current->implementation (); TAO::ObjectKey::encode_sequence_to_string (key_str.out (), impl->object_key ()); ImR_DSI_ResponseHandler * rh = 0; ACE_NEW (rh, ImR_DSI_ResponseHandler(key_str.in(), this->locator_.debug() > 0 ? server_name.in() : "", this->orb_, resp)); this->locator_.activate_server_by_name (server_name.in(), false, rh); }
// The DSI invoke request void TAO_CEC_DynamicImplementationServer::invoke (CORBA::ServerRequest_ptr request) { // Trap the _is_a request if (ACE_OS::strcmp ("_is_a", request->operation () ) == 0) { this->is_a (request); } else { CORBA::NVList_ptr list; // Get the operation paramter information from the IFR cache. TAO_CEC_Operation_Params *oper_params = this->typed_event_channel_->find_from_ifr_cache (request->operation () ); if (oper_params == 0) { if (TAO_debug_level >= 10) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** Operation not found in IFR cache *****\n"))); } this->typed_event_channel_->create_list (0, list); } else { // Populate the NVList from the parameter information. this->typed_event_channel_->create_operation_list (oper_params, list); // Get the operation arguments. This ahould demarshal correctly. request->arguments (list); // Populate the TypedEvent with the list and operation name. TAO_CEC_TypedEvent typed_event (list, request->operation () ); // Pass the TypedEvent to the TypedProxyPushConsumer this->typed_pp_consumer_->invoke (typed_event); } } }
void DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request, TAO_AMH_DSI_Response_Handler * rph) { CORBA::NVList_ptr opList; this->orb_->create_list (0, opList); request->arguments (opList); CORBA::Request_var target_request; this->target_->_create_request (0, // ctx request->operation (), opList, 0, // result 0, // exception_list, 0, // context_list, target_request.inout (), 0); target_request->_tao_lazy_evaluation (1); // Outgoing request must have the same byte order as the incoming one. target_request->_tao_byte_order (request->_tao_incoming_byte_order ()); try { // Updates the byte order state, if necessary. TAO_DII_Reply_Handler_ptr rh_ptr; ACE_NEW (rh_ptr, My_DII_Reply_Handler (rph, this->orb_)); TAO_DII_Reply_Handler_var rh(rh_ptr); target_request->sendc (rh.in()); } catch (const CORBA::UNKNOWN&) { // Outgoing reply must have the same byte order as the incoming one. request->_tao_reply_byte_order (target_request->_tao_byte_order ()); request->gateway_exception_reply ( target_request->raw_user_exception ()); return; } // Outgoing reply must have the same byte order as the incoming one. request->_tao_reply_byte_order (target_request->_tao_byte_order ()); if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0) { this->orb_->shutdown (0); } }
void DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request) { CORBA::NVList_ptr list; this->orb_->create_list (0, list); request->arguments (list); CORBA::Request_var target_request; this->target_->_create_request (0, // ctx request->operation (), list, 0, // result 0, // exception_list, 0, // context_list, target_request.inout (), 0); target_request->_tao_lazy_evaluation (1); // Outgoing request must have the same byte order as the incoming one. target_request->_tao_byte_order (request->_tao_incoming_byte_order ()); try { // Updates the byte order state, if necessary. target_request->invoke (); } catch (const CORBA::UNKNOWN&) { // Outgoing reply must have the same byte order as the incoming one. request->_tao_reply_byte_order (target_request->_tao_byte_order ()); request->gateway_exception_reply (target_request->raw_user_exception ()); return; } // Outgoing reply must have the same byte order as the incoming one. request->_tao_reply_byte_order (target_request->_tao_byte_order ()); if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0) { this->orb_->shutdown (0); } }
void TAO_CEC_DynamicImplementationServer::is_a (CORBA::ServerRequest_ptr request) { CORBA::NVList_ptr list; this->typed_event_channel_->create_list (0, list); CORBA::Any any_1; any_1._tao_set_typecode(CORBA::_tc_string); list->add_value ("value", any_1, CORBA::ARG_IN); request->arguments (list); CORBA::NamedValue_ptr nv = list->item (0); CORBA::Any_ptr ap = nv->value (); const char *value = 0; *ap >>= value; if (TAO_debug_level >= 10) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** TAO_CEC_DynamicImplementationServer::is_a called with value %s *****\n"), value)); } const char *object_id = CORBA::_tc_Object->id (); if (TAO_debug_level >= 10) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** is_a using Server's RepositoryId %s *****\n"), this->repository_id_)); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** is_a using base interface %s *****\n"), object_id)); } CORBA::Boolean result = 0; if (ACE_OS::strcmp (value, this->repository_id_) == 0 || ACE_OS::strcmp (value, object_id) == 0) { result = 1; } else { CORBA::ULong num = this->typed_event_channel_->number_of_base_interfaces (); for (CORBA::ULong base=0; base<num; base++) { if (TAO_debug_level >= 10) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** is_a using base interface %s *****\n"), this->typed_event_channel_->base_interfaces (base) )); } if (ACE_OS::strcmp (value, this->typed_event_channel_->base_interfaces (base) ) == 0) { result = 1; } } } if (TAO_debug_level >= 10) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("***** is_a returning %d *****\n"), result)); } CORBA::Any result_any; CORBA::Any::from_boolean from_boolean (result); result_any <<= from_boolean; request->set_result (result_any); }
// The code that actually processes the request message void Lorica::ProxyServant::invoke_i(CORBA::ServerRequest_ptr request, TAO_AMH_DSI_Response_Handler_ptr response_handler) { Lorica::ServerAgent_var agent; CORBA::Object_var target_obj = mapper_.current_native(agent.out()); EvaluatorBase *evb = this->mapper_.evaluator_for (target_obj.in()); if (!evb) throw CORBA::NO_IMPLEMENT(); bool is_oneway = !request->_tao_server_request().response_expected() || request->_tao_server_request().sync_with_server(); CORBA::NVList_var args; CORBA::NVList_var out_args; this->orb_->create_list(0, args); this->orb_->create_list(0, out_args); PortableServer::POA_var poa = this->current_->get_POA(); PortableServer::ObjectId_var oid = this->current_->get_object_id(); CORBA::NamedValue_var result; try { if (!evb->evaluate_request(request->operation(), poa.in(), request, args.inout(), out_args.inout(), result.out())) { if (!CORBA::is_nil(agent)) { agent->error_occured(errno, "ProxyServant::invoke_i, evaluate_request " "failed, Caught CORBA::BAD_OPERATION()\n"); } if (Lorica_debug_level > 0) { ACE_ERROR((LM_ERROR, "(%T) %N:%l - evaluate_request failed. Caught CORBA::BAD_OPERATION()\n")); } throw CORBA::BAD_OPERATION(); } } catch (CORBA::UserException & ex) { if (Lorica_debug_level > 0) ACE_DEBUG((LM_ERROR, ACE_TEXT("(%T) %N:%l - %s\n"), ex._info().c_str())); if (!CORBA::is_nil(agent)) { agent->error_occured(errno, "ProxyServant::invoke_i, evaluate_request " "failed, A CORBA::BAD_OPERATION() is thrown"); } if (Lorica_debug_level > 0) { ACE_ERROR((LM_ERROR, "(%T) %N:%l - evaluate_request raised %s\n", ex._name())); } throw CORBA::BAD_OPERATION(); } // do the rest, ie set up reply handler CORBA::Request_var target_request; target_obj->_create_request(0, // context request->operation(), args._retn(), // hand off ownership 0, // result, 0, // exception list 0, // context_list target_request.inout(), 0); if (is_oneway) { target_request->send_oneway(); return; } Messaging::ReplyHandler_var rh = new Lorica::ProxyReplyHandler(this->mapper_, request->operation(), poa.in(), evb, out_args._retn(), result._retn(), response_handler); target_request->sendc(rh.in()); }