Continued changes from peer review
[ACE_TAO.git] / TAO / tests / MProfile_Forwarding / Servant_Locator.cpp
bloba16d400c48cec7d1321ed89dc6d696be4e93fc39
2 //=============================================================================
3 /**
4 * @file Servant_Locator.cpp
6 * Implementation of MyFooServantLocator class , used with a POA
7 * having a NON_RETAIN policy.
9 * @author Irfan Pyarali Michael Kircher
11 //=============================================================================
14 #include "Servant_Locator.h"
15 #include "ace/Log_Msg.h"
16 #include "testC.h"
17 #include "ace/OS_NS_string.h"
19 Servant_Locator::Servant_Locator (CORBA::ORB_ptr orb_ptr)
20 : orb_var_ (CORBA::ORB::_duplicate (orb_ptr))
24 Servant_Locator::~Servant_Locator ()
29 PortableServer::Servant
30 Servant_Locator::preinvoke (const PortableServer::ObjectId &oid,
31 PortableServer::POA_ptr /* poa_ptr */,
32 const char * /*operation*/,
33 PortableServer::ServantLocator::Cookie & /* cookie */)
36 CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
38 ACE_DEBUG ((LM_DEBUG,
39 "The OID is <%s>\n", s.in ()));
40 if (ACE_OS::strstr (s.in (), "Simple_Server") == 0)
42 throw CORBA::OBJECT_NOT_EXIST ();
45 // Combined IOR stuff
46 Simple_Server_var server =
47 Simple_Server::_narrow (this->objref_.in ());
49 ACE_DEBUG ((LM_DEBUG,
50 "Got the narrowed secondary server too...\n"));
52 ACE_DEBUG ((LM_DEBUG,
53 "About to throw exception..\n"));
55 throw PortableServer::ForwardRequest (
56 CORBA::Object::_duplicate (
57 server.in ()));
61 void
62 Servant_Locator::postinvoke (const PortableServer::ObjectId &,
63 PortableServer::POA_ptr ,
64 const char *,
65 PortableServer::ServantLocator::Cookie ,
66 PortableServer::Servant)
70 void
71 Servant_Locator::set (CORBA::Object_var objref)
73 this->objref_ = CORBA::Object::_duplicate (objref.in ());