diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2005-09-01 14:53:09 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2005-09-01 14:53:09 +0000 |
commit | df77e2fe76a00e5bedea8e0fff3755e31a1e3fb6 (patch) | |
tree | f31868681c30741b3de0726289cb8bd279c238c8 | |
parent | 0219ce953d8f346f7331ffced7e792d4411290b3 (diff) | |
download | ATCD-df77e2fe76a00e5bedea8e0fff3755e31a1e3fb6.tar.gz |
ChangeLogTag: Thu Sep 1 14:22:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | TAO/docs/ec_options.html | 73 | ||||
-rw-r--r-- | TAO/orbsvcs/Event_Service/Event_Service.cpp | 87 | ||||
-rw-r--r-- | TAO/orbsvcs/Event_Service/Event_Service.h | 3 |
3 files changed, 134 insertions, 29 deletions
diff --git a/TAO/docs/ec_options.html b/TAO/docs/ec_options.html index caf545eeaae..4f5420739c5 100644 --- a/TAO/docs/ec_options.html +++ b/TAO/docs/ec_options.html @@ -621,7 +621,7 @@ static EC_Gateway_IIOP_Factory "-ECGIIOPConsumerECControl null ....." <P>All the IIOP Gateway factory options start with <CODE>-ECGIIOP</CODE></P> - <P><TABLE BORDER="2" CELLSPACING="2" CELLPADDING="0"> + <P><TABLE BORDER="2" CELLSPACING="2" CELLPADDING="0"> <TR> <TH>Option</TH> <TH>Description</TH> @@ -708,6 +708,77 @@ static EC_Gateway_IIOP_Factory "-ECGIIOPConsumerECControl null ....." </TABLE> </P> + <H3>The commandline arguments</H3> + + The Event_Service executable has several commandline arguments you can use. + The following arguments are available. + + <P><TABLE BORDER="2" CELLSPACING="2" CELLPADDING="0"> + <TR> + <TH>Option</TH> + <TH>Description</TH> + </TR> + + <!-- <TR NAME="-d"> --> + <TR> + <TD><CODE>-n</CODE> + <EM>[service_name]</EM> + </TD> + <TD>The name with which the Event Service registers itself in the + Naming Service. When no name is passed the Event Service will not + register itself with the Naming Service. + </TD> + </TR> + <!-- <TR NAME="-o"> --> + <TR> + <TD><CODE>-o</CODE> + <EM>ior_file_name</EM> + </TD> + <TD>The file to which the IOR of the Event Service will be written. + </TD> + </TR> + + <!-- <TR NAME="-p"> --> + <TR> + <TD><CODE>-p</CODE> + <EM>pid_file_name</EM> + </TD> + <TD>The process id of the Event Service will be written to this + file + </TD> + </TR> + + <!-- <TR NAME="-q"> --> + <TR> + <TD><CODE>-q</CODE> + <EM>servant_name</EM> + </TD> + <TD>The servant name for the Event Channel that will be used + when a Persistent IOR is generated + </TD> + </TR> + + <!-- <TR NAME="-b"> --> + <TR> + <TD><CODE>-b</CODE> + <EM></EM> + </TD> + <TD>Use BiDIR GIOP + </TD> + </TR> + + <!-- <TR NAME="-s"> --> + <TR> + <TD><CODE>-s</CODE> + <EM>global|local|none</EM> + </TD> + <TD>Which scheduler should be used. The default is <CODE>none</CODE>. + With <CODE>local</CODE> an in process scheduler is created. With + <CODE>global</CODE> a scheduler is retrieved from the Naming Service + </TD> + </TR> + </TABLE> + </P> <P><HR><P> diff --git a/TAO/orbsvcs/Event_Service/Event_Service.cpp b/TAO/orbsvcs/Event_Service/Event_Service.cpp index cf818e1d72e..43ae2e8a4a7 100644 --- a/TAO/orbsvcs/Event_Service/Event_Service.cpp +++ b/TAO/orbsvcs/Event_Service/Event_Service.cpp @@ -83,19 +83,32 @@ Event_Service::run (int argc, ACE_TCHAR* argv[]) poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - CORBA::Object_var naming_obj = - this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (CORBA::is_nil (naming_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize the Naming Service.\n"), - 1); + // When we have a service name or a non local scheduler we must use the + // naming service. - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + bool use_name_service = this->service_name_.length () > 0 || + this->scheduler_type_ != ES_SCHED_NONE; + CORBA::Object_var naming_obj; RtecScheduler::Scheduler_var scheduler; + CosNaming::NamingContext_var naming_context; + + if (use_name_service) + { + naming_obj= + this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (naming_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the Naming Service.\n"), + 1); + + naming_context = + CosNaming::NamingContext::_narrow (naming_obj.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + // This is the name we (potentially) register the Scheduling // Service in the Naming Service. CosNaming::Name schedule_name (1); @@ -115,9 +128,12 @@ Event_Service::run (int argc, ACE_TCHAR* argv[]) ACE_TRY_CHECK; // Register the servant with the Naming Context.... - naming_context->rebind (schedule_name, scheduler.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (!CORBA::is_nil (naming_context.in ())) + { + naming_context->rebind (schedule_name, scheduler.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } else if (this->scheduler_type_ == ES_SCHED_GLOBAL) { @@ -127,12 +143,12 @@ Event_Service::run (int argc, ACE_TCHAR* argv[]) ACE_TRY_CHECK; scheduler = RtecScheduler::Scheduler::_narrow (tmp.in () - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil (scheduler.in ())) ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to resolve the Scheduling Service.\n"), + " (%P|%t) Unable to resolve the Scheduling Service.\n"), 1); } @@ -144,11 +160,12 @@ Event_Service::run (int argc, ACE_TCHAR* argv[]) attr.scheduler = scheduler.in (); } - TAO_EC_Event_Channel* ec_impl; + TAO_EC_Event_Channel* ec_impl = 0; ACE_NEW_RETURN (ec_impl, TAO_EC_Event_Channel (attr), 1); this->ec_impl_ = ec_impl; + ec_impl->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; @@ -276,22 +293,35 @@ Event_Service::run (int argc, ACE_TCHAR* argv[]) ACE_TEXT("The EC IOR is <%s>\n"), ACE_TEXT_CHAR_TO_TCHAR(str.in ()))); - CosNaming::Name channel_name (1); - channel_name.length (1); - channel_name[0].id = CORBA::string_dup (this->service_name_.c_str()); - naming_context->rebind (channel_name, ec.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if ((this->service_name_.length () > 0) && + !CORBA::is_nil (naming_context.in ())) + { + CosNaming::Name channel_name (1); + channel_name.length (1); + channel_name[0].id = CORBA::string_dup (this->service_name_.c_str()); + naming_context->rebind (channel_name, ec.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } ACE_DEBUG ((LM_DEBUG, ACE_TEXT("%s; running event service\n"), ACE_TEXT_CHAR_TO_TCHAR(__FILE__))); + this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - naming_context->unbind (channel_name ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if ((this->service_name_.length () > 0) && + !CORBA::is_nil (naming_context.in ())) + { + CosNaming::Name channel_name (1); + channel_name.length (1); + channel_name[0].id = CORBA::string_dup (this->service_name_.c_str()); + naming_context->unbind (channel_name ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } - if (!CORBA::is_nil (scheduler.in ())) + if (!CORBA::is_nil (scheduler.in ()) && + !CORBA::is_nil (naming_context.in ())) { naming_context->unbind (schedule_name ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -314,7 +344,7 @@ Event_Service::parse_args (int argc, ACE_TCHAR* argv []) // default values... this->service_name_ = "EventService"; - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:o:p:s:q:b")); + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:::o:p:s:q:b")); int opt; while ((opt = get_opt ()) != EOF) @@ -322,7 +352,10 @@ Event_Service::parse_args (int argc, ACE_TCHAR* argv []) switch (opt) { case 'n': - this->service_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); + if (get_opt.opt_arg ()) + this->service_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); + else + this->service_name_ = ""; break; case 'o': @@ -372,7 +405,7 @@ Event_Service::parse_args (int argc, ACE_TCHAR* argv []) default: ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Usage: %s ") - ACE_TEXT("-n service_name ") + ACE_TEXT("-n [service_name] ") ACE_TEXT("-o ior_file_name ") ACE_TEXT("-p pid_file_name ") ACE_TEXT("-s <global|local|none> ") diff --git a/TAO/orbsvcs/Event_Service/Event_Service.h b/TAO/orbsvcs/Event_Service/Event_Service.h index 5805de3e16b..a736be4e7a0 100644 --- a/TAO/orbsvcs/Event_Service/Event_Service.h +++ b/TAO/orbsvcs/Event_Service/Event_Service.h @@ -75,7 +75,8 @@ private: /// The Event Channel implementation. POA_RtecEventChannelAdmin::EventChannel *ec_impl_; - /// The name we use to bind with the NameService + /// The name we use to bind with the NameService, if this is empty, we don't + /// bind to the NameService ACE_CString service_name_; /// The name of the file were we output the Event_Service IOR. |