3 #include "ace/OS_NS_string.h"
4 #ifdef TAO_AS_STATIC_LIBS
5 # include "tao/ImR_Client/ImR_Client.h"
8 class Hello
: public virtual POA_Test::Hello
12 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
16 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
18 CORBA::Object_var poa_object
=
19 orb
->resolve_initial_references ("RootPOA");
21 PortableServer::POA_var root_poa
=
22 PortableServer::POA::_narrow (poa_object
.in ());
24 if (CORBA::is_nil (root_poa
.in ()))
25 ACE_ERROR_RETURN ((LM_ERROR
, " (%P|%t) Panic: nil RootPOA\n"), 1);
27 PortableServer::POAManager_var poa_manager
= root_poa
->the_POAManager ();
29 PortableServer::LifespanPolicy_var life
=
30 root_poa
->create_lifespan_policy (PortableServer::PERSISTENT
);
32 PortableServer::IdAssignmentPolicy_var assign
=
33 root_poa
->create_id_assignment_policy (PortableServer::USER_ID
);
35 CORBA::PolicyList pols
;
37 pols
[0] = PortableServer::LifespanPolicy::_duplicate (life
.in ());
38 pols
[1] = PortableServer::IdAssignmentPolicy::_duplicate (assign
.in ());
40 PortableServer::POA_var poa
=
41 root_poa
->create_POA ("ImRified POA", poa_manager
.in (), pols
);
45 Hello
*hello_impl
= 0;
46 ACE_NEW_RETURN (hello_impl
, Hello
, 1);
47 PortableServer::ServantBase_var
owner_transfer (hello_impl
);
49 PortableServer::ObjectId_var id
=
50 PortableServer::string_to_ObjectId ("Test 3891 Object");
52 poa
->activate_object_with_id (id
.in (), hello_impl
);
54 CORBA::Object_var obj
= poa
->id_to_reference (id
.in ());
56 if (!obj
->_stubobj ()->type_id
.in () ||
57 ACE_OS::strcmp (obj
->_stubobj ()->type_id
.in (),
58 hello_impl
->_repository_id ()))
60 ACE_ERROR_RETURN ((LM_ERROR
, "ERROR: type_id is incorrect\n"), 1);
63 root_poa
->destroy (1, 1);
66 catch (const CORBA::Exception
& ex
)
68 ex
._tao_print_exception ("Exception caught:");