1 //=============================================================================
3 * @file Servant_Locator.h
5 * Defines a ServantLocator_i class , used with a POA having
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
10 //=============================================================================
12 #ifndef SERVANT_LOCATOR_H
13 #define SERVANT_LOCATOR_H
17 #include "Servant_Manager.h"
18 #include "tao/PortableServer/ServantLocatorC.h"
19 #include "tao/LocalObject.h"
21 class ServantLocator_i
:
22 public virtual PortableServer::ServantLocator
,
23 public virtual ::CORBA::LocalObject
27 // This class is used by a POA with USE_SERVANT_MANAGER and
31 // This class defines the Servant Locator interface of the Servant
32 // Manager. It is invoked when the POA has an USE_SERVANT_MANAGER
33 // policy and a servant_retention policy of NON_RETAIN type.
36 ServantLocator_i (CORBA::ORB_ptr orb
);
39 * This method is invoked by a POA whenever it receives a request
40 * for test object that is not currently active. When the POA is
41 * created using the NON_RETAIN policy the Active Object Map is not
42 * maintained, in other words, an association between the ObjectId
43 * and the servant is not maintained. Hence every client request the
44 * servant has to be loaded. Note the operation argument. This
45 * argument specifies the operation to be invoked on the
46 * servant. The cookie helps in marking the servant. This marking is
47 * useful while destroying the servant.
49 virtual PortableServer::Servant
preinvoke (const PortableServer::ObjectId
&oid
,
50 PortableServer::POA_ptr adapter
,
51 const char *operation
,
52 PortableServer::ServantLocator::Cookie
&the_cookie
);
55 * This method is invoked whenever a test servant completes a
56 * request. As the Servant Loactor interface is used when the POA
57 * doesnt maintain the Active Object Map, its necessary to get rid
58 * of the servant after the client request has been processed. The
59 * appropriate servant is destroyed by verifying the cookie.Again
60 * this method is invoked per client request.
62 virtual void postinvoke (const PortableServer::ObjectId
&oid
,
63 PortableServer::POA_ptr adapter
,
64 const char *operation
,
65 PortableServer::ServantLocator::Cookie the_cookie
,
66 PortableServer::Servant the_servant
);
68 /// Returns an ObjectId when given an dll name and the factory method
69 /// to be invoked in the dll.
70 PortableServer::ObjectId_var
create_dll_object_id (const char *dllname
,
71 const char *factory_function
);
74 * The <ServantManager_i> object that provides utility methods. The
75 * methods include obtaining the servant using an ACE_DLL object,
76 * destroying the servant and extracting the dllname and factory
77 * function from the ObjectId.
79 ServantManager_i servant_manager_
;
82 #endif /* SERVANT_LOCATOR_H */