TAO_AMH_DSI_Response_Handler Class Reference

This is the main class for DSI using AMH. More...

#include <AMH_DSI_Response_Handler.h>

Collaboration diagram for TAO_AMH_DSI_Response_Handler:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_AMH_DSI_Response_Handler_ptr _ptr_type
typedef TAO_AMH_DSI_Response_Handler_var _var_type

Public Member Functions

 TAO_AMH_DSI_Response_Handler (TAO_ServerRequest &sr)
 ~TAO_AMH_DSI_Response_Handler (void)
virtual void invoke_reply (CORBA::NVList_ptr args, CORBA::NamedValue_ptr result)
virtual void invoke_excep (TAO_AMH_DSI_Exception_Holder *h)
virtual void gateway_exception_reply (CORBA::ULong reply_status, TAO_OutputCDR &encap)
virtual void gateway_exception_reply (CORBA::ULong reply_status, TAO_InputCDR &encap)
CORBA::Object_ptr _this ()
 Returns a CORBA::Object_ptr for the target object.


Static Public Member Functions

TAO_AMH_DSI_Response_Handler_duplicate (TAO_AMH_DSI_Response_Handler_ptr)
 CORBA Object related methods.

TAO_AMH_DSI_Response_Handler_nil (void)
TAO_AMH_DSI_Response_Handler_narrow (CORBA::Object_ptr)
TAO_AMH_DSI_Response_Handler_unchecked_narrow (CORBA::Object_ptr)

Protected Member Functions

virtual const char * _interface_repository_id (void) const
 Return 0. Should never be used.

virtual void * _downcast (const char *repository_id)
 Simply returns "this".


Private Attributes

TAO_ORB_Coreorb_core_

Detailed Description

This is the main class for DSI using AMH.

With ordinary DSI, the POA calls _dispatch, which in turn calls invoke on the DSI handler. Invoke completely handles the request, and packages the result in the request object so that it can be marshalled and sent back to the caller.

With the AMH variation, the DSI handler's invoke method starts the processing, but delegates the result packaging to a response handler. This way, if the invocation takes a long time, or involves blocking calls, then the result handling can be managed by another thread. This is particularly useful for gateway implementations, where the middle tier should not have to block waiting for replies.

As this is built on the CORBA object model, there are separate classes representing the interface and the implementation.

Definition at line 213 of file AMH_DSI_Response_Handler.h.


Member Typedef Documentation

typedef TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_ptr_type
 

Definition at line 217 of file AMH_DSI_Response_Handler.h.

typedef TAO_AMH_DSI_Response_Handler_var TAO_AMH_DSI_Response_Handler::_var_type
 

Definition at line 218 of file AMH_DSI_Response_Handler.h.


Constructor & Destructor Documentation

TAO_AMH_DSI_Response_Handler::TAO_AMH_DSI_Response_Handler TAO_ServerRequest sr  ) 
 

Definition at line 314 of file AMH_DSI_Response_Handler.cpp.

00316   : TAO_AMH_Response_Handler (),
00317     orb_core_ (sr.orb_core ())
00318 {
00319 }

TAO_AMH_DSI_Response_Handler::~TAO_AMH_DSI_Response_Handler void   ) 
 

Definition at line 321 of file AMH_DSI_Response_Handler.cpp.

00322 {
00323 }


Member Function Documentation

void * TAO_AMH_DSI_Response_Handler::_downcast const char *  repository_id  )  [protected, virtual]
 

Simply returns "this".

Definition at line 455 of file AMH_DSI_Response_Handler.cpp.

00456 {
00457   return this;
00458 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_duplicate TAO_AMH_DSI_Response_Handler_ptr   )  [static]
 

CORBA Object related methods.

Definition at line 7 of file AMH_DSI_Response_Handler.inl.

References TAO_AMH_DSI_Response_Handler_ptr.

Referenced by TAO_AMH_DSI_Response_Handler_var::operator=().

00008 {
00009   if (x != 0)
00010     {
00011       x->_add_ref ();
00012     }
00013 
00014   return x;
00015 }

const char * TAO_AMH_DSI_Response_Handler::_interface_repository_id void   )  const [protected, virtual]
 

Return 0. Should never be used.

Definition at line 476 of file AMH_DSI_Response_Handler.cpp.

00477 {
00478   return 0;
00479 }

TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_narrow CORBA::Object_ptr   )  [static]
 

Definition at line 461 of file AMH_DSI_Response_Handler.cpp.

References _unchecked_narrow().

00462 {
00463   return TAO_AMH_DSI_Response_Handler::_unchecked_narrow (obj);
00464 }

TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_nil void   )  [static]
 

Definition at line 308 of file AMH_DSI_Response_Handler.cpp.

References TAO_AMH_DSI_Response_Handler_ptr.

Referenced by TAO_AMH_DSI_Response_Handler_var::_retn(), _unchecked_narrow(), and TAO_AMH_DSI_Response_Handler_var::out().

00309 {
00310   return (TAO_AMH_DSI_Response_Handler_ptr) 0;
00311 }

CORBA::Object_ptr TAO_AMH_DSI_Response_Handler::_this  ) 
 

Returns a CORBA::Object_ptr for the target object.

TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_unchecked_narrow CORBA::Object_ptr   )  [static]
 

Definition at line 467 of file AMH_DSI_Response_Handler.cpp.

References _nil(), and CORBA::is_nil().

Referenced by _narrow().

00468 {
00469   if (CORBA::is_nil (obj))
00470     return TAO_AMH_DSI_Response_Handler::_nil ();
00471 
00472   return dynamic_cast < TAO_AMH_DSI_Response_Handler_ptr > (obj);
00473 }

