2 // Ossama Othman <ossama@uci.edu>
4 #include "orbsvcs/CosNamingC.h"
5 #include "Push_Web_ServerS.h"
6 #include "Push_Iterator_Factory_i.h"
9 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
13 // Initialize the ORB.
14 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
19 CORBA::Object_var obj
=
20 orb
->resolve_initial_references ("RootPOA");
22 PortableServer::POA_var poa
=
23 PortableServer::POA::_narrow (obj
.in ());
25 // Activate the POA manager.
26 PortableServer::POAManager_var mgr
= poa
->the_POAManager ();
29 // Create the Iterator_Factory servant and object.
30 Push_Iterator_Factory_i factory_servant
;
31 Web_Server::Iterator_Factory_var factory
=
32 factory_servant
._this ();
34 // Get a reference to the Name Service.
35 obj
= orb
->resolve_initial_references ("NameService");
37 // Narrow to a Naming Context
38 CosNaming::NamingContext_var nc
=
39 CosNaming::NamingContext::_narrow (obj
.in ());
44 name
[0].id
= CORBA::string_dup ("Push_Iterator_Factory");
45 name
[0].kind
= CORBA::string_dup ("");
47 nc
->bind (name
, factory
.in ());
49 // Some debugging output.
50 CORBA::String_var IOR
= orb
->object_to_string (factory
.in ());
52 ACE_TEXT ("Bound <%s> to <%s> in Name Service.\n"),
57 ACE_TEXT ("Accepting requests.\n")));
62 catch (const CORBA::Exception
& ex
)
64 ex
._tao_print_exception (ACE_TEXT ("Caught unexpected exception:"));