#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 | |
ServerRequest_ptr | _duplicate (ServerRequest_ptr) |
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. |
|
Useful for template programming.
Definition at line 140 of file Server_Request.h. |
|
Definition at line 141 of file Server_Request.h. |
|
Constructor.
Definition at line 43 of file Server_Request.cpp. References TAO_ServerRequest::is_dsi(), and orb_server_request_.
00044 : lazy_evaluation_ (0), 00045 ctx_ (CORBA::Context::_nil ()), 00046 params_ (CORBA::NVList::_nil ()), 00047 retval_ (0), 00048 exception_ (0), 00049 refcount_ (1), 00050 orb_server_request_ (orb_server_request), 00051 sent_gateway_exception_ (false) 00052 { 00053 this->orb_server_request_.is_dsi (); 00054 } |
|
Destructor.
Definition at line 56 of file Server_Request.cpp. References params_, and retval_.
00057 { 00058 if (this->params_ != 0) 00059 { 00060 ::CORBA::release (this->params_); 00061 } 00062 00063 delete this->retval_; 00064 delete this->exception_; 00065 } |
|
Definition at line 33 of file Server_Request.cpp.
00034 { 00035 CORBA::ULong const new_count = --this->refcount_; 00036 00037 if (new_count == 0) 00038 delete this; 00039 00040 return new_count; 00041 } |
|
Definition at line 27 of file Server_Request.inl.
00028 { 00029 if (x != 0) 00030 { 00031 x->_incr_refcnt (); 00032 } 00033 00034 return x; 00035 } |
|
Definition at line 27 of file Server_Request.cpp.
00028 { 00029 return ++this->refcount_; 00030 } |
|
Definition at line 38 of file Server_Request.inl.
00039 {
00040 return static_cast <CORBA::ServerRequest_ptr>(0);
00041 }
|
|
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 } |
|
Set the lazy evaluation flag.
Definition at line 62 of file Server_Request.inl.
00063 { 00064 this->lazy_evaluation_ = lazy_evaluation; 00065 } |
|
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 } |
|
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 } |
|
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 70 of file Server_Request.cpp. References TAO_ServerRequest::dsi_nvlist_align(), orb_server_request_, and params_.
00071 { 00072 // arguments() must be called before either of these. 00073 if (this->params_ != 0 || this->exception_ != 0) 00074 { 00075 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO); 00076 } 00077 00078 // Save params for later use when marshaling the reply. 00079 this->params_ = list; 00080 00081 this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), 00082 CORBA::ARG_IN | CORBA::ARG_INOUT, 00083 this->lazy_evaluation_); 00084 00085 // Pass this alignment back to the TAO_ServerRequest. 00086 this->orb_server_request_.dsi_nvlist_align ( 00087 this->params_->_tao_target_alignment ()); 00088 } |
|
Mutator for the Context member.
Definition at line 50 of file Server_Request.inl.
00051 { 00052 this->ctx_ = ctx; 00053 } |
|
Accessor for the Context member.
Definition at line 44 of file Server_Request.inl.
00045 { 00046 return this->ctx_; 00047 } |
|
Marshal outgoing parameters.
Definition at line 141 of file Server_Request.cpp. References TAO_ServerRequest::argument_flag(), TAO_ServerRequest::exception_type(), TAO_ServerRequest::init_reply(), orb_server_request_, params_, retval_, sent_gateway_exception_, TAO_GIOP_NO_EXCEPTION, and TAO_ServerRequest::tao_send_reply(). Referenced by TAO_DynamicImplementation::_dispatch().
00142 { 00143 // There was a user exception, no need to marshal any parameters. 00144 if (this->sent_gateway_exception_) 00145 { 00146 return; 00147 } 00148 00149 if (this->orb_server_request_.exception_type () == TAO_GIOP_NO_EXCEPTION) 00150 { 00151 // In DSI, we can't rely on the skeleton to do this. 00152 if (this->retval_ == 0 && this->params_ == 0) 00153 { 00154 this->orb_server_request_.argument_flag (0); 00155 } 00156 00157 this->orb_server_request_.init_reply (); 00158 00159 // Send the return value, if any. 00160 if (this->retval_ != 0) 00161 { 00162 this->retval_->impl ()->marshal_value ( 00163 *this->orb_server_request_.outgoing ()); 00164 } 00165 00166 // Send the "inout" and "out" parameters. 00167 if (this->params_ != 0) 00168 { 00169 this->params_->_tao_encode ( 00170 *this->orb_server_request_.outgoing (), 00171 CORBA::ARG_INOUT | CORBA::ARG_OUT); 00172 } 00173 } 00174 else 00175 { 00176 // This defaults to 1, but just to be safe... 00177 this->orb_server_request_.argument_flag (1); 00178 00179 // Write the reply header to the ORB request's outgoing CDR stream. 00180 this->orb_server_request_.init_reply (); 00181 00182 this->exception_->impl ()->marshal_value ( 00183 *this->orb_server_request_.outgoing ()); 00184 } 00185 00186 this->orb_server_request_.tao_send_reply (); 00187 } |
|
Returns a user exception through a TAO gateway without knowing its type. Definition at line 190 of file Server_Request.cpp. References TAO_ServerRequest::argument_flag(), TAO_ServerRequest::exception_type(), TAO_ServerRequest::init_reply(), orb_server_request_, TAO_ServerRequest::outgoing(), sent_gateway_exception_, TAO_GIOP_USER_EXCEPTION, TAO_ServerRequest::tao_send_reply(), and ACE_OutputCDR::write_octet_array().
00191 { 00192 // This defaults to 1, but just to be safe... 00193 this->orb_server_request_.argument_flag (1); 00194 00195 // This reply path handles only user exceptions. 00196 this->orb_server_request_.exception_type (TAO_GIOP_USER_EXCEPTION); 00197 00198 this->orb_server_request_.init_reply (); 00199 00200 // We know nothing about this exception, so we marshal it as a block 00201 // of bytes. The outgoing stream's byte order has already been matched 00202 // to the original source of the reply. 00203 this->orb_server_request_.outgoing ()->write_octet_array ( 00204 reinterpret_cast<const CORBA::Octet *> (raw_exception.fast_rep ()), 00205 static_cast<CORBA::ULong> (raw_exception.length () + ACE_CDR::MAX_ALIGNMENT) 00206 ); 00207 00208 // This will prevent the marshaling of any parameters into this reply. 00209 this->sent_gateway_exception_ = true; 00210 00211 this->orb_server_request_.tao_send_reply (); 00212 } |
|
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 } |
|
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 118 of file Server_Request.cpp. References ACE_NEW_THROW_EX, TAO_ServerRequest::exception_type(), orb_server_request_, and TAO_GIOP_USER_EXCEPTION.
00119 { 00120 CORBA::TypeCode_var tc = value.type (); 00121 00122 CORBA::TCKind const kind = tc->kind (); 00123 00124 // set_exception() can be called at any time, but the Any arg MUST 00125 // contain an exception. 00126 if (kind != CORBA::tk_except) 00127 { 00128 throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 21, CORBA::COMPLETED_MAYBE); 00129 } 00130 00131 ACE_NEW_THROW_EX (this->exception_, 00132 CORBA::Any (value), 00133 CORBA::NO_MEMORY ()); 00134 00135 this->orb_server_request_.exception_type (TAO_GIOP_USER_EXCEPTION); 00136 } |
|
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 94 of file Server_Request.cpp. References ACE_NEW_THROW_EX, params_, and retval_.
00096 { 00097 // Setting a result when another result already exists or if an exception 00098 // exists or before the args have been processeed is an error. 00099 if (this->retval_ != 0 || this->exception_ != 0 || this->params_ == 0) 00100 { 00101 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); 00102 } 00103 00104 ACE_NEW_THROW_EX (this->retval_, 00105 CORBA::Any (value), 00106 CORBA::NO_MEMORY ()); 00107 } |
|
Context associated with this request.
Definition at line 149 of file Server_Request.h. |
|
Any exception which might be raised.
Definition at line 158 of file Server_Request.h. |
|
If zero then the NVList is evaluated ASAP.
Definition at line 146 of file Server_Request.h. |
|
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(), set_result(), and ~ServerRequest(). |
|
Reference counting.
Definition at line 161 of file Server_Request.h. |
|
Return value.
Definition at line 155 of file Server_Request.h. Referenced by dsi_marshal(), set_result(), and ~ServerRequest(). |
|
Have we sent a user exception obtained from a gateway?
Definition at line 167 of file Server_Request.h. Referenced by dsi_marshal(), and gateway_exception_reply(). |