Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / POA / On_Demand_Loading / server.cpp
blobc9908b7ae452d766a00bbf7406531e59b029541d
2 //=============================================================================
3 /**
4 * @file server.cpp
6 * Server application to test the Servant Activator and Servant Locator.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 */
10 //=============================================================================
13 #include "Server_Manager.h"
15 int
16 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
18 Server_i server;
20 if (server.init (argc, argv) != 0)
21 ACE_ERROR_RETURN ((LM_ERROR,
22 "Failure during Initialisation: init ()\n"),
23 -1);
25 // This POA is used to test the Servant Activator interface and
26 // hence has an RETAIN policy.
27 PortableServer::POA_var first_poa =
28 server.create_poa ("firstPOA", 1);
30 if (first_poa.in () == 0)
31 ACE_ERROR_RETURN ((LM_ERROR,
32 "Failure during first POA creation: create_poa ()\n"),
33 -1);
35 // This poa is used to test the Servant Activator interface and
36 // hence has an NONRETAIN policy.
37 PortableServer::POA_var second_poa =
38 server.create_poa ("secondPOA", 0);
40 if (second_poa.in () == 0)
41 ACE_ERROR_RETURN ((LM_ERROR,
42 "Failure during second POA creation: create_poa ()\n"),
43 -1);
45 // The Servant Activator interface is created and initialised.
46 if (server.create_activator (first_poa) != 0)
47 ACE_ERROR_RETURN ((LM_ERROR,
48 "Failure during first Servant Activator creation: create_activator()\n"),
49 -1);
51 // The Servant Locator interface is created and initialised.
52 if (server.create_locator (second_poa) !=0)
53 ACE_ERROR_RETURN ((LM_ERROR,
54 "Failure during first Servant Locator creation: create_activator()\n"),
55 -1);
57 // The server begins processing requests.
58 if (server.run () != 0)
59 ACE_ERROR_RETURN ((LM_ERROR,
60 "Failure during request processing: run ()\n"),
61 -1);
62 return 0;