299#if defined(HAVE_OMNIORB4)
300 orb=CORBA::ORB_init(argc,argv,
"omniORB4");
302 orb=CORBA::ORB_init(argc,argv,
"omniORB3");
306 bool supplierMode =
false;
307 const char* channelName =
"EventChannel";
310 while ((c =
getopt(argc,argv,
"shn:")) != EOF)
314 case 's': supplierMode=
true;
317 case 'n': channelName =
optarg;
320 case 'h':
usage(argc,argv);
322 default :
usage(argc,argv);
327#if defined(HAVE_SIGNAL_H) && defined(SIGPIPE)
329 signal(SIGPIPE, SIG_IGN);
332 const char* action=
"";
334 CORBA::Object_var obj;
336 action=
"resolve initial reference 'RootPOA'";
337 obj=
orb->resolve_initial_references(
"RootPOA");
338 PortableServer::POA_var rootPoa =PortableServer::POA::_narrow(obj);
339 if(CORBA::is_nil(rootPoa))
340 throw CORBA::OBJECT_NOT_EXIST();
342 action=
"activate the RootPOA's POAManager";
343 PortableServer::POAManager_var pman =rootPoa->the_POAManager();
351 action=
"convert URI from command line into object reference";
356 action=
"resolve initial reference 'NameService'";
357 obj=
orb->resolve_initial_references(
"NameService");
358 CosNaming::NamingContext_var rootContext=
359 CosNaming::NamingContext::_narrow(obj);
360 if(CORBA::is_nil(rootContext))
361 throw CORBA::OBJECT_NOT_EXIST();
363 action=
"find EventChannel in NameService";
364 cout << action << endl;
365 obj=rootContext->resolve(
str2name(channelName));
368 action=
"narrow object reference to event channel";
369 CosEventChannelAdmin::EventChannel_var channel =
370 CosEventChannelAdmin::EventChannel::_narrow(obj);
371 if(CORBA::is_nil(channel))
373 cerr <<
"Failed to narrow Event Channel reference." << endl;
379 action=
"construct PushSupplier";
381 supplier->
supply(channel,action);
385 action=
"construct PushConsumer";
387 consumer->
consume(channel,action);
396 catch(CORBA::ORB::InvalidName& ex) {
397 cerr<<
"Failed to "<<action<<
". ORB::InvalidName"<<endl;
399 catch(CosNaming::NamingContext::InvalidName& ex) {
400 cerr<<
"Failed to "<<action<<
". NamingContext::InvalidName"<<endl;
402 catch(CosNaming::NamingContext::NotFound& ex) {
403 cerr<<
"Failed to "<<action<<
". NamingContext::NotFound"<<endl;
405 catch(CosNaming::NamingContext::CannotProceed& ex) {
406 cerr<<
"Failed to "<<action<<
". NamingContext::CannotProceed"<<endl;
408 catch(CORBA::TRANSIENT& ex) {
409 cerr<<
"Failed to "<<action<<
". TRANSIENT"<<endl;
411 catch(CORBA::OBJECT_NOT_EXIST& ex) {
412 cerr<<
"Failed to "<<action<<
". OBJECT_NOT_EXIST"<<endl;
414 catch(CORBA::SystemException& ex) {
415 cerr<<
"Failed to "<<action<<
"."
416#if defined(HAVE_OMNIORB4)
417 " "<<ex._name()<<
" ("<<ex.NP_minorString()<<
")"
421 catch(CORBA::Exception& ex) {
422 cerr<<
"Failed to "<<action<<
"."
423#if defined(HAVE_OMNIORB4)