00001 // -*- C++ -*- 00002 //============================================================================= 00003 /** 00004 * @file Forwarder.h 00005 * 00006 * $Id: Forwarder.h 77075 2007-02-12 19:34:03Z johnnyw $ 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 00053 virtual void postinvoke ( 00054 const PortableServer::ObjectId & oid, 00055 PortableServer::POA_ptr adapter, 00056 const char * operation, 00057 PortableServer::ServantLocator::Cookie the_cookie, 00058 PortableServer::Servant the_servant); 00059 00060 void init(CORBA::ORB_ptr orb); 00061 00062 private: 00063 /// Where we find out where to forward to. 00064 ImR_Locator_i& locator_; 00065 00066 /// POA reference. 00067 PortableServer::Current_var poa_current_var_; 00068 00069 /// Variable to save the ORB reference passed to the constr. 00070 CORBA::ORB_ptr orb_; 00071 }; 00072 00073 #endif /* IMR_FORWARDER_H */