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