00001 // -*- C++ -*- 00002 //============================================================================= 00003 /** 00004 * @file Forwarder.h 00005 * 00006 * Forwarder.h,v 1.11 2005/08/22 10:49:30 jwillemsen Exp 00007 * 00008 * @brief This class implements ImR's forwarding ServantLocator 00009 * 00010 * @author Darrell Brunsch <brunsch@cs.wustl.edu> 00011 * @author Priyanka Gontla <pgontla@doc.ece.uci.edu> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef IMR_FORWARDER_H 00016 #define IMR_FORWARDER_H 00017 00018 #include "tao/PortableServer/PortableServer.h" 00019 #include "tao/PortableServer/ServantLocatorC.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/LocalObject.h" 00026 00027 00028 class ImR_Locator_i; 00029 00030 /** 00031 * @class ImR_Forwarder: 00032 * 00033 * @brief Implementation Repository Forwarder 00034 * 00035 * This class provides a ServantLocator implementation that 00036 * is used to handle arbitrary calls and forward them to the 00037 * correct place. 00038 */ 00039 class ImR_Forwarder 00040 : public PortableServer::ServantLocator, 00041 public CORBA::LocalObject 00042 { 00043 public: 00044 ImR_Forwarder (ImR_Locator_i& imr_impl); 00045 00046 /// Called before the invocation begins. 00047 virtual PortableServer::Servant preinvoke ( 00048 const PortableServer::ObjectId &oid, 00049 PortableServer::POA_ptr poa, 00050 const char * operation, 00051 PortableServer::ServantLocator::Cookie &cookie 00052 ACE_ENV_ARG_DECL 00053 ) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::ForwardRequest)); 00054 00055 virtual void postinvoke ( 00056 const PortableServer::ObjectId & oid, 00057 PortableServer::POA_ptr adapter, 00058 const char * operation, 00059 PortableServer::ServantLocator::Cookie the_cookie, 00060 PortableServer::Servant the_servant 00061 ACE_ENV_ARG_DECL_WITH_DEFAULTS 00062 ) ACE_THROW_SPEC ((CORBA::SystemException)); 00063 00064 void init(CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); 00065 00066 private: 00067 /// Where we find out where to forward to. 00068 ImR_Locator_i& locator_; 00069 00070 /// POA reference. 00071 PortableServer::Current_var poa_current_var_; 00072 00073 /// Variable to save the ORB reference passed to the constr. 00074 CORBA::ORB_ptr orb_; 00075 }; 00076 00077 #endif /* IMR_FORWARDER_H */