1 #include "Notifier_Handler.h"
2 #include "tao/ORB_Core.h"
4 Notifier_Handler::Notifier_Handler (void)
9 // Destroy a Notifier target object.
11 Notifier_Handler::~Notifier_Handler (void)
17 Notifier_Handler::close (void)
19 if (this->notifier_
!= 0)
22 "closing down Notifier_Handler\n"));
23 CORBA::release (this->notifier_
);
28 this->orb_
->shutdown ();
33 Notifier_Handler::shutdown (void)
35 ACE_ASSERT (this->shutdowncallback
!= 0);
37 this->shutdowncallback
->close ();
41 Notifier_Handler::run (void)
44 "Running the Supplier...\n"));
51 Notifier_Handler::reactor(void)
53 // @@ Please see if there's a way to get to the Reactor without
54 // using the TAO_ORB_Core_instance().
55 return TAO_ORB_Core_instance ()->reactor ();
58 Event_Comm::Notifier
*
59 Notifier_Handler::notifier (void)
61 return this->notifier_
;
65 Notifier_Handler::notifier (Event_Comm::Notifier
*notifier
)
67 if (this->notifier_
!= notifier
)
69 CORBA::release (this->notifier_
);
70 this->notifier_
= notifier
;
77 Notifier_Handler::init (int argc
,
79 ShutdownCallback
* _shutdowncallback
)
82 shutdowncallback
= _shutdowncallback
;
87 this->orb_
= CORBA::ORB_init (argc
, argv
);
89 CORBA::Object_var poa_object
=
90 this->orb_
->resolve_initial_references ("RootPOA");
92 PortableServer::POA_var poa
=
93 PortableServer::POA::_narrow (poa_object
.in ());
95 PortableServer::POAManager_var poa_manager
=
96 poa
->the_POAManager ();
98 poa_manager
->activate ();
100 // Initialization of the naming service.
101 if (this->naming_client_
.init (orb_
.in ()) != 0)
102 ACE_ERROR_RETURN ((LM_ERROR
,
103 "(%P|%t) Unable to initialize "
104 "the TAO_Naming_Client.\n"),
107 CosNaming::Name
notifier_ref_name (1);
108 notifier_ref_name
.length (1);
109 notifier_ref_name
[0].id
=
110 CORBA::string_dup (NOTIFIER_BIND_NAME
);
112 CORBA::Object_var notifier_obj
=
113 this->naming_client_
->resolve (notifier_ref_name
);
116 // The CORBA::Object_var object is downcast to Notifier_var
117 // using the <_narrow> method.
119 Event_Comm::Notifier::_narrow (notifier_obj
.in ());
121 catch (const CORBA::Exception
& ex
)
123 ex
._tao_print_exception ("Notifier_Handler::init\n");