2 //=============================================================================
6 * Server application to test the Servant Activator and Servant Locator.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
10 //=============================================================================
13 #include "Server_Manager.h"
16 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
22 if (server
.init (argc
, argv
) != 0)
23 ACE_ERROR_RETURN ((LM_ERROR
,
24 "Failure during Initialisation: init ()\n"),
27 // This POA is used to test the Servant Activator interface and
28 // hence has an RETAIN policy.
29 PortableServer::POA_var first_poa
=
30 server
.create_poa ("firstPOA", 1);
32 if (first_poa
.in () == 0)
33 ACE_ERROR_RETURN ((LM_ERROR
,
34 "Failure during first POA creation: create_poa ()\n"),
37 // This poa is used to test the Servant Activator interface and
38 // hence has an NONRETAIN policy.
39 PortableServer::POA_var second_poa
=
40 server
.create_poa ("secondPOA", 0);
42 if (second_poa
.in () == 0)
43 ACE_ERROR_RETURN ((LM_ERROR
,
44 "Failure during second POA creation: create_poa ()\n"),
47 // The Servant Activator interface is created and initialised.
48 if (server
.create_activator (first_poa
) != 0)
49 ACE_ERROR_RETURN ((LM_ERROR
,
50 "Failure during first Servant Activator creation: create_activator()\n"),
53 // The Servant Locator interface is created and initialised.
54 if (server
.create_locator (second_poa
) !=0)
55 ACE_ERROR_RETURN ((LM_ERROR
,
56 "Failure during first Servant Locator creation: create_activator()\n"),
59 // The server begins processing requests.
60 if (server
.run () != 0)
61 ACE_ERROR_RETURN ((LM_ERROR
,
62 "Failure during request processing: run ()\n"),
65 catch (const ::CORBA::Exception
&ex
)
67 ex
._tao_print_exception("Caught unexpected CORBA exception :");