2 // Ossama Othman <ossama@uci.edu>
4 #include "orbsvcs/CosNamingC.h"
5 #include "Web_ServerS.h"
7 #include "Iterator_Factory_i.h"
10 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
14 // Initialize the ORB.
15 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
20 CORBA::Object_var obj
=
21 orb
->resolve_initial_references ("RootPOA");
23 PortableServer::POA_var poa
=
24 PortableServer::POA::_narrow (obj
.in ());
26 // Activate the POA manager.
27 PortableServer::POAManager_var mgr
= poa
->the_POAManager ();
30 // Create the Iterator_Factory servant and object.
31 // It activates and deactivates the Content_Iterator object.
32 Iterator_Factory_i factory_servant
;
33 Web_Server::Iterator_Factory_var factory
=
34 factory_servant
._this ();
36 // Get a reference to the Name Service.
37 obj
= orb
->resolve_initial_references ("NameService");
39 // Narrow to a Naming Context
40 CosNaming::NamingContext_var nc
;
41 nc
= CosNaming::NamingContext::_narrow (obj
.in ());
46 name
[0].id
= CORBA::string_dup ("Iterator_Factory");
47 name
[0].kind
= CORBA::string_dup ("");
49 nc
->bind (name
, factory
.in ());
51 // Some debugging output.
52 CORBA::String_var IOR
= orb
->object_to_string (factory
.in ());
54 ACE_TEXT ("Bound <%s> to <%s> in Name Service.\n"),
59 ACE_TEXT ("Accepting requests.\n")));
64 catch (const CORBA::Exception
& ex
)
66 ex
._tao_print_exception (ACE_TEXT ("Caught unexpected exception:"));