1 #include "MessengerLocator_i.h"
2 #include "Messenger_i.h"
4 #include "ace/SString.h"
7 Messenger_Locator_i::Messenger_Locator_i()
11 PortableServer::Servant
12 Messenger_Locator_i::preinvoke (const PortableServer::ObjectId
&oid
,
13 PortableServer::POA_ptr
,
17 // Get the ObjectId in string format.
18 CORBA::String_var oid_str
= PortableServer::ObjectId_to_string (oid
);
20 std::cout
<< "preinvoke called..." << oid_str
<< std::endl
;
22 // Check if the ObjectId is valid.
23 ACE_CString
cstr(oid_str
.in());
24 if (cstr
== "Messenger") {
25 // Create the required servant
26 PortableServer::ServantBase_var servant
= new Messenger_i ();
28 // Set a flag so that we know to delete it in postinvoke().
31 return servant
._retn();
34 throw CORBA::OBJECT_NOT_EXIST ();
39 Messenger_Locator_i::postinvoke (const PortableServer::ObjectId
&,
40 PortableServer::POA_ptr
,
43 PortableServer::Servant servant
)
45 std::cout
<< "postinvoke called..." << std::endl
;
47 // Delete the servant as it is no longer needed.