2 //=============================================================================
6 * @brief This class implements ImR's forwarding ServantLocator
8 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
9 * @author Priyanka Gontla <pgontla@doc.ece.uci.edu>
11 //=============================================================================
13 #ifndef IMR_FORWARDER_H
14 #define IMR_FORWARDER_H
16 #include "tao/PortableServer/PortableServer.h"
17 #include "tao/PortableServer/ServantLocatorC.h"
18 #include "tao/DynamicInterface/Dynamic_Implementation.h"
19 #include "tao/DynamicInterface/AMH_DSI_Response_Handler.h"
20 #include "tao/Messaging/Messaging.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "tao/LocalObject.h"
27 #include "ImR_ResponseHandler.h"
28 #include "locator_export.h"
32 //----------------------------------------------------------------------------
34 * @class ImR_DSI_ReplyHandler
36 * @brief specialized reply handler for forward requests that need to send an
39 * Used to send either a Location_Forward exception, or some other error
43 // forward declare the types used to manage AMH/DSI coupling
44 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
45 class TAO_AMH_DSI_Response_Handler
;
46 typedef TAO_AMH_DSI_Response_Handler
* TAO_AMH_DSI_Response_Handler_ptr
;
47 class TAO_AMH_DSI_Response_Handler_var
;
48 TAO_END_VERSIONED_NAMESPACE_DECL
50 class ImR_DSI_ResponseHandler
: public ImR_ResponseHandler
53 ImR_DSI_ResponseHandler (const char *key
,
54 const char *server_name
,
56 TAO_AMH_DSI_Response_Handler_ptr resp
);
58 virtual ~ImR_DSI_ResponseHandler (void);
60 void send_ior (const char *pior
);
61 void send_exception (CORBA::Exception
*ex
);
64 void invoke_excep_i (CORBA::Exception
*ex
);
66 CORBA::String_var key_str_
;
67 CORBA::String_var server_name_
;
69 TAO_AMH_DSI_Response_Handler_var resp_
;
73 //---------------------------------------------------------------------------
75 * @class ImR_Forwarder
77 * @brief Implementation Repository Forwarder for AMH
79 * This class provides a Default servant implementation that is used to handle
80 * arbitrary calls and forward them to the correct place. Combinds DSI with
81 * AMH to ensure the handling thread is never blocked waiting for an upcall
84 class Locator_Export ImR_DSI_Forwarder
: public virtual TAO_DynamicImplementation
87 ImR_DSI_Forwarder (ImR_Locator_i
& imr_impl
);
88 virtual ~ImR_DSI_Forwarder (void);
90 virtual void _dispatch (TAO_ServerRequest
& request
,
91 TAO::Portable_Server::Servant_Upcall
*context
);
93 void invoke (CORBA::ServerRequest_ptr request
);
95 char * _primary_interface(const PortableServer::ObjectId
&,
96 PortableServer::POA_ptr
);
98 void invoke (CORBA::ServerRequest_ptr request
,
99 TAO_AMH_DSI_Response_Handler_ptr rh
);
101 void invoke_get_interface(CORBA::ServerRequest_ptr request
);
103 void invoke_primary_interface(CORBA::ServerRequest_ptr request
);
106 void init(CORBA::ORB_ptr orb
);
109 /// Where we find out where to forward to.
110 ImR_Locator_i
& locator_
;
113 PortableServer::Current_var poa_current_var_
;
115 /// Variable to save the ORB reference passed to the constr.
120 #endif /* IMR_FORWARDER_H */