2 //=============================================================================
4 * @file Servant_Activator.cpp
6 * Implementation of <ServantActivator_i>, which is used by a POA
7 * with a RETAIN policy.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
14 #include "Servant_Activator.h"
18 ServantActivator_i::ServantActivator_i (CORBA::ORB_ptr orb
)
19 : servant_manager_ (orb
)
23 // This method associates an servant with the ObjectID.
25 PortableServer::Servant
26 ServantActivator_i::incarnate (const PortableServer::ObjectId
&oid
,
27 PortableServer::POA_ptr poa
)
29 // Convert ObjectId to String.
31 PortableServer::ObjectId_to_string (oid
);
33 // Activate and return the servant else exception.
34 PortableServer::Servant servant
=
35 this->servant_manager_
.obtain_servant (ACE_TEXT_CHAR_TO_TCHAR(s
.in ()),
40 throw CORBA::OBJECT_NOT_EXIST ();
43 // This is the method invoked when the object is deactivated or the
44 // entire POA is is deactivated or destroyed.
47 ServantActivator_i::etherealize (const PortableServer::ObjectId
&oid
,
48 PortableServer::POA_ptr
,
49 PortableServer::Servant servant
,
51 CORBA::Boolean remaining_activations
)
53 // If there are no remaining activations i.e ObjectIds associated
54 // with test servant, deactivate it. Etheralization happens on
55 // POA::destroy() and/or Object::deactivate().
57 if (remaining_activations
== 0)
58 this->servant_manager_
.destroy_servant (servant
, oid
);
61 // This method returns an ObjectId when given an dll name and the
62 // factory function to be invoked in the dll. The format of the
63 // ObjectId is <dllname:factory_function>.
65 PortableServer::ObjectId_var
66 ServantActivator_i::create_dll_object_id (const char *dllname
,
67 const char *factory_function
)
69 return this->servant_manager_
.create_dll_object_id (dllname
,