#include <Server_Request.h>
Collaboration diagram for CORBA::ServerRequest:
Public Types | |
typedef CORBA::ServerRequest_ptr | _ptr_type |
Useful for template programming. | |
typedef CORBA::ServerRequest_var | _var_type |
typedef CORBA::ServerRequest_out | _out_type |
Public Member Functions | |
ServerRequest (TAO_ServerRequest &orb_server_request) | |
Constructor. | |
~ServerRequest (void) | |
Destructor. | |
void | arguments (CORBA::NVList_ptr &list) |
void | set_result (const CORBA::Any &value) |
void | set_exception (const CORBA::Any &value) |
void | dsi_marshal (void) |
Marshal outgoing parameters. | |
CORBA::Context_ptr | ctx (void) const |
Accessor for the Context member. | |
void | ctx (CORBA::Context_ptr) |
Mutator for the Context member. | |
const char * | operation (void) const |
Get the operation name. | |
CORBA::ULong | _incr_refcnt (void) |
CORBA::ULong | _decr_refcnt (void) |
void | _tao_lazy_evaluation (bool lazy_evaluation) |
Set the lazy evaluation flag. | |
int | _tao_incoming_byte_order (void) const |
Get the byte order of the incoming CDR stream. | |
void | _tao_reply_byte_order (int byte_order) |
Set the byte order of the outgoing CDR stream. | |
TAO_ServerRequest & | _tao_server_request (void) |
Return a reference to the underlying TAO_ServerRequest object. | |
void | gateway_exception_reply (ACE_CString &raw_exception) |
Static Public Member Functions | |
static ServerRequest_ptr | _duplicate (ServerRequest_ptr) |
static ServerRequest_ptr | _nil (void) |
Private Attributes | |
bool | lazy_evaluation_ |
If zero then the NVList is evaluated ASAP. | |
CORBA::Context_ptr | ctx_ |
Context associated with this request. | |
CORBA::NVList_ptr | params_ |
Incoming parameters. | |
CORBA::Any_ptr | retval_ |
Return value. | |
CORBA::Any_ptr | exception_ |
Any exception which might be raised. | |
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > | refcount_ |
Reference counting. | |
TAO_ServerRequest & | orb_server_request_ |
Request from the ORB. | |
bool | sent_gateway_exception_ |
Have we sent a user exception obtained from a gateway? |
Instantiated by the POA for DSI requests and passed up to the application. Contains a reference to the instance of TAO_ServerRequest that is passed up to the POA from the ORB.
Definition at line 66 of file Server_Request.h.
Definition at line 142 of file Server_Request.h.
Definition at line 141 of file Server_Request.h.
CORBA::ServerRequest::ServerRequest | ( | TAO_ServerRequest & | orb_server_request | ) |
Constructor.
Definition at line 47 of file Server_Request.cpp.
References TAO_ServerRequest::is_dsi(), and orb_server_request_.
00048 : lazy_evaluation_ (0), 00049 ctx_ (CORBA::Context::_nil ()), 00050 params_ (CORBA::NVList::_nil ()), 00051 retval_ (0), 00052 exception_ (0), 00053 refcount_ (1), 00054 orb_server_request_ (orb_server_request), 00055 sent_gateway_exception_ (false) 00056 { 00057 this->orb_server_request_.is_dsi (); 00058 }
CORBA::ServerRequest::~ServerRequest | ( | void | ) |
Destructor.
Definition at line 60 of file Server_Request.cpp.
References exception_, params_, release(), and retval_.
00061 { 00062 if (this->params_ != 0) 00063 { 00064 ::CORBA::release (this->params_); 00065 } 00066 00067 delete this->retval_; 00068 delete this->exception_; 00069 }
CORBA::ULong CORBA::ServerRequest::_decr_refcnt | ( | void | ) |
Definition at line 37 of file Server_Request.cpp.
References refcount_.
Referenced by TAO_Dynamic_Adapter_Impl::server_request_release().
00038 { 00039 CORBA::ULong const new_count = --this->refcount_; 00040 00041 if (new_count == 0) 00042 delete this; 00043 00044 return new_count; 00045 }
ACE_INLINE CORBA::ServerRequest_ptr CORBA::ServerRequest::_duplicate | ( | ServerRequest_ptr | ) | [static] |
Definition at line 27 of file Server_Request.inl.
References _incr_refcnt().
00028 { 00029 if (x != 0) 00030 { 00031 x->_incr_refcnt (); 00032 } 00033 00034 return x; 00035 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL CORBA::ULong CORBA::ServerRequest::_incr_refcnt | ( | void | ) |
Definition at line 31 of file Server_Request.cpp.
References refcount_.
Referenced by _duplicate().
00032 { 00033 return ++this->refcount_; 00034 }
ACE_INLINE CORBA::ServerRequest_ptr CORBA::ServerRequest::_nil | ( | void | ) | [static] |
ACE_INLINE int CORBA::ServerRequest::_tao_incoming_byte_order | ( | void | ) | const |
Get the byte order of the incoming CDR stream.
Definition at line 68 of file Server_Request.inl.
References ACE_InputCDR::byte_order(), TAO_ServerRequest::incoming(), and orb_server_request_.
00069 { 00070 return this->orb_server_request_.incoming ()->byte_order (); 00071 }
ACE_INLINE void CORBA::ServerRequest::_tao_lazy_evaluation | ( | bool | lazy_evaluation | ) |
Set the lazy evaluation flag.
Definition at line 62 of file Server_Request.inl.
References lazy_evaluation_.
00063 { 00064 this->lazy_evaluation_ = lazy_evaluation; 00065 }
ACE_INLINE void CORBA::ServerRequest::_tao_reply_byte_order | ( | int | byte_order | ) |
Set the byte order of the outgoing CDR stream.
Definition at line 74 of file Server_Request.inl.
References orb_server_request_, TAO_ServerRequest::outgoing(), and ACE_OutputCDR::reset_byte_order().
00075 { 00076 this->orb_server_request_.outgoing ()->reset_byte_order (byte_order); 00077 }
ACE_INLINE TAO_ServerRequest & CORBA::ServerRequest::_tao_server_request | ( | void | ) |
Return a reference to the underlying TAO_ServerRequest object.
Definition at line 81 of file Server_Request.inl.
References orb_server_request_.
00082 { 00083 return this->orb_server_request_; 00084 }
void CORBA::ServerRequest::arguments | ( | CORBA::NVList_ptr & | list | ) |
Implementation uses this to provide the ORB with the operation's parameter list ... on return, their values are available; the list fed in has typecodes and (perhap) memory assigned.
Definition at line 74 of file Server_Request.cpp.
References TAO_Operation_Details::cac(), CORBA::COMPLETED_NO, TAO_ServerRequest::dsi_nvlist_align(), lazy_evaluation_, CORBA::OMGVMCID, TAO_ServerRequest::operation_details(), orb_server_request_, and params_.
00075 { 00076 // arguments() must be called before either of these. 00077 if (this->params_ != 0 || this->exception_ != 0) 00078 { 00079 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO); 00080 } 00081 00082 // In a collocated situation there will not be an incoming CDR stream 00083 // in which case we can get the arguments from the 00084 // operation_details using the 'collocated argument converter'. 00085 if (this->orb_server_request_.collocated ()) 00086 { 00087 this->params_ = list; 00088 00089 if (this->orb_server_request_.operation_details ()->cac () != 0) 00090 { 00091 TAO_OutputCDR output; 00092 this->orb_server_request_.operation_details ()->cac ( 00093 )->dsi_convert_request (this->orb_server_request_, 00094 output); 00095 00096 TAO_InputCDR input(output); 00097 this->params_->_tao_decode (input, CORBA::ARG_IN | CORBA::ARG_INOUT); 00098 } 00099 } 00100 else 00101 { 00102 // Save params for later use when marshaling the reply. 00103 this->params_ = list; 00104 00105 this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), 00106 CORBA::ARG_IN | CORBA::ARG_INOUT, 00107 this->lazy_evaluation_); 00108 00109 // Pass this alignment back to the TAO_ServerRequest. 00110 this->orb_server_request_.dsi_nvlist_align ( 00111 this->params_->_tao_target_alignment ()); 00112 } 00113 }
ACE_INLINE void CORBA::ServerRequest::ctx | ( | CORBA::Context_ptr | ) |
ACE_INLINE CORBA::Context_ptr CORBA::ServerRequest::ctx | ( | void | ) | const |
void CORBA::ServerRequest::dsi_marshal | ( | void | ) |
Marshal outgoing parameters.
Definition at line 166 of file Server_Request.cpp.
References TAO_ServerRequest::argument_flag(), TAO_Operation_Details::cac(), exception_, TAO_ServerRequest::init_reply(), NO_EXCEPTION, TAO_ServerRequest::operation_details(), orb_server_request_, params_, retval_, TAO_ServerRequest::tao_send_reply(), and USER_EXCEPTION.
Referenced by TAO_DynamicImplementation::_dispatch().
00167 { 00168 // There was a user exception, no need to marshal any parameters. 00169 if (this->sent_gateway_exception_) 00170 { 00171 return; 00172 } 00173 00174 // In a collocated situation there is no outgoing CDR stream. 00175 // So, in case of an exception we just raise the UnknownUserException 00176 // and for a regular reply we use the 'collocated argument converter'. 00177 if (this->orb_server_request_.collocated ()) 00178 { 00179 if (this->orb_server_request_.reply_status () == GIOP::USER_EXCEPTION) 00180 { 00181 throw CORBA::UnknownUserException (*this->exception_); 00182 } 00183 else if (this->orb_server_request_.operation_details ()->cac () != 0) 00184 { 00185 TAO_OutputCDR output; 00186 // marshal the return value if any 00187 if (this->retval_ != 0) 00188 { 00189 this->retval_->impl ()->marshal_value (output); 00190 } 00191 00192 // marshal the "inout" and "out" parameters. 00193 if (this->params_ != 0) 00194 { 00195 this->params_->_tao_encode ( 00196 output, 00197 CORBA::ARG_INOUT | CORBA::ARG_OUT); 00198 } 00199 00200 TAO_InputCDR input (output); 00201 // set reply parameters 00202 this->orb_server_request_.operation_details ()->cac ( 00203 )->dsi_convert_reply (this->orb_server_request_, 00204 input); 00205 } 00206 } 00207 else 00208 { 00209 if (this->orb_server_request_.reply_status () == GIOP::NO_EXCEPTION) 00210 { 00211 // In DSI, we can't rely on the skeleton to do this. 00212 if (this->retval_ == 0 && this->params_ == 0) 00213 { 00214 this->orb_server_request_.argument_flag (false); 00215 } 00216 00217 this->orb_server_request_.init_reply (); 00218 00219 // Send the return value, if any. 00220 if (this->retval_ != 0) 00221 { 00222 this->retval_->impl ()->marshal_value ( 00223 *this->orb_server_request_.outgoing ()); 00224 } 00225 00226 // Send the "inout" and "out" parameters. 00227 if (this->params_ != 0) 00228 { 00229 this->params_->_tao_encode ( 00230 *this->orb_server_request_.outgoing (), 00231 CORBA::ARG_INOUT | CORBA::ARG_OUT); 00232 } 00233 } 00234 else 00235 { 00236 // This defaults to true, but just to be safe... 00237 this->orb_server_request_.argument_flag (true); 00238 00239 // Write the reply header to the ORB request's outgoing CDR stream. 00240 this->orb_server_request_.init_reply (); 00241 00242 this->exception_->impl ()->marshal_value ( 00243 *this->orb_server_request_.outgoing ()); 00244 } 00245 } 00246 00247 this->orb_server_request_.tao_send_reply (); 00248 }
void CORBA::ServerRequest::gateway_exception_reply | ( | ACE_CString & | raw_exception | ) |
Returns a user exception through a TAO gateway without knowing its type.
Definition at line 251 of file Server_Request.cpp.
References TAO_ServerRequest::argument_flag(), ACE_String_Base< CHAR >::fast_rep(), TAO_ServerRequest::init_reply(), ACE_String_Base< CHAR >::length(), ACE_CDR::MAX_ALIGNMENT, orb_server_request_, TAO_ServerRequest::outgoing(), TAO_ServerRequest::reply_status(), sent_gateway_exception_, TAO_ServerRequest::tao_send_reply(), USER_EXCEPTION, and ACE_OutputCDR::write_octet_array().
00252 { 00253 // This defaults to 1, but just to be safe... 00254 this->orb_server_request_.argument_flag (true); 00255 00256 // This reply path handles only user exceptions. 00257 this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION); 00258 00259 this->orb_server_request_.init_reply (); 00260 00261 // We know nothing about this exception, so we marshal it as a block 00262 // of bytes. The outgoing stream's byte order has already been matched 00263 // to the original source of the reply. 00264 this->orb_server_request_.outgoing ()->write_octet_array ( 00265 reinterpret_cast<const CORBA::Octet *> (raw_exception.fast_rep ()), 00266 static_cast<CORBA::ULong> (raw_exception.length () + ACE_CDR::MAX_ALIGNMENT) 00267 ); 00268 00269 // This will prevent the marshaling of any parameters into this reply. 00270 this->sent_gateway_exception_ = true; 00271 00272 this->orb_server_request_.tao_send_reply (); 00273 }
ACE_INLINE const char * CORBA::ServerRequest::operation | ( | void | ) | const |
Get the operation name.
Definition at line 56 of file Server_Request.inl.
References TAO_ServerRequest::operation(), and orb_server_request_.
00057 { 00058 return this->orb_server_request_.operation (); 00059 }
void CORBA::ServerRequest::set_exception | ( | const CORBA::Any & | value | ) |
Implementation uses this to provide the exception value which is the only result of this particular invocation.
XXX Implementation should be able to assume response has been sent when this returns, and reclaim memory it allocated.
Definition at line 143 of file Server_Request.cpp.
References ACE_NEW_THROW_EX, CORBA::COMPLETED_MAYBE, CORBA::OMGVMCID, orb_server_request_, TAO_ServerRequest::reply_status(), CORBA::tk_except, and USER_EXCEPTION.
00144 { 00145 CORBA::TypeCode_var tc = value.type (); 00146 00147 CORBA::TCKind const kind = tc->kind (); 00148 00149 // set_exception() can be called at any time, but the Any arg MUST 00150 // contain an exception. 00151 if (kind != CORBA::tk_except) 00152 { 00153 throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 21, CORBA::COMPLETED_MAYBE); 00154 } 00155 00156 ACE_NEW_THROW_EX (this->exception_, 00157 CORBA::Any (value), 00158 CORBA::NO_MEMORY ()); 00159 00160 this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION); 00161 }
void CORBA::ServerRequest::set_result | ( | const CORBA::Any & | value | ) |
Implementation uses this to provide the operation result ... illegal if exception() was called or params() was not called.
XXX Implementation should be able to assume response has been sent when this returns, and reclaim memory it allocated.
Definition at line 119 of file Server_Request.cpp.
References ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, and CORBA::OMGVMCID.
00121 { 00122 // Setting a result when another result already exists or if an exception 00123 // exists or before the args have been processeed is an error. 00124 if (this->retval_ != 0 || this->exception_ != 0 || this->params_ == 0) 00125 { 00126 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); 00127 } 00128 00129 ACE_NEW_THROW_EX (this->retval_, 00130 CORBA::Any (value), 00131 CORBA::NO_MEMORY ()); 00132 }
CORBA::Context_ptr CORBA::ServerRequest::ctx_ [private] |
Context associated with this request.
Definition at line 149 of file Server_Request.h.
Referenced by ctx().
Any exception which might be raised.
Definition at line 158 of file Server_Request.h.
Referenced by dsi_marshal(), and ~ServerRequest().
bool CORBA::ServerRequest::lazy_evaluation_ [private] |
If zero then the NVList is evaluated ASAP.
Definition at line 146 of file Server_Request.h.
Referenced by _tao_lazy_evaluation(), and arguments().
Definition at line 164 of file Server_Request.h.
Referenced by _tao_incoming_byte_order(), _tao_reply_byte_order(), _tao_server_request(), arguments(), dsi_marshal(), gateway_exception_reply(), operation(), ServerRequest(), and set_exception().
Incoming parameters.
Definition at line 152 of file Server_Request.h.
Referenced by arguments(), dsi_marshal(), and ~ServerRequest().
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> CORBA::ServerRequest::refcount_ [private] |
Reference counting.
Definition at line 161 of file Server_Request.h.
Referenced by _decr_refcnt(), and _incr_refcnt().
CORBA::Any_ptr CORBA::ServerRequest::retval_ [private] |
Return value.
Definition at line 155 of file Server_Request.h.
Referenced by dsi_marshal(), and ~ServerRequest().
bool CORBA::ServerRequest::sent_gateway_exception_ [private] |
Have we sent a user exception obtained from a gateway?
Definition at line 167 of file Server_Request.h.
Referenced by gateway_exception_reply().