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 invoke_location_forward (CORBA::Object_ptr fwd, CORBA::Boolean is_perm)
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

static TAO_AMH_DSI_Response_Handler_duplicate (TAO_AMH_DSI_Response_Handler_ptr)
 CORBA Object related methods.
static TAO_AMH_DSI_Response_Handler_nil (void)
static TAO_AMH_DSI_Response_Handler_narrow (CORBA::Object_ptr)
static 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 209 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 213 of file AMH_DSI_Response_Handler.h.

typedef TAO_AMH_DSI_Response_Handler_var TAO_AMH_DSI_Response_Handler::_var_type

Definition at line 214 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 310 of file AMH_DSI_Response_Handler.cpp.

00312   : TAO_AMH_Response_Handler (),
00313     orb_core_ (sr.orb_core ())
00314 {
00315 }

TAO_AMH_DSI_Response_Handler::~TAO_AMH_DSI_Response_Handler ( void   ) 

Definition at line 317 of file AMH_DSI_Response_Handler.cpp.

00318 {
00319 }


Member Function Documentation

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

Simply returns "this".

Definition at line 458 of file AMH_DSI_Response_Handler.cpp.

00459 {
00460   return this;
00461 }

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.

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 479 of file AMH_DSI_Response_Handler.cpp.

00480 {
00481   return 0;
00482 }

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

Definition at line 464 of file AMH_DSI_Response_Handler.cpp.

References _unchecked_narrow().

00465 {
00466   return TAO_AMH_DSI_Response_Handler::_unchecked_narrow (obj);
00467 }

TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_nil ( void   )  [static]

Definition at line 304 of file AMH_DSI_Response_Handler.cpp.

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

00305 {
00306   return (TAO_AMH_DSI_Response_Handler_ptr) 0;
00307 }

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 470 of file AMH_DSI_Response_Handler.cpp.

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

Referenced by _narrow().

00471 {
00472   if (CORBA::is_nil (obj))
00473     return TAO_AMH_DSI_Response_Handler::_nil ();
00474 
00475   return dynamic_cast < TAO_AMH_DSI_Response_Handler_ptr > (obj);
00476 }

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

Definition at line 413 of file AMH_DSI_Response_Handler.cpp.

References ACE_InputCDR::byte_order(), ACE_InputCDR::start(), SYSTEM_EXCEPTION, and USER_EXCEPTION.

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

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

Definition at line 369 of file AMH_DSI_Response_Handler.cpp.

References ACE_OutputCDR::buffer(), ACE_OutputCDR::byte_order(), ACE_OutputCDR::length(), SYSTEM_EXCEPTION, and USER_EXCEPTION.

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

void TAO_AMH_DSI_Response_Handler::invoke_excep ( TAO_AMH_DSI_Exception_Holder h  )  [virtual]

Definition at line 349 of file AMH_DSI_Response_Handler.cpp.

References TAO_AMH_DSI_Exception_Holder::raise_invoke().

00350 {
00351   try
00352     {
00353       h->raise_invoke ();
00354     }
00355   catch (const CORBA::Exception & ex)
00356     {
00357       this->_tao_rh_send_exception (ex);
00358     }
00359 }

void TAO_AMH_DSI_Response_Handler::invoke_location_forward ( CORBA::Object_ptr  fwd,
CORBA::Boolean  is_perm 
) [virtual]

Definition at line 362 of file AMH_DSI_Response_Handler.cpp.

00364 {
00365   this->_tao_rh_send_location_forward (fwd,is_perm);
00366 }

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

Definition at line 322 of file AMH_DSI_Response_Handler.cpp.

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


Member Data Documentation

TAO_ORB_Core* TAO_AMH_DSI_Response_Handler::orb_core_ [private]

Definition at line 252 of file AMH_DSI_Response_Handler.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:43:29 2010 for TAO_DynamicInterface by  doxygen 1.4.7