Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / MProfile_Forwarding / Servant_Locator.cpp
blob78e186910f65f6132d38d2318c8e56996a554757
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 */)
35 CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
37 ACE_DEBUG ((LM_DEBUG,
38 "The OID is <%s>\n", s.in ()));
39 if (ACE_OS::strstr (s.in (), "Simple_Server") == 0)
41 throw CORBA::OBJECT_NOT_EXIST ();
44 // Combined IOR stuff
45 Simple_Server_var server =
46 Simple_Server::_narrow (this->objref_.in ());
48 ACE_DEBUG ((LM_DEBUG,
49 "Got the narrowed secondary server too...\n"));
51 ACE_DEBUG ((LM_DEBUG,
52 "About to throw exception..\n"));
54 throw PortableServer::ForwardRequest (
55 CORBA::Object::_duplicate (
56 server.in ()));
59 void
60 Servant_Locator::postinvoke (const PortableServer::ObjectId &,
61 PortableServer::POA_ptr ,
62 const char *,
63 PortableServer::ServantLocator::Cookie ,
64 PortableServer::Servant)
68 void
69 Servant_Locator::set (CORBA::Object_var objref)
71 this->objref_ = CORBA::Object::_duplicate (objref.in ());