1 #include "ace/Get_Opt.h"
3 #include "tao/Strategies/advanced_resource.h"
6 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
10 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Before creating ORB\n"));
13 CORBA::ORB_init (argc
, argv
);
15 CORBA::Object_var poa_object
=
16 orb
->resolve_initial_references("RootPOA");
18 PortableServer::POA_var root_poa
=
19 PortableServer::POA::_narrow (poa_object
.in ());
21 if (CORBA::is_nil (root_poa
.in ()))
22 ACE_ERROR_RETURN ((LM_ERROR
,
23 " (%P|%t) Panic: nil RootPOA\n"),
26 PortableServer::POAManager_var poa_manager
=
27 root_poa
->the_POAManager ();
29 Hello
*hello_impl
= 0;
30 ACE_NEW_RETURN (hello_impl
,
35 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Activating servant\n"));
37 PortableServer::ServantBase_var
owner_transfer(hello_impl
);
39 PortableServer::ObjectId_var id
=
40 root_poa
->activate_object (hello_impl
);
42 CORBA::Object_var object
= root_poa
->id_to_reference (id
.in ());
44 Test::Hello_var hello
=
45 Test::Hello::_narrow (object
.in ());
47 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Activating POA Manager\n"));
49 poa_manager
->activate ();
51 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Activated POA Manager\n"));
53 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Doing direct call\n"));
55 CORBA::String_var the_string_d
=
58 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
61 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Object to string\n"));
63 CORBA::String_var ior
=
64 orb
->object_to_string (hello
.in ());
66 CORBA::Object_var tmp
=
67 orb
->string_to_object (ior
.in ());
69 Test::Hello_var hello_ref
=
70 Test::Hello::_narrow(tmp
.in ());
72 if (CORBA::is_nil (hello_ref
.in ()))
74 ACE_ERROR_RETURN ((LM_DEBUG
,
75 "Nil Test::Hello reference <%s>\n",
80 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Going to call method\n"));
82 CORBA::String_var the_string
=
83 hello_ref
->get_string ();
85 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
90 catch (const CORBA::Exception
&)
92 // Ignore exceptions..