1 #include "orbsvcs/CosNotifyChannelAdminC.h"
2 #include "orbsvcs/CosNotifyChannelAdminS.h"
4 const char *ior
= "file://ecf.ior";
6 CosNotifyChannelAdmin::EventChannel_var
7 get_event_channel(CORBA::ORB_ptr orb
)
10 CosNotifyChannelAdmin::EventChannel_var ec
;
11 CosNotifyChannelAdmin::ChannelID id
;
12 CosNotification::QoSProperties
init_qos(0);
13 CosNotification::AdminProperties
init_admin(0);
15 std::cout
<< "Get CosNotifyChannelAdmin::EventChannelFactory" << std::endl
;
16 std::cout
<< "IorEventChannelFactory=" << ior
<< std::endl
;
17 CORBA::Object_var obj
= orb
->string_to_object(ior
);
19 if (CORBA::is_nil(obj
.in ()))
21 std::cerr
<< "Bad ec_fact.ior " << std::endl
;
25 CosNotifyChannelAdmin::EventChannelFactory_var factory
=
26 CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj
.in ());
27 if (CORBA::is_nil(factory
.in()))
29 std::cerr
<< "Could not _narrow object to type CosNotifyChannelAdmin::EventChannelFactory" << std::endl
;
34 CosNotifyChannelAdmin::ChannelIDSeq_var channelIdSeq
;
37 channelIdSeq
= factory
->get_all_channels();
39 catch (const CORBA::SystemException
& se
)
41 std::cerr
<< "System exception occurred during get_all_channels: "
46 if( channelIdSeq
->length() == 0 )
50 ec
= factory
->create_channel( init_qos
, init_admin
, id
);
52 catch (const CORBA::SystemException
& se
)
54 std::cerr
<< "System exception occurred during find_channel: "
62 ec
= factory
->get_event_channel(channelIdSeq
.in()[0]);
64 catch (CosNotifyChannelAdmin::ChannelNotFound
& )
66 std::cerr
<< "ChannelNotFound: "
67 << channelIdSeq
.in()[0] << std::endl
;
71 catch (const CORBA::SystemException
& se
)
73 std::cerr
<< "System exception occurred during get_event_channel: "