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