00001
00002
00003 #include "tao/AnyTypeCode/DynamicC.h"
00004 #include "tao/AnyTypeCode/TypeCode.h"
00005
00006 #include "tao/DynamicInterface/DII_Invocation.h"
00007 #include "tao/DynamicInterface/Unknown_User_Exception.h"
00008 #include "tao/DynamicInterface/DII_Arguments.h"
00009 #include "tao/DynamicInterface/ExceptionList.h"
00010 #include "tao/DynamicInterface/Request.h"
00011 #include "tao/DynamicInterface/DII_Reply_Dispatcher.h"
00012
00013 #include "tao/operation_details.h"
00014 #include "tao/Invocation_Utils.h"
00015 #include "tao/debug.h"
00016 #include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
00017 #include "tao/Profile_Transport_Resolver.h"
00018 #include "tao/ORB_Constants.h"
00019
00020 #include "ace/OS_NS_string.h"
00021
00022 #if TAO_HAS_INTERCEPTORS == 1
00023 # include "tao/PI/RequestInfo_Util.h"
00024 #endif
00025
00026 ACE_RCSID (DynamicInterface,
00027 DII_Invocation,
00028 "DII_Invocation.cpp,v 1.33 2006/03/10 07:19:08 jtc Exp")
00029
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031
00032 namespace TAO
00033 {
00034 DII_Invocation::DII_Invocation (CORBA::Object_ptr otarget,
00035 Profile_Transport_Resolver &resolver,
00036 TAO_Operation_Details &detail,
00037 CORBA::ExceptionList *excp,
00038 CORBA::Request_ptr req,
00039 bool response_expected)
00040 : Synch_Twoway_Invocation (otarget,
00041 resolver,
00042 detail,
00043 response_expected)
00044 , excp_list_ (excp)
00045 , host_ (req)
00046 {
00047 }
00048
00049 #if TAO_HAS_INTERCEPTORS == 1
00050 Dynamic::ParameterList *
00051 DII_Invocation::arguments (ACE_ENV_SINGLE_ARG_DECL)
00052 ACE_THROW_SPEC ((CORBA::SystemException))
00053 {
00054
00055 Dynamic::ParameterList *parameter_list =
00056 TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00057 ACE_CHECK_RETURN (0);
00058
00059 Dynamic::ParameterList_var safe_parameter_list = parameter_list;
00060
00061 TAO::Argument **args =
00062 this->details_.args ();
00063
00064 if (this->details_.args_num () > 1)
00065 {
00066
00067 TAO::NVList_Argument *tmp_arg =
00068 dynamic_cast <TAO::NVList_Argument*> (args[1]);
00069
00070 tmp_arg->interceptor_paramlist (parameter_list);
00071 }
00072
00073 return safe_parameter_list._retn ();
00074 }
00075 #endif
00076
00077 Invocation_Status
00078 DII_Invocation::remote_invocation (ACE_Time_Value *max_wait_time
00079 ACE_ENV_ARG_DECL)
00080 ACE_THROW_SPEC ((CORBA::Exception))
00081 {
00082 return Synch_Twoway_Invocation::remote_twoway (max_wait_time
00083 ACE_ENV_ARG_PARAMETER);
00084 }
00085
00086 Invocation_Status
00087 DII_Invocation::handle_user_exception (TAO_InputCDR &cdr
00088 ACE_ENV_ARG_DECL)
00089 ACE_THROW_SPEC ((CORBA::Exception))
00090 {
00091 Reply_Guard mon (this,
00092 TAO_INVOKE_FAILURE);
00093
00094 if (TAO_debug_level > 3)
00095 {
00096 ACE_DEBUG ((LM_DEBUG,
00097 "TAO (%P|%t) - DII_Invocation::"
00098 "handle_user_exception \n"));
00099 }
00100
00101
00102
00103
00104 CORBA::String_var buf;
00105
00106 TAO_InputCDR tmp_stream (cdr,
00107 cdr.start ()->length (),
00108 0);
00109
00110
00111 if (tmp_stream.read_string (buf.inout ()) == 0)
00112 {
00113 ACE_THROW_RETURN (CORBA::MARSHAL (TAO::VMCID,
00114 CORBA::COMPLETED_YES),
00115 TAO_INVOKE_FAILURE);
00116 }
00117
00118 for (CORBA::ULong i = 0;
00119 this->excp_list_ != 0 && i < this->excp_list_->count ();
00120 i++)
00121 {
00122 CORBA::TypeCode_var tc =
00123 this->excp_list_->item (i
00124 ACE_ENV_ARG_PARAMETER);
00125 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00126
00127 const char *xid = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
00128 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00129
00130 if (ACE_OS::strcmp (buf.in (), xid) != 0)
00131 {
00132 continue;
00133 }
00134
00135 CORBA::Any any;
00136 TAO::Unknown_IDL_Type *unk = 0;
00137 ACE_NEW_RETURN (unk,
00138 TAO::Unknown_IDL_Type (
00139 tc.in (),
00140 cdr
00141 ),
00142 TAO_INVOKE_FAILURE);
00143
00144 any.replace (unk);
00145
00146 mon.set_status (TAO_INVOKE_USER_EXCEPTION);
00147
00148 ACE_THROW_RETURN (CORBA::UnknownUserException (any),
00149 TAO_INVOKE_USER_EXCEPTION);
00150 }
00151
00152
00153
00154
00155
00156
00157 this->host_->raw_user_exception (cdr);
00158
00159
00160 mon.set_status (TAO_INVOKE_USER_EXCEPTION);
00161
00162
00163
00164
00165 ACE_THROW_RETURN (CORBA::UNKNOWN (TAO::VMCID,
00166 CORBA::COMPLETED_YES),
00167 TAO_INVOKE_USER_EXCEPTION);
00168
00169 }
00170
00171
00172
00173 DII_Deferred_Invocation::DII_Deferred_Invocation (
00174 CORBA::Object_ptr otarget,
00175 Profile_Transport_Resolver &resolver,
00176 TAO_Operation_Details &detail,
00177 TAO_DII_Deferred_Reply_Dispatcher *rd,
00178 CORBA::Request_ptr req,
00179 bool response_expected)
00180 : Asynch_Remote_Invocation (otarget,
00181 resolver,
00182 detail,
00183 rd,
00184 response_expected)
00185 , host_ (req)
00186 {
00187
00188 }
00189
00190 #if TAO_HAS_INTERCEPTORS == 1
00191
00192 Dynamic::ParameterList *
00193 DII_Deferred_Invocation::arguments (ACE_ENV_SINGLE_ARG_DECL)
00194 ACE_THROW_SPEC ((CORBA::SystemException))
00195 {
00196
00197 Dynamic::ParameterList *parameter_list =
00198 TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
00199 ACE_CHECK_RETURN (0);
00200
00201 Dynamic::ParameterList_var safe_parameter_list = parameter_list;
00202
00203 TAO::Argument **args =
00204 this->details_.args ();
00205
00206 if (this->details_.args_num () > 1)
00207 {
00208
00209 TAO::NVList_Argument *tmp_arg =
00210 dynamic_cast <TAO::NVList_Argument*> (args[1]);
00211
00212 tmp_arg->interceptor_paramlist (parameter_list);
00213 }
00214
00215 return safe_parameter_list._retn ();
00216 }
00217 #endif
00218
00219 Invocation_Status
00220 DII_Deferred_Invocation::remote_invocation (
00221 ACE_Time_Value *max_wait_time
00222 ACE_ENV_ARG_DECL
00223 )
00224 ACE_THROW_SPEC ((CORBA::Exception))
00225 {
00226 this->safe_rd_->transport (this->resolver_.transport ());
00227
00228 return Asynch_Remote_Invocation::remote_invocation (
00229 max_wait_time
00230 ACE_ENV_ARG_PARAMETER);
00231 }
00232 }
00233
00234 TAO_END_VERSIONED_NAMESPACE_DECL