diff options
-rw-r--r-- | TAO/ChangeLog | 27 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp | 51 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h | 6 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp | 28 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Invocation_Adapter.h | 5 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Dynamic_Implementation.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Request.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Server_Request.cpp | 143 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Unknown_User_Exception.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Unknown_User_Exception.h | 3 | ||||
-rw-r--r-- | TAO/tao/Messaging/AMI_Arguments_Converter_Impl.cpp | 42 | ||||
-rw-r--r-- | TAO/tao/Messaging/AMI_Arguments_Converter_Impl.h | 6 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Collocated_Arguments_Converter.h | 7 |
13 files changed, 285 insertions, 62 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 21373f1dd94..45695741f7a 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,4 +1,23 @@ -Sun Jan 6 07:36:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Jan 7 12:56:12 UTC 2008 Martin Corino <mcorino@remedy.nl> + + * tao/PortableServer/Collocated_Arguments_Converter.h: + * tao/Messaging/AMI_Arguments_Converter_Impl.{h, cpp}: + * tao/DynamicInterface/DII_Arguments_Converter.{h, cpp}: + Implemented new conversion methods for collocation in combination + with DSI which follows a different path from 'normal' servants and + requires slightly different functionality. + + * tao/DynamicInterface/DII_Invocation_Adapter.{h, cpp}: + * tao/DynamicInterface/Dynamic_Implementation.cpp: + * tao/DynamicInterface/Request.cpp: + * tao/DynamicInterface/Server_Request.cpp: + * tao/DynamicInterface/Unknown_User_Exception.{h, cpp}: + Various changes to fix problems with (DII +) DSI + Collocation. + Problems were visible in the failing DII_Collocation_Tests/twoway + tests (all platforms) and testing done with R2CORBA which is + implemented using DII and DSI. + +Sun Jan 6 07:36:12 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * tao/EndpointPolicy/IIOPEndpointValue_i.cpp: Fixed conversion warning @@ -36,17 +55,17 @@ Thu Jan 3 14:36:18 UTC 2008 Adam Mitz <mitza@ociweb.com> Fixed a fuzz error. -Thu Jan 3 10:14:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jan 3 10:14:12 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * performance-tests/Cubit/TAO/MT_Cubit/client.{h,cpp}: Fixed compile problems with VxWorks -Thu Jan 3 10:04:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jan 3 10:04:12 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * utils/catior/catior.cpp: Fixed may be unitialized warnings with VxWorks 6.6 -Thu Jan 3 09:57:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jan 3 09:57:12 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * utils/catior/catior.cpp: Prefix increment and moved some variables into the loop diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp index e70720eec1c..846a8ae204a 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp @@ -75,12 +75,57 @@ TAO_DII_Arguments_Converter_Impl::convert_request ( details->use_stub_args (false); } +void +TAO_DII_Arguments_Converter_Impl::dsi_convert_request ( + TAO_ServerRequest & server_request, + TAO_OutputCDR & output) +{ + // The DII requests on client side always have two arguments + // - one is the return argument and the other is NVList_Argument. + CORBA::NVList_ptr lst + = static_cast<TAO::NVList_Argument *> ( + server_request.operation_details ()->args()[1])->arg (); + + // Only marshal the in(out) arguments since we use this to demarshal + // these values in the serverside argument list. + lst->_tao_encode (output, CORBA::ARG_IN | CORBA::ARG_INOUT); +} + void TAO_DII_Arguments_Converter_Impl::convert_reply ( - TAO_ServerRequest & /* server_request */, - TAO::Argument * const /*args*/[], - size_t /*nargs*/) + TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs) { + TAO_OutputCDR output; + for (CORBA::ULong j = 0; j < nargs; ++j) + { + if (!(args[j]->marshal (output))) + { + TAO_OutputCDR::throw_skel_exception (errno); + } + } + TAO_InputCDR input (output); + this->dsi_convert_reply (server_request, input); +} + +void +TAO_DII_Arguments_Converter_Impl::dsi_convert_reply ( + TAO_ServerRequest & server_request, + TAO_InputCDR & input) +{ + TAO::NamedValue_Argument * _ret_val + = static_cast<TAO::NamedValue_Argument *> ( + server_request.operation_details ()->args()[0]); + + _ret_val->demarshal (input); + + CORBA::NVList_ptr lst + = static_cast<TAO::NVList_Argument *> ( + server_request.operation_details ()->args()[1])->arg (); + + lst->_tao_decode (input, + CORBA::ARG_INOUT | CORBA::ARG_OUT); } void diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h index cb40c0df441..b2b7d4dae47 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h @@ -46,10 +46,16 @@ public: TAO::Argument * const args[], size_t nargs); + virtual void dsi_convert_request (TAO_ServerRequest & server_request, + TAO_OutputCDR & output); + virtual void convert_reply (TAO_ServerRequest & server_request, TAO::Argument * const args[], size_t nargs); + virtual void dsi_convert_reply (TAO_ServerRequest & server_request, + TAO_InputCDR & input); + virtual void handle_corba_exception (TAO_ServerRequest & server_request, CORBA::Exception *exception); diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index e04f890a971..31ee9172549 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -1,4 +1,6 @@ //$Id$ +#include "tao/AnyTypeCode/TypeCode.h" +#include "tao/AnyTypeCode/AnyTypeCode_methods.h" #include "tao/DynamicInterface/DII_Invocation_Adapter.h" #include "tao/DynamicInterface/DII_Invocation.h" #include "tao/DynamicInterface/DII_Reply_Dispatcher.h" @@ -6,6 +8,7 @@ #include "tao/DynamicInterface/Request.h" #include "tao/Exception.h" +#include "tao/Exception_Data.h" #include "tao/ORB_Constants.h" #include "tao/Profile_Transport_Resolver.h" #include "tao/Transport.h" @@ -43,11 +46,36 @@ namespace TAO mode) , exception_list_ (excp) , request_ (r) + , ex_data_ (0) { } DII_Invocation_Adapter::~DII_Invocation_Adapter (void) { + delete ex_data_; + } + + void + DII_Invocation_Adapter::invoke (TAO::Exception_Data */*ex_data*/, + unsigned long ex_count) + { + // Convert DII exception list to a form the invocation can use + // to filter raised user exceptions. + ex_count = this->exception_list_->count (); + ACE_NEW_THROW_EX (this->ex_data_, + TAO::Exception_Data[ex_count], + CORBA::NO_MEMORY ()); + for (unsigned long l=0; l<ex_count ;++l) + { + CORBA::TypeCode_var xtc = this->exception_list_->item (l); + this->ex_data_[l].id = xtc->id (); + this->ex_data_[l].alloc = 0; +#if TAO_HAS_INTERCEPTORS == 1 + this->ex_data_[l].tc_ptr = xtc.in (); +#endif + } + + Invocation_Adapter::invoke (this->ex_data_, ex_count); } Invocation_Status diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h index b540a7b94b7..f058c2b97c0 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.h @@ -93,6 +93,9 @@ namespace TAO virtual ~DII_Invocation_Adapter (void); + /// Invoke the target + virtual void invoke (TAO::Exception_Data *ex, unsigned long ex_count); + protected: virtual Invocation_Status invoke_twoway ( @@ -112,6 +115,8 @@ namespace TAO CORBA::ExceptionList *exception_list_; CORBA::Request *request_; + + TAO::Exception_Data *ex_data_; private: /// Dont allow default initializations diff --git a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp index fc6563ccb8e..79c6fb295a3 100644 --- a/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp +++ b/TAO/tao/DynamicInterface/Dynamic_Implementation.cpp @@ -11,6 +11,8 @@ ACE_RCSID (DynamicInterface, #include "tao/IFR_Client_Adapter.h" #include "tao/PortableServer/Root_POA.h" #include "tao/PortableServer/POA_Current_Impl.h" +#include "tao/PortableServer/Collocated_Arguments_Converter.h" +#include "tao/operation_details.h" #include "ace/Dynamic_Service.h" #include "ace/OS_NS_string.h" @@ -153,12 +155,22 @@ TAO_DynamicImplementation::_dispatch (TAO_ServerRequest &request, dsi_request->dsi_marshal (); } } - catch (const ::CORBA::Exception& ex) + catch (::CORBA::Exception& ex) { // Only if the client is waiting. if (request.response_expected () && !request.sync_with_server ()) { - request.tao_send_reply_exception (ex); + if (request.collocated () + && request.operation_details ()->cac () != 0) + { + // If we have a cac it will handle the exception and no + // need to do any further processing + request.operation_details ()->cac ()->handle_corba_exception ( + request, &ex); + return; + } + else + request.tao_send_reply_exception (ex); } } diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp index 48debf8a3a5..92884047502 100644 --- a/TAO/tao/DynamicInterface/Request.cpp +++ b/TAO/tao/DynamicInterface/Request.cpp @@ -153,6 +153,10 @@ CORBA::Request::invoke (void) _tao_call.invoke (0, 0); + // If we returned without an exception being thrown the response + // (if any) is assumed to be received. + this->response_received_ = true; + // If this request was created by a gateway, then result_ // and/or args_ are shared by a CORBA::ServerRequest, whose // reply must be in the same byte order as the reply we are diff --git a/TAO/tao/DynamicInterface/Server_Request.cpp b/TAO/tao/DynamicInterface/Server_Request.cpp index f5da3ed799e..7900b2420f3 100644 --- a/TAO/tao/DynamicInterface/Server_Request.cpp +++ b/TAO/tao/DynamicInterface/Server_Request.cpp @@ -8,11 +8,15 @@ ACE_RCSID (DynamicInterface, Server_Request, "$Id$") +#include "tao/DynamicInterface/DII_Arguments.h" +#include "tao/DynamicInterface/Unknown_User_Exception.h" +#include "tao/PortableServer/Collocated_Arguments_Converter.h" #include "tao/AnyTypeCode/NVList.h" #include "tao/GIOP_Utils.h" #include "tao/AnyTypeCode/Marshal.h" #include "tao/AnyTypeCode/TypeCode.h" #include "tao/AnyTypeCode/Any_Impl.h" +#include "tao/operation_details.h" #include "tao/SystemException.h" #if !defined (__ACE_INLINE__) @@ -75,16 +79,37 @@ CORBA::ServerRequest::arguments (CORBA::NVList_ptr &list) throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO); } - // Save params for later use when marshaling the reply. - this->params_ = list; - - this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), - CORBA::ARG_IN | CORBA::ARG_INOUT, - this->lazy_evaluation_); - - // Pass this alignment back to the TAO_ServerRequest. - this->orb_server_request_.dsi_nvlist_align ( - this->params_->_tao_target_alignment ()); + // In a collocated situation there will not be an incoming CDR stream + // in which case we can get the arguments from the + // operation_details using the 'collocated argument converter'. + if (this->orb_server_request_.collocated ()) + { + this->params_ = list; + + if (this->orb_server_request_.operation_details ()->cac () != 0) + { + TAO_OutputCDR output; + this->orb_server_request_.operation_details ()->cac ( + )->dsi_convert_request (this->orb_server_request_, + output); + + TAO_InputCDR input(output); + this->params_->_tao_decode (input, CORBA::ARG_IN | CORBA::ARG_INOUT); + } + } + else + { + // Save params for later use when marshaling the reply. + this->params_ = list; + + this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), + CORBA::ARG_IN | CORBA::ARG_INOUT, + this->lazy_evaluation_); + + // Pass this alignment back to the TAO_ServerRequest. + this->orb_server_request_.dsi_nvlist_align ( + this->params_->_tao_target_alignment ()); + } } // Store the result value. There's either an exception, or a result, @@ -146,42 +171,78 @@ CORBA::ServerRequest::dsi_marshal (void) return; } - if (this->orb_server_request_.reply_status () == GIOP::NO_EXCEPTION) - { - // In DSI, we can't rely on the skeleton to do this. - if (this->retval_ == 0 && this->params_ == 0) - { - this->orb_server_request_.argument_flag (false); - } - - this->orb_server_request_.init_reply (); - - // Send the return value, if any. - if (this->retval_ != 0) - { - this->retval_->impl ()->marshal_value ( - *this->orb_server_request_.outgoing ()); - } - - // Send the "inout" and "out" parameters. - if (this->params_ != 0) - { - this->params_->_tao_encode ( - *this->orb_server_request_.outgoing (), - CORBA::ARG_INOUT | CORBA::ARG_OUT); - } - } + // In a collocated situation there is no outgoing CDR stream. + // So, in case of an exception we just raise the UnknownUserException + // and for a regular reply we use the 'collocated argument converter'. + if (this->orb_server_request_.collocated ()) + { + if (this->orb_server_request_.reply_status () == GIOP::USER_EXCEPTION) + { + throw CORBA::UnknownUserException (*this->exception_); + } + else if (this->orb_server_request_.operation_details ()->cac () != 0) + { + TAO_OutputCDR output; + // marshal the return value if any + if (this->retval_ != 0) + { + this->retval_->impl ()->marshal_value (output); + } + + // marshal the "inout" and "out" parameters. + if (this->params_ != 0) + { + this->params_->_tao_encode ( + output, + CORBA::ARG_INOUT | CORBA::ARG_OUT); + } + + TAO_InputCDR input (output); + // set reply parameters + this->orb_server_request_.operation_details ()->cac ( + )->dsi_convert_reply (this->orb_server_request_, + input); + } + } else - { + { + if (this->orb_server_request_.reply_status () == GIOP::NO_EXCEPTION) + { + // In DSI, we can't rely on the skeleton to do this. + if (this->retval_ == 0 && this->params_ == 0) + { + this->orb_server_request_.argument_flag (false); + } + + this->orb_server_request_.init_reply (); + + // Send the return value, if any. + if (this->retval_ != 0) + { + this->retval_->impl ()->marshal_value ( + *this->orb_server_request_.outgoing ()); + } + + // Send the "inout" and "out" parameters. + if (this->params_ != 0) + { + this->params_->_tao_encode ( + *this->orb_server_request_.outgoing (), + CORBA::ARG_INOUT | CORBA::ARG_OUT); + } + } + else + { // This defaults to true, but just to be safe... this->orb_server_request_.argument_flag (true); - // Write the reply header to the ORB request's outgoing CDR stream. - this->orb_server_request_.init_reply (); + // Write the reply header to the ORB request's outgoing CDR stream. + this->orb_server_request_.init_reply (); - this->exception_->impl ()->marshal_value ( - *this->orb_server_request_.outgoing ()); - } + this->exception_->impl ()->marshal_value ( + *this->orb_server_request_.outgoing ()); + } + } this->orb_server_request_.tao_send_reply (); } diff --git a/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp b/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp index 99f6a45212a..b1187578db5 100644 --- a/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp +++ b/TAO/tao/DynamicInterface/Unknown_User_Exception.cpp @@ -96,10 +96,17 @@ CORBA::UnknownUserException::_tao_decode (TAO_InputCDR &) throw ::CORBA::MARSHAL (); } +const char * +CORBA::UnknownUserException::_rep_id (void) const +{ + this->exception_->_tao_get_typecode ()->id (); +} + CORBA::TypeCode_ptr CORBA::UnknownUserException::_tao_type (void) const { - return CORBA::_tc_UnknownUserException; + //return CORBA::_tc_UnknownUserException; + return this->exception_->_tao_get_typecode (); } namespace TAO diff --git a/TAO/tao/DynamicInterface/Unknown_User_Exception.h b/TAO/tao/DynamicInterface/Unknown_User_Exception.h index 83a6dbbcddc..e309b80614d 100644 --- a/TAO/tao/DynamicInterface/Unknown_User_Exception.h +++ b/TAO/tao/DynamicInterface/Unknown_User_Exception.h @@ -86,6 +86,9 @@ namespace CORBA static UnknownUserException * _downcast (CORBA::Exception *ex); static UnknownUserException const * _downcast (CORBA::Exception const * ex); + /// Return the repository ID of the Exception. + virtual const char * _rep_id (void) const; + // = TAO specific extension. /// This class has a specific typecode. diff --git a/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.cpp b/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.cpp index 2bbecec5547..b70839ad961 100644 --- a/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.cpp +++ b/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.cpp @@ -24,16 +24,8 @@ TAO_AMI_Arguments_Converter_Impl::convert_request ( // and not just the inout arguments we need to expand the client arguments // to be list of Arguments. - CORBA::ULong const nrarg = server_request.operation_details ()->args_num (); - TAO_OutputCDR output; - for (CORBA::ULong i = 1; i < nrarg; ++i) - { - if (!(server_request.operation_details ()->args()[i])->marshal (output)) - { - throw ::CORBA::BAD_PARAM (); - } - } + this->dsi_convert_request (server_request, output); TAO_InputCDR input (output); for (CORBA::ULong j = 1; j < nargs; ++j) @@ -50,6 +42,23 @@ TAO_AMI_Arguments_Converter_Impl::convert_request ( details->use_stub_args (false); } +void +TAO_AMI_Arguments_Converter_Impl::dsi_convert_request ( + TAO_ServerRequest & server_request, + TAO_OutputCDR & output) +{ + // The AMI requests on client side just has the in and inout arguments + CORBA::ULong const nrarg = server_request.operation_details ()->args_num (); + + for (CORBA::ULong i = 1; i < nrarg; ++i) + { + if (!(server_request.operation_details ()->args()[i])->marshal (output)) + { + throw ::CORBA::BAD_PARAM (); + } + } +} + void TAO_AMI_Arguments_Converter_Impl::convert_reply ( TAO_ServerRequest & server_request, @@ -59,8 +68,6 @@ TAO_AMI_Arguments_Converter_Impl::convert_reply ( if (server_request.operation_details ()->reply_dispatcher ()) { TAO_OutputCDR output; - TAO_Pluggable_Reply_Params params (0); - params.reply_status (GIOP::NO_EXCEPTION); for (CORBA::ULong j = 0; j < nargs; ++j) { if (!(args[j]->marshal (output))) @@ -69,6 +76,19 @@ TAO_AMI_Arguments_Converter_Impl::convert_reply ( } } TAO_InputCDR input (output); + this->dsi_convert_reply (server_request, input); + } +} + +void +TAO_AMI_Arguments_Converter_Impl::dsi_convert_reply ( + TAO_ServerRequest & server_request, + TAO_InputCDR & input) +{ + if (server_request.operation_details ()->reply_dispatcher ()) + { + TAO_Pluggable_Reply_Params params (0); + params.reply_status (GIOP::NO_EXCEPTION); params.input_cdr_ = &input; server_request.operation_details ()-> reply_dispatcher ()->dispatch_reply (params); diff --git a/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.h b/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.h index ea5cbab3d2d..8745bf809ab 100644 --- a/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.h +++ b/TAO/tao/Messaging/AMI_Arguments_Converter_Impl.h @@ -46,10 +46,16 @@ public: TAO::Argument * const args[], size_t nargs); + virtual void dsi_convert_request (TAO_ServerRequest & server_request, + TAO_OutputCDR & output); + virtual void convert_reply (TAO_ServerRequest & server_request, TAO::Argument * const args[], size_t nargs); + virtual void dsi_convert_reply (TAO_ServerRequest & server_request, + TAO_InputCDR & input); + virtual void handle_corba_exception (TAO_ServerRequest & server_request, CORBA::Exception *exception); diff --git a/TAO/tao/PortableServer/Collocated_Arguments_Converter.h b/TAO/tao/PortableServer/Collocated_Arguments_Converter.h index 5202fe2ab9e..4bec2b4c9dd 100644 --- a/TAO/tao/PortableServer/Collocated_Arguments_Converter.h +++ b/TAO/tao/PortableServer/Collocated_Arguments_Converter.h @@ -24,6 +24,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/TAO_Server_Request.h" +#include "tao/CDR.h" #include "ace/Service_Object.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -48,10 +49,16 @@ public: TAO::Argument * const args[], size_t nargs) = 0; + virtual void dsi_convert_request (TAO_ServerRequest & server_request, + TAO_OutputCDR & output) = 0; + virtual void convert_reply (TAO_ServerRequest & server_request, TAO::Argument * const args[], size_t nargs) = 0; + virtual void dsi_convert_reply (TAO_ServerRequest & server_request, + TAO_InputCDR & input) = 0; + virtual void handle_corba_exception (TAO_ServerRequest & server_request, CORBA::Exception *exception) = 0; }; |