46 # include <iostream.h>
51 #ifdef HAVE_STD_IOSTREAM
55 #include "CosEventChannelAdmin.hh"
57 static void usage(
int argc,
char **argv);
58 static CosEventChannelAdmin::EventChannel_ptr
getChannel(
const char* sior);
63 main(
int argc,
char **argv)
69 #if defined(HAVE_OMNIORB4)
70 orb=CORBA::ORB_init(argc,argv,
"omniORB4");
72 orb=CORBA::ORB_init(argc,argv,
"omniORB3");
78 while((c =
getopt(argc,argv,
"h")) != EOF)
82 case 'h':
usage(argc,argv);
85 default :
usage(argc,argv);
99 const char* action =
"start";
102 using namespace CosEventChannelAdmin;
104 action=
"convert URI into reference to source channel";
107 action=
"convert URI into reference to destination channel";
110 action=
"obtain ConsumerAdmin";
111 ConsumerAdmin_var cadmin =from_channel->for_consumers();
113 action=
"obtain ProxyPushSupplier";
114 ProxyPushSupplier_var supplier =cadmin->obtain_push_supplier();
116 action=
"obtain SupplierAdmin";
117 SupplierAdmin_var sadmin =to_channel->for_suppliers();
119 action=
"obtain ProxyPushConsumer";
120 ProxyPushConsumer_var consumer =sadmin->obtain_push_consumer();
122 action=
"connect PushConsumer";
123 consumer->connect_push_supplier(supplier.in());
125 action=
"connect PushSupplier";
126 supplier->connect_push_consumer(consumer.in());
130 action=
"destroy orb";
138 catch(CORBA::TRANSIENT& ex) {
139 cerr<<
"Failed to "<<action<<
". TRANSIENT"<<endl;
141 catch(CORBA::OBJECT_NOT_EXIST& ex) {
142 cerr<<
"Failed to "<<action<<
". OBJECT_NOT_EXIST"<<endl;
144 catch(CORBA::SystemException& ex) {
145 cerr<<
"Failed to "<<action<<
".";
146 #if defined(HAVE_OMNIORB4)
147 cerr<<
" "<<ex._name();
148 if(ex.NP_minorString())
149 cerr<<
" ("<<ex.NP_minorString()<<
")";
153 catch(CORBA::Exception& ex) {
154 cerr<<
"Failed to "<<action<<
"."
155 #if defined(HAVE_OMNIORB4)
169 "\nConnect (federate) two event channels.\n"
170 "syntax: "<<(argc?argv[0]:
"eventf")<<
" OPTIONS [FROM_CHANNEL] [TO_CHANNEL]\n"
172 "FROM/TO_CHANNEL: The event channels must be specified as a URI.\n"
173 " This may be an IOR, or a corbaloc::: or corbaname::: URI.\n"
176 " -h display this help text\n" << endl;
182 static CosEventChannelAdmin::EventChannel_ptr
186 CORBA::Object_var obj =
orb->string_to_object(sior);
189 CosEventChannelAdmin::EventChannel_var channel =
190 CosEventChannelAdmin::EventChannel::_narrow(obj);
191 if(CORBA::is_nil(channel))
192 throw CORBA::OBJECT_NOT_EXIST();
194 return channel._retn();
int getopt(int argc, char *argv[], const char *optionS)
static CosEventChannelAdmin::EventChannel_ptr getChannel(const char *sior)
int main(int argc, char **argv)
The main process entry point.
static void usage(int argc, char **argv)