1 #include "tao/ORB_Core.h"
3 #include "tao/Transport_Cache_Manager.h"
4 #include "Object_Factory_i.h"
7 Object_Factory_i::Object_Factory_i (CORBA::ORB_ptr orb
, CORBA::ULong len
)
8 : orb_ (CORBA::ORB::_duplicate (orb
)),
13 //factory method to create first object
14 Two_Objects_Test::First_ptr
15 Object_Factory_i::create_first (void)
19 ACE_NEW_THROW_EX (first_impl
,
20 First_i (orb_
.in(), two_way_done_
),
22 // Ownership is transfered to the POA.
23 PortableServer::ServantBase_var
safe (first_impl
);
25 CORBA::Object_var poa_object
=
26 this->orb_
->resolve_initial_references("RootPOA");
28 PortableServer::POA_var root_poa
=
29 PortableServer::POA::_narrow (poa_object
.in ());
31 PortableServer::ObjectId_var id
=
32 root_poa
->activate_object (first_impl
);
34 CORBA::Object_var object
= root_poa
->id_to_reference (id
.in ());
36 Two_Objects_Test::First_var first
=
37 Two_Objects_Test::First::_narrow (object
.in ());
42 //factory method to create second object
43 Two_Objects_Test::Second_ptr
44 Object_Factory_i::create_second (void)
46 Second_i
*second_impl
;
48 ACE_NEW_THROW_EX (second_impl
,
50 length_
, two_way_done_
),
52 // Ownership is transfered to the POA.
53 PortableServer::ServantBase_var
safe (second_impl
);
55 CORBA::Object_var poa_object
=
56 this->orb_
->resolve_initial_references("RootPOA");
58 PortableServer::POA_var root_poa
=
59 PortableServer::POA::_narrow (poa_object
.in ());
61 PortableServer::ObjectId_var id
=
62 root_poa
->activate_object (second_impl
);
64 CORBA::Object_var object
= root_poa
->id_to_reference (id
.in ());
66 Two_Objects_Test::Second_var second
=
67 Two_Objects_Test::Second::_narrow (object
.in ());
69 return second
._retn();