diff options
author | dai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-08-18 17:11:43 +0000 |
---|---|---|
committer | dai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-08-18 17:11:43 +0000 |
commit | 87c85d1255524b8455f98912d1a0d17ce9ae5fac (patch) | |
tree | 07d3e23e897c85a0309b670999933b99cfb0125b /TAO/tao/DynamicInterface | |
parent | 61733d4f81a0db714a23594f8de6d30efe149061 (diff) | |
download | ATCD-87c85d1255524b8455f98912d1a0d17ce9ae5fac.tar.gz |
Fri Aug 18 17:00:15 UTC 2006 Yan Dai <dai_y@ociweb.com>
Diffstat (limited to 'TAO/tao/DynamicInterface')
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments.h | 2 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments.inl | 8 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp | 109 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h | 67 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Request.cpp | 4 |
6 files changed, 193 insertions, 3 deletions
diff --git a/TAO/tao/DynamicInterface/DII_Arguments.h b/TAO/tao/DynamicInterface/DII_Arguments.h index 6f362d7a099..fb498aa492d 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments.h +++ b/TAO/tao/DynamicInterface/DII_Arguments.h @@ -81,6 +81,8 @@ namespace TAO // deals with the argument list as a whole. void interceptor_paramlist (Dynamic::ParameterList *); + CORBA::NVList_ptr arg () const; + private: CORBA::NVList_ptr x_; diff --git a/TAO/tao/DynamicInterface/DII_Arguments.inl b/TAO/tao/DynamicInterface/DII_Arguments.inl index 265bffbf7de..5acf60d6876 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments.inl +++ b/TAO/tao/DynamicInterface/DII_Arguments.inl @@ -28,6 +28,14 @@ namespace TAO , lazy_evaluation_ (lazy_eval) { } + + ACE_INLINE + CORBA::NVList_ptr + NVList_Argument::arg () const + { + return this->x_; + } + } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp new file mode 100644 index 00000000000..c3b81769f90 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp @@ -0,0 +1,109 @@ +// $Id$ +#include "tao/DynamicInterface/DII_Arguments_Converter_Impl.h" +#include "tao/DynamicInterface/DII_Arguments.h" +#include "tao/AnyTypeCode/NVList.h" +#include "tao/AnyTypeCode/Any_Impl.h" +#include "tao/operation_details.h" + + +ACE_RCSID (DynamicInterface, + DII_Arguments_Converter_Impl, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +TAO_DII_Arguments_Converter_Impl::~TAO_DII_Arguments_Converter_Impl (void) +{ +} + + +void +TAO_DII_Arguments_Converter_Impl::convert ( + TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs + ACE_ENV_ARG_DECL + ) +{ + // The DII requests on client side always have two arguments + // - one is the return argument and the other is NVList_Argument. + // Since the argument list in the client side is used by server side + // in collocation case and the server expects the list of arguments + // and not the NVList_Argument, we need expand the NVList_Argument + // to be list of Arguments. + + // Before expanding NVList_Argument logic was added, the + // $TAO_ROOT/tests/DII_Collocated_Tests/run_test.pl should fail. + // The servant will get incorrect "IN" parameter from the oneway + // operation with single "IN" parameter and get access violation on + // get_in_arg () from the oneway operation with multiple "IN" + // parameters. + CORBA::NVList_ptr lst + = static_cast<TAO::NVList_Argument *> (server_request.operation_details ()->args()[1])->arg (); + + const CORBA::ULong sz = lst->count (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (sz != nargs - 1) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + // To avoid the use of extraction operators on CORBA::Any, we will + // marshal the arguments in the NVList into an output cdr and then + // demarshal them into the TAO::Argument array. + TAO_OutputCDR output; + for (CORBA::ULong i = 0; i < sz; ++i) + { + CORBA::NamedValue_ptr theitem = lst->item (i ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (!(theitem->value ()->impl ()->marshal_value (output))) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + } + + TAO_InputCDR input (output); + for (CORBA::ULong j = 0; j < sz; ++j) + { + if (!(args[j + 1]->demarshal (input))) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + } + + TAO_Operation_Details* details + = const_cast <TAO_Operation_Details*> (server_request.operation_details ()); + + // The NVList_Argument in operation details is converted to skel + // args, the invocation of the dii collocation requests should use + // the skel args and not use the stub args. + details->use_stub_args (false); +} + + +// ********************************************************************* + +// Initialization and registration of dynamic service object. + +int +TAO_DII_Arguments_Converter_Impl::Initializer (void) +{ + return ACE_Service_Config::process_directive (ace_svc_desc_TAO_DII_Arguments_Converter_Impl); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DEFINE ( + TAO_DII_Arguments_Converter_Impl, + ACE_TEXT ("DII_Arguments_Converter"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_DII_Arguments_Converter_Impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + +ACE_FACTORY_DEFINE (TAO_DynamicInterface, TAO_DII_Arguments_Converter_Impl) + diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h new file mode 100644 index 00000000000..de3811aa705 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DII_Arguments_Converter_Impl.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_DII_ARGUMENTS_CONVERTER_IMPL_H +#define TAO_DII_ARGUMENTS_CONVERTER_IMPL_H + +#include /**/ "ace/pre.h" + +#include "tao/DynamicInterface/dynamicinterface_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/DII_Arguments_Converter.h" + +#include "ace/Service_Config.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +/** + * @class DII_Arguments_Converter_Impl + * + * @brief DII_Arguments_Converter_Impl. + * + * This class provides the implementation to expand the DII arguments in NVList + * to the list of arguments. + */ +class TAO_DynamicInterface_Export TAO_DII_Arguments_Converter_Impl + : public TAO_DII_Arguments_Converter +{ +public: + virtual ~TAO_DII_Arguments_Converter_Impl (void); + + virtual void convert ( TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs + ACE_ENV_ARG_DECL ); + + // Used to force the initialization of the ORB code. + static int Initializer (void); +}; + +static int +TAO_Requires_DII_Arguments_Converter_Initializer = + TAO_DII_Arguments_Converter_Impl::Initializer (); + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE (TAO_DII_Arguments_Converter_Impl) +ACE_FACTORY_DECLARE (TAO_DynamicInterface, TAO_DII_Arguments_Converter_Impl) + + +#include /**/ "ace/post.h" + +#endif /* TAO_DII_ARGUMENTS_CONVERTER_IMPL_H */ diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index c65c9ee547d..441c1df2f92 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -38,7 +38,8 @@ namespace TAO op_len, 0, // Collocation Proxy broker pointer TAO_TWOWAY_INVOCATION, - mode) + mode, + true) // is a dii request , exception_list_ (excp) , request_ (r) { @@ -118,7 +119,8 @@ namespace TAO op_len, b, TAO_TWOWAY_INVOCATION, - mode) + mode, + true) // is a dii request , request_ (req) , rd_ (0) , orb_core_ (oc) diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp index 9027cecb530..799870a0f64 100644 --- a/TAO/tao/DynamicInterface/Request.cpp +++ b/TAO/tao/DynamicInterface/Request.cpp @@ -217,7 +217,9 @@ CORBA::Request::send_oneway (ACE_ENV_SINGLE_ARG_DECL) this->opname_, static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 0, - TAO::TAO_ONEWAY_INVOCATION); + TAO::TAO_ONEWAY_INVOCATION, + TAO::TAO_SYNCHRONOUS_INVOCATION, + true); // is_dii_request _tao_call.invoke (0, 0 |