Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / POA / On_Demand_Loading / Server_Manager.h
blob3d0500d647c91810011ddfb3a85318096c3cd55b
1 //=============================================================================
2 /**
3 * @file Server_Manager.h
5 * Helper class for the server application.
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
8 */
9 //=============================================================================
11 #ifndef SERVER_MANAGER_H
12 #define SERVER_MANAGER_H
14 #include "Servant_Activator.h"
15 #include "Servant_Locator.h"
17 /**
18 * @class Server_i
20 * @brief This class provides the server application with helper methods
22 * The various methods required by the server application for
23 * utilizing the ServantActivator and ServantLocator interfaces of
24 * the Servant Manager are implemented by this class. These
25 * include initialisation procedures of the ServantActivator and
26 * ServantLocator, and creation of POAs with emphasis on the
27 * servant retention policy.
29 class Server_i
31 public:
32 /// Initialisation.
33 Server_i ();
35 /// Destruction.
36 ~Server_i ();
38 /// Initialisation of the ORB and poa.
39 int init (int argc, ACE_TCHAR **argv);
41 /**
42 * This method creates a POA from the root_poa with emphasis being
43 * on the servant_retention_policy which decides the use of the
44 * ServantActivator or ServantLocator interfaces. The
45 * servent_retention_policy value is 1 for the RETAIN policy and 0
46 * for the NONRETAIN policy.
48 PortableServer::POA_ptr create_poa (const char* name,
49 int servant_retention_policy);
51 /// A ServantActivator object is created and initialised.
52 int create_activator (PortableServer::POA_var first_poa);
54 /// A ServantActivator object is created and initialised.
55 int create_locator (PortableServer::POA_var second_poa);
57 /// The server is executed.
58 int run ();
60 private:
61 /// Parses the input arguments.
62 int parse_args (int argc, ACE_TCHAR **argv);
64 /// The IORs are written to a file for future use.
65 int write_iors_to_file (const char *first_ior,
66 const char *second_ior);
68 /// Default ior file.
69 ACE_TCHAR *ior_output_file_;
71 /// The orb pointer.
72 CORBA::ORB_var orb_;
74 /// The poa policicies.
75 CORBA::PolicyList policies_;
77 /// The root_poa which is used for cretaing different child poas.
78 PortableServer::POA_var root_poa_;
80 /// The poa_manager object.
81 PortableServer::POAManager_var poa_manager_;
83 /// The object pointer used by the ServantActivator.
84 CORBA::Object_var first_test_;
86 /// The object pointer used by the Servant Locator.
87 CORBA::Object_var second_test_;
89 /// The servant activator object.
90 ServantActivator_i *servant_activator_impl_;
92 /// The servant locator object.
93 ServantLocator_i *servant_locator_impl_;
96 #endif /* SERVER_MANAGER_H */