void TAO_AMH_DSI_Response_Handler::gateway_exception_reply CORBA::ULong  reply_status,
TAO_InputCDR encap
[virtual]
 

Definition at line 410 of file AMH_DSI_Response_Handler.cpp.

References ACE_InputCDR::byte_order(), ACE_InputCDR::start(), TAO_GIOP_SYSTEM_EXCEPTION, and TAO_GIOP_USER_EXCEPTION.

00413 {
00414   // for this to be effective, ACE & TAO must be built with
00415   // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h
00416   this->_tao_out.reset_byte_order(encap.byte_order());
00417   // This reply path handles only user exceptions.
00418   switch (reply_status)
00419     {
00420     //case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
00421     case TAO_AMI_REPLY_USER_EXCEPTION:
00422       this->exception_type_ = TAO_GIOP_USER_EXCEPTION;
00423       break;
00424     case TAO_AMI_REPLY_SYSTEM_EXCEPTION:
00425       this->exception_type_ = TAO_GIOP_SYSTEM_EXCEPTION;
00426       break;
00427 
00428     // we don't handle location forward at this moment.
00429     // need to be addressed later.
00430     //
00431     //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
00432     //  this->exception_type_ = TAO_GIOP_LOCATION_FORWARD;
00433     //  break;
00434     }
00435   try
00436   {
00437     this->_tao_rh_init_reply ();
00438 
00439   // We know nothing about this exception, so we marshal it as a block
00440   // of bytes. The outgoing stream's byte order has already been matched
00441   // to the original source of the reply.
00442     this->_tao_out.write_octet_array_mb (encap.start());
00443   // This will prevent the marshaling of any parameters into this reply.
00444   //  this->sent_gateway_exception_ = 1;
00445     this->_tao_rh_send_reply ();
00446   }
00447   catch (const CORBA::Exception &)
00448   {
00449     // TODO:
00450   }
00451 
00452 }

void TAO_AMH_DSI_Response_Handler::gateway_exception_reply CORBA::ULong  reply_status,
TAO_OutputCDR encap
[virtual]
 

Definition at line 366 of file AMH_DSI_Response_Handler.cpp.

References ACE_OutputCDR::buffer(), ACE_OutputCDR::byte_order(), ACE_OutputCDR::length(), TAO_GIOP_SYSTEM_EXCEPTION, and TAO_GIOP_USER_EXCEPTION.

00369 {
00370   // for this to be effective, ACE & TAO must be built with
00371   // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h
00372   this->_tao_out.reset_byte_order (encap.byte_order ());
00373   // This reply path handles only user exceptions.
00374   switch (reply_status)
00375     {
00376     case TAO_AMI_REPLY_USER_EXCEPTION:
00377       this->exception_type_ = TAO_GIOP_USER_EXCEPTION;
00378       break;
00379     case TAO_AMI_REPLY_SYSTEM_EXCEPTION:
00380       this->exception_type_ = TAO_GIOP_SYSTEM_EXCEPTION;
00381       break;
00382 
00383       // TODO: we don't handle location forward at this moment.
00384       // need to be addressed later.
00385       //
00386       //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
00387       //  this->exception_type_ = TAO_GIOP_LOCATION_FORWARD;
00388       //  break;
00389     }
00390   try
00391     {
00392       this->_tao_rh_init_reply ();
00393 
00394       // We know nothing about this exception, so we marshal it as a block
00395       // of bytes. The outgoing stream's byte order has already been matched
00396       // to the original source of the reply.
00397       this->_tao_out.write_char_array (encap.buffer (), encap.length ());
00398       // This will prevent the marshaling of any parameters into this reply.
00399       //  this->sent_gateway_exception_ = 1;
00400       this->_tao_rh_send_reply ();
00401     }
00402   catch (const CORBA::Exception &)
00403     {
00404       // TODO:
00405     }
00406 
00407 }

void TAO_AMH_DSI_Response_Handler::invoke_excep TAO_AMH_DSI_Exception_Holder h  )  [virtual]
 

Definition at line 353 of file AMH_DSI_Response_Handler.cpp.

References TAO_AMH_DSI_Exception_Holder::raise_invoke().

00354 {
00355   try
00356     {
00357       h->raise_invoke ();
00358     }
00359   catch (const CORBA::Exception & ex)
00360     {
00361       this->_tao_rh_send_exception (ex);
00362     }
00363 }

void TAO_AMH_DSI_Response_Handler::invoke_reply CORBA::NVList_ptr  args,
CORBA::NamedValue_ptr  result
[virtual]
 

Definition at line 326 of file AMH_DSI_Response_Handler.cpp.

00328 {
00329   try
00330    {
00331      this->_tao_rh_init_reply ();
00332 
00333     // Send the return value, if any.
00334     if (result != 0 && result->value () != 0)
00335       {
00336         result->value ()->impl ()->marshal_value (this->_tao_out);
00337       }
00338 
00339     // Send the "inout" and "out" parameters.
00340     if (args != 0)
00341       {
00342         args->_tao_encode (this->_tao_out, CORBA::ARG_INOUT | CORBA::ARG_OUT);
00343       }
00344     this->_tao_rh_send_reply ();
00345   }
00346   catch (const CORBA::Exception &)
00347     {
00348       // TODO:
00349     }
00350 }


Member Data Documentation

TAO_ORB_Core* TAO_AMH_DSI_Response_Handler::orb_core_ [private]
 

Definition at line 253 of file AMH_DSI_Response_Handler.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:37:44 2008 for TAO_DynamicInterface by doxygen 1.3.6