1 //=============================================================================
3 * @file Servant_Activator.h
5 * Defines a <ServantActivator_i> class, which uses a
6 * Servant_Manager to activate a servant by loading it and
7 * associates it with an object on-demand.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
13 #ifndef SERVANT_ACTIVATOR_H
14 #define SERVANT_ACTIVATOR_H
16 #include "Servant_Manager.h"
17 #include "tao/PortableServer/ServantActivatorC.h"
18 #include "tao/LocalObject.h"
21 * Servant Activator for the test servant.
23 * This class associates an unassociated servant with an object in
24 * the POA Active Object Map.
26 class ServantActivator_i
:
27 public virtual PortableServer::ServantActivator
,
28 public virtual ::CORBA::LocalObject
33 ServantActivator_i (CORBA::ORB_ptr orb
);
36 * This method is invoked by a POA with USE_SERVANT_MANAGER and
37 * RETAIN policies, whenever it receives a request for a test object
38 * that is not currently active. When an servant pointer
39 * corresponding to objectId is not found in the Active Object Map,
40 * the POA hands over the job of obtaining the servant to the
41 * Servant Manager. Depending upon whether the POA is created with
42 * RETAIN or NON_RETAIN as the servant_retention policy, the Servant
43 * Activator or the Servant Locator interface is invoked
46 virtual PortableServer::Servant
incarnate (const PortableServer::ObjectId
&oid
,
47 PortableServer::POA_ptr poa
);
50 * This method is invoked whenever a test servant is
51 * deactivated. This occurs when the POA is destroyed or the Object
52 * is deactivated. When the POA is getting destroyed, it needs to
53 * deactivate every object in the Active Object Map and on that call
54 * the ServantActivator invokes this method which will destroy the
55 * servant associated with the object.
57 virtual void etherealize (const PortableServer::ObjectId
&oid
,
58 PortableServer::POA_ptr adapter
,
59 PortableServer::Servant servant
,
60 CORBA::Boolean cleanup_in_progress
,
61 CORBA::Boolean remaining_activations
);
63 /// Returns an ObjectId when given a DLL name and the factory
64 /// function in the DLL that will create an appropriate Servant.
65 PortableServer::ObjectId_var
create_dll_object_id (const char *dllname
,
66 const char *factory_function
);
70 * An ServantManager object that provides utility methods. The
71 * methods include obtaining the servant using an ACE_DLL object,
72 * destroying the servant and extracting the dllname and factory
73 * function from the ObjectId.
75 ServantManager_i servant_manager_
;
78 #endif /* SERVANT_ACTIVATOR_H */