int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); if (parse_args (argc, argv) != 0) return 1; //Get reference to Root POA CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in()); // Activate POA Manager PortableServer::POAManager_var mgr = poa->the_POAManager(); mgr->activate(); // Find the Naming Service obj = orb->resolve_initial_references("NameService"); CosNaming::NamingContextExt_var root = CosNaming::NamingContextExt::_narrow(obj.in()); if (CORBA::is_nil(root.in())) { std::cerr << "Nil Naming Context reference" << std::endl; return 1; } // Bind a new context. CosNaming::Name name; name.length( 1 ); name[0].id = CORBA::string_dup( "root.esc-dot" ); name[0].kind = CORBA::string_dup( "kind1" ); try { obj = root->resolve(name); } catch(const CosNaming::NamingContext::NotFound&) { CosNaming::NamingContext_var dummy = root->bind_new_context(name); } name.length( 2 ); name[1].id = CORBA::string_dup( "leaf/esc-slash" ); name[1].kind = CORBA::string_dup( "kind2" ); // Create an object PortableServer::Servant_var<Messenger_i> servant = new Messenger_i; PortableServer::ObjectId_var oid = poa->activate_object(servant.in()); CORBA::Object_var messenger_obj = poa->id_to_reference(oid.in()); root->rebind(name, messenger_obj.in()); // Also try rebinding to a simple path. CosNaming::Name_var simp_name = root->to_name("Simple"); try { obj = root->resolve(simp_name.in()); } catch(const CosNaming::NamingContext::NotFound&) { CosNaming::NamingContext_var dummy = root->bind_new_context(simp_name.in()); } simp_name = root->to_name("Simple/Messenger"); root->rebind(simp_name.in(), messenger_obj.in()); // Convert Name to String Name. CORBA::String_var str_name = root->to_string(name); std::cout << "str_name: " << str_name.in() << std::endl; CORBA::String_var str_simple = root->to_string(simp_name.in()); std::cout << "simple: " << str_simple.in() << std::endl; // Convert String Name to Name. CosNaming::Name_var tname = root->to_name(str_name.in()); std::cout << "converted back to a CosNaming::Name: " << std::endl; std::cout << " name[0] = " << (* tname)[0].id.in() << " , " << (* tname)[0].kind.in() << std::endl; std::cout << " name[1] = " << (* tname)[1].id.in() << " , " << (* tname)[1].kind.in() << std::endl; // Find the application object by resolve_str. try { obj = root->resolve_str(str_name.in()); } catch(const CosNaming::NamingContext::NotFound&) { std::cerr<<"Couldn't resolve the string name: " << str_name << std::endl; return 1; } ACE_CString base_address (":"); base_address += ACE_TEXT_ALWAYS_CHAR (hostname); base_address += ":"; base_address += ACE_TEXT_ALWAYS_CHAR (port); ACE_CString addr (""); addr = base_address + "/key/str"; // Create an URL string for application object. CORBA::String_var address = CORBA::string_dup (addr.c_str()); std::cout << "call to_url(\"" << address.in() << "\"" << std::endl; std::cout << " ,\"" << str_simple.in() << "\")"<< std::endl; CORBA::String_var url_string = root->to_url(address.in(), str_simple.in()); std::cout << "to_url result: " << url_string.in() << std::endl; // Write NS url to a file to let client read NS URL to get // NamingContext reference. CORBA::String_var ns_addr = CORBA::string_dup(base_address.c_str()); std::cout << "call to_url(\"" <<ns_addr.in() << "\",\"" << str_simple.in() << "\")"<< std::endl; CORBA::String_var url = root->to_url(ns_addr.in(), str_simple.in()); std::cout << "to_url result: " << url.in() << std::endl; std::ofstream iorFile(ACE_TEXT_ALWAYS_CHAR (ior_output_file)); iorFile << url.in() << std::endl; iorFile.close(); std::cout << "Naming Service URL written to file " << ior_output_file << std::endl; // Accept requests orb->run(); orb->destroy(); } catch(const CORBA::Exception& ex) { std::cerr << "Caught a CORBA::Exception: " << ex << std::endl; return 1; } return 0; }
void EDF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) { int int_guid; DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_RECEIVE_REPLY, 0, 0, 0); RTScheduling::Current::IdType guid; CORBA::String_var operation = ri->operation (); CORBA::Object_var target = ri->target (); ACE_CString opname = operation.in (); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):receive_reply from " "\"%s\"\n", opname.c_str ())); #endif // Check that the reply service context was received as // expected. IOP::ServiceContext_var sc = ri->get_reply_service_context (Client_Interceptor::SchedulingInfo); CORBA::Long importance; TimeBase::TimeT deadline; if (sc.ptr () == 0) { ACE_DEBUG ((LM_DEBUG, "service context was not filled\n")); //24 hrs from now - infinity ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0); deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT importance = 0; } else { CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), sc->context_data.length (), sc->context_data.get_buffer (), 0); //Don't store in a _var, since >>= returns a pointer to an internal buffer //and we are not supposed to free it. Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; CORBA::Any sc_qos_as_any; CORBA::Any_var scqostmp = codec_->decode (oc_seq); sc_qos_as_any = scqostmp.in (); sc_qos_as_any >>= sc_qos_ptr; deadline = sc_qos_ptr->deadline; importance = sc_qos_ptr->importance; guid.length (sc_qos_ptr->guid.length ()); guid_copy (guid, sc_qos_ptr->guid); ACE_DEBUG ((LM_DEBUG, "(%t|%T):Importance = %d in recvd service context\n", importance)); } ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); EDF_Scheduler_Traits::QoSDescriptor_t qos; qos.deadline_ = qos.importance_ = importance; qos.deadline_ = deadline; this->kokyu_dispatcher_->schedule (guid, qos); DSUI_EVENT_LOG (EDF_SCHED_FAM, EXIT_RECEIVE_REPLY, int_guid, 0, 0); }
UTL_ScopedName * be_visitor_xplicit_pre_proc::xplicit_iface_rel_name (AST_Decl *d) { AST_Decl *tmp = d; ACE_CString name (d->full_name ()); while (tmp != 0) { if (be_home::narrow_from_decl (tmp) != 0) { ACE_CString head (tmp->local_name ()->get_string ()); ACE_CString::size_type start = name.find (head) + 2; ACE_CString tail (name.substr (start + head.length ())); return FE_Utils::string_to_scoped_name (tail.c_str ()); } tmp = ScopeAsDecl (tmp->defined_in ()); } return 0; }
bool ImR_Locator_i::split_key (ACE_CString &full, ACE_CString &key, Server_Info_Ptr &si) { key = full; if (this->get_info_for_name (full.c_str(), si)) { return true; } ACE_CString::size_type pos = full.rfind ('/'); while (pos != ACE_CString::npos) { ACE_CString server = full.substring (0, pos); if (this->get_info_for_name (server.c_str (), si)) { return true; } pos = server.rfind ('/'); } return false; }
int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1) try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ()); PortableServer::POAManager_var poa_manager = poa->the_POAManager (); poa_manager->activate (); TAO_Notify_Service* notify_service = TAO_Notify_Service::load_default (); if (notify_service == 0) { error ("Unable to load the Notify Service"); } notify_service->init_service (orb.in ()); ACE_OS::sleep (1); const ACE_CString ecf_name ("MonitoringEventChannelFactory"); CosNotifyChannelAdmin::EventChannelFactory_var ecf = notify_service->create (poa.in (), ecf_name.c_str ()); NotifyMonitoringExt::EventChannelFactory_var monitor_ec_factory = NotifyMonitoringExt::EventChannelFactory::_narrow (ecf.in ()); if (CORBA::is_nil (monitor_ec_factory.in ())) { error ("Unable to create the Monitoring Event Channel Factory"); } CosNotification::QoSProperties qos_prop; CosNotification::AdminProperties admin_prop; CosNotifyChannelAdmin::ChannelID id; const ACE_CString ec_name ("test1"); CosNotifyChannelAdmin::EventChannel_var ec = monitor_ec_factory->create_named_channel (qos_prop, admin_prop, id, ec_name.c_str ()); NotifyMonitoringExt::EventChannel_var mec = NotifyMonitoringExt::EventChannel::_narrow (ec.in ()); if (CORBA::is_nil (mec.in ())) { error ("Unable to narrow the event channel"); } try { CosNotifyChannelAdmin::ChannelID fake_id; CosNotifyChannelAdmin::EventChannel_var fake = monitor_ec_factory->create_named_channel (qos_prop, admin_prop, fake_id, "test1"); error ("Expected a NotifyMonitoringExt::" "NameAlreadyUsed exception"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { // This is expected. } Monitor_Point_Registry* instance = Monitor_Point_Registry::instance (); ACE_CString stat_name = ecf_name + "/" + ACE_CString (NotifyMonitoringExt::InactiveEventChannelCount); Monitor_Base* stat = instance->get (stat_name); if (stat == 0) { error ("Could not find InactiveEventChannelCount statistic"); } stat->update (); double count = stat->last_sample (); if (!ACE::is_equal (count, 1.0)) { error ("Invalid inactive event channel count"); } stat_name = ecf_name + "/" + ACE_CString (NotifyMonitoringExt::ActiveEventChannelCount); stat = instance->get (stat_name); if (stat == 0) { error ("Could not find ActiveEventChannelCount statistic"); } stat->update (); count = stat->last_sample (); if (!ACE::is_equal (count, 0.0)) { error ("Invalid active event channel count"); } stat_name = ecf_name + "/" + ACE_CString (NotifyMonitoringExt::InactiveEventChannelNames); stat = instance->get (stat_name); if (stat == 0) { error ("Could not find InactiveEventChannels statistic"); } stat->update (); Monitor_Control_Types::NameList list = stat->get_list (); if (list.size () != 1) { error ("Invalid inactive event channel list"); } ACE_CString full_ec_name (ecf_name + "/" + ec_name); if (list[0] != full_ec_name) { error ("Wrong event channel name"); } CosNotifyChannelAdmin::AdminID aid; CosNotifyChannelAdmin::SupplierAdmin_var admin = mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP, aid, "TestSupplierAdmin"); try { admin = mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP, aid, "TestSupplierAdmin"); error ("Expected a SupplierAdmin " "NotifyMonitoringExt::NameAlreadyUsed exception"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { // This is expected. }; // We should be able to create another one with the same name. admin->destroy (); admin = mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP, aid, "TestSupplierAdmin"); NotifyMonitoringExt::SupplierAdmin_var madmin = NotifyMonitoringExt::SupplierAdmin::_narrow (admin.in ()); if (CORBA::is_nil (madmin.in ())) { error ("Could not narrow the supplier admin"); } CosNotifyChannelAdmin::ProxyID pid; CosNotifyChannelAdmin::ProxyConsumer_var conproxy = madmin->obtain_named_notification_push_consumer ( CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "supplier"); try { CosNotifyChannelAdmin::ProxyConsumer_var fake = madmin->obtain_named_notification_push_consumer (CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "supplier"); error ("Expected a ProxyConsumer " "NotifyMonitoringExt::NameAlreadyUsed exception"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { // This is expected. } stat_name = ecf_name + "/" + ec_name + "/" + ACE_CString (NotifyMonitoringExt::EventChannelSupplierCount); stat = instance->get (stat_name); if (stat == 0) { error ("Could not find the event channel suppliers statistic"); } stat->update (); count = stat->last_sample (); if (!ACE::is_equal (count, 1.0)) { error ("Invalid supplier count"); } CosNotifyChannelAdmin::StructuredProxyPushConsumer_var push_conproxy = CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow ( conproxy.in ()); ACE_ASSERT (!CORBA::is_nil (push_conproxy.in ())); push_conproxy->disconnect_structured_push_consumer (); try { CosNotifyChannelAdmin::ProxyConsumer_var fake = madmin->obtain_named_notification_push_consumer ( CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "supplier"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { error ("Unexpected ProxyConsumer " "NotifyMonitoringExt::NameAlreadyUsed exception"); } CosNotifyChannelAdmin::ConsumerAdmin_var cadmin = mec->named_new_for_consumers (CosNotifyChannelAdmin::AND_OP, aid, "TestConsumerAdmin"); try { cadmin = mec->named_new_for_consumers (CosNotifyChannelAdmin::AND_OP, aid, "TestConsumerAdmin"); error ("Expected a ConsumerAdmin " "NotifyMonitoringExt::NameAlreadyUsed exception"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { // This is expected. }; // We should be able to create another one with the same name cadmin->destroy (); cadmin = mec->named_new_for_consumers (CosNotifyChannelAdmin::AND_OP, aid, "TestConsumerAdmin"); NotifyMonitoringExt::ConsumerAdmin_var mcadmin = NotifyMonitoringExt::ConsumerAdmin::_narrow (cadmin.in ()); if (CORBA::is_nil (mcadmin.in ())) { error ("Could not narrow the consumer admin"); } CosNotifyChannelAdmin::ProxySupplier_var supproxy = mcadmin->obtain_named_notification_push_supplier ( CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "consumer"); try { CosNotifyChannelAdmin::ProxySupplier_var fake = mcadmin->obtain_named_notification_push_supplier ( CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "consumer"); error ("Expected a ProxySupplier " "NotifyMonitoringExt::NameAlreadyUsed exception"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { // This is expected. } stat_name = ecf_name + "/" + ec_name + "/" + ACE_CString (NotifyMonitoringExt::EventChannelConsumerCount); stat = instance->get (stat_name); if (stat == 0) { error ("Could not find the event channel consumers statistic"); } stat->update (); count = stat->last_sample (); if (!ACE::is_equal (count, 1.0)) { error ("Invalid consumer count"); } CosNotifyChannelAdmin::StructuredProxyPushSupplier_var push_supproxy = CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow ( supproxy.in()); ACE_ASSERT (!CORBA::is_nil (push_supproxy.in ())); push_supproxy->disconnect_structured_push_supplier (); try { CosNotifyChannelAdmin::ProxySupplier_var fake = mcadmin->obtain_named_notification_push_supplier ( CosNotifyChannelAdmin::STRUCTURED_EVENT, pid, "consumer"); } catch (const NotifyMonitoringExt::NameAlreadyUsed&) { error ("Unexpected ProxySupplier " "NotifyMonitoringExt::NameAlreadyUsed exception"); } TAO_MonitorManager::shutdown (); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("MonitorControlExt: "); } catch (...) { error ("Caught an unexpected exception type"); } #else /* ACE_HAS_MONITOR_FRAMEWORK==1 */ ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ return 0; }
CORBA::Object_ptr Plan_Launcher_Base_Impl< Manager, AppManager, Application> ::prepare_plan (const ::Deployment::DeploymentPlan &plan) { DANCE_TRACE ("Plan_Launcher_Base_Impl::prepare_plan"); #ifdef GEN_OSTREAM_OPS if (DAnCE_debug_level >= DANCE_LOG_DETAILED_TRACE) { std::ostringstream plan_stream; plan_stream << plan << std::endl; DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO "Convert_Plan - Input plan: %C\n", plan_stream.str ().c_str ())); } #endif /* GEN_OSTREAM_OPS */ typename AppManager::_var_type app_manager; try { ::Deployment::ApplicationManager_var l_manager = this->manager_->preparePlan (plan, 0); app_manager = app_manager = AppManager::_narrow (l_manager.in ()); } catch (::Deployment::PlanError &ex) { ACE_CString error ("Caught PlanError exception while invoking preparePlan: "); error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::StartError &ex) { ACE_CString error ("Caught StartError exception while invoking preparePlan: "); error += ex.name.in (); error += ", " ; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::CORBA::Exception &ex) { ACE_CString error; error += "Caught CORBA exception while invoking preparePlan: "; error += ex._info (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch(...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") ACE_TEXT("An exception was thrown during EM->preparePlan.\n"))); throw Deployment_Failure ("An unexpected C++ exception was caught while invoking preparePlan"); } DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") ACE_TEXT ("after to call preparePlan\n"))); if (CORBA::is_nil (app_manager.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") ACE_TEXT("preparePlan call failed: ") ACE_TEXT("nil ApplicationManager reference\n"))); return 0; } else { DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") ACE_TEXT("ApplicationMAnager was received from preparePlan.\n"))); } return app_manager._retn (); }
void Plan_Launcher_Base_Impl< Manager, AppManager, Application> ::start (CORBA::Object_ptr app) { DANCE_TRACE ("Plan_Launcher_Base_Impl::start"); Application_var application (Application::_narrow (app)); if (CORBA::is_nil (application.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") ACE_TEXT("Nil Application reference.\n"))); throw Deployment_Failure ("Nil Application reference"); } try { DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") ACE_TEXT("before invoking start on application...\n"))); application->start (); DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") ACE_TEXT("after invoking start on application...\n"))); } catch (const ::Deployment::StartError &ex) { ACE_CString error; error += "Caught StartError exception while invoking start: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (const ::CORBA::Exception &ex) { ACE_CString error; error += "Caught CORBA exception while invoking start: "; error += ex._info ().c_str (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch(...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") ACE_TEXT("An exception was thrown during DA->start.\n"))); throw Deployment_Failure ("Unexpected C++ exception in start\n"); } }
CORBA::Object_ptr Plan_Launcher_Base_Impl< Manager, AppManager, Application> ::start_launch (CORBA::Object_ptr app_mgr, const ::Deployment::Properties &properties, ::Deployment::Connections_out connections) { DANCE_TRACE ("Plan_Launcher_Base_Impl::start_launch"); AppManager_var app_manager (AppManager::_narrow (app_mgr)); if (CORBA::is_nil (app_manager.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT ("Nil ApplicationManager reference\n"))); return 0; } Deployment::Application_var da; try { DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT("before startLaunch...\n"))); da = app_manager->startLaunch (properties, connections); DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT("startLaunch completed...\n"))); } catch (::Deployment::StartError &ex) { ACE_CString error; error += "Caught StartError exception while invoking startLaunch: " ; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::InvalidProperty &ex) { ACE_CString error; error += "Caught InvalidProperty exception while invoking startLaunch: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::InvalidNodeExecParameter &ex) { ACE_CString error; error += "Caught InvalidNodeExecParameter exception while invoking startLaunch: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::InvalidComponentExecParameter &ex) { ACE_CString error; error += "Caught InvalidComponentExecParameter exception while invoking startLaunch: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::ResourceNotAvailable &ex) { ACE_CString error; error += "Caught ResourceNotAvailable while invoking startLaunch: "; error += ex.name.in (); error += ", Type: <"; error += ex.resourceType.in (); error += "> Property Name: <"; error += ex.propertyName.in (); error += "> Element: <"; error += ex.elementName.in (); error += "> Resource Name: <"; error += ex.resourceName.in (); error += ">"; DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::CORBA::Exception &ex) { ACE_CString error; error += "Caught CORBA exception while invoking startLaunch: "; error += ex._info ().c_str (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch(...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT("An exception was thrown during DAM->startLaunch.\n"))); throw Deployment_Failure ("Unexpected C++ exception in startLaunch\n"); } if (CORBA::is_nil (da.in())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT("CIAO_PlanLauncher:startLaunch call failed: ") ACE_TEXT("nil DomainApplication reference\n"))); return 0; } else { DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") ACE_TEXT("DomainApplication was received from startLaunch\n"))); } return da._retn (); }
int TAO::HTIOP::Protocol_Factory::match_prefix (const ACE_CString &prefix) { // Check for the proper prefix for this protocol. return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0); }
int be_visitor_servant_svh::visit_consumes (be_consumes *node) { if(!be_global->gen_noeventccm ()) { const char *obj_name = node->consumes_type ()->full_name (); const char *port_name = node->local_name ()->get_string (); ACE_CString holder (obj_name); ACE_CString::size_type pos = holder.rfind (':'); const char *ev_lname = 0; if (pos == ACE_CString::npos) { ev_lname = obj_name; } else { holder = holder.substr (pos + 1); ev_lname = holder.c_str (); } os_ << be_uidt_nl << be_nl << "public:" << be_idt_nl; os_ << "// Servant class for the " << port_name << " consumer." << be_nl << "class " << export_macro_.c_str () << " " << ev_lname << "Consumer_" << port_name << "_Servant" << be_idt_nl << ": public virtual ::POA_" << obj_name << "Consumer" << be_uidt_nl << "{" << be_nl << "public:" << be_idt_nl; ACE_CString sname_str ( ScopeAsDecl (node_->defined_in ())->full_name ()); const char *sname = sname_str.c_str (); const char *lname = node_->local_name (); const char *global = (sname_str == "" ? "" : "::"); os_ << ev_lname << "Consumer_" << port_name << "_Servant (" << be_idt_nl << global << sname << "::CCM_" << lname << "_ptr executor," << be_nl << global << sname << "::CCM_" << lname << "_Context_ptr c);" << be_uidt_nl << be_nl; os_ << "virtual ~" << ev_lname << "Consumer_" << port_name << "_Servant (void);"; os_ << be_nl_2 << "virtual void" << be_nl << "push_" << ev_lname << " (" << be_idt_nl << "::" << obj_name << " * evt);" << be_uidt; os_ << be_nl_2 << "/// Inherited from ::Components::EventConsumerBase." << be_nl << "virtual void" << be_nl << "push_event ( ::Components::EventBase * ev);"; os_ << be_nl_2 << "/// Get component implementation." << be_nl << "virtual ::CORBA::Object_ptr" << be_nl << "_get_component (void);"; os_ << be_uidt_nl << be_nl << "protected:" << be_idt_nl; os_ << global << sname << "::CCM_" << lname << "_var" << be_nl << "executor_;"; os_ << be_nl_2 << global << sname << "::CCM_" << lname << "_Context_var" << be_nl << "ctx_;"; os_ << be_uidt_nl << "};"; if (!be_global->gen_lwccm ()) { os_ << be_nl_2 << "virtual ::" << obj_name << "Consumer_ptr" << be_nl << "get_consumer_" << port_name << " (void);"; } os_ << be_uidt_nl << be_nl << "private:" << be_idt_nl; os_ << "void" << be_nl << "setup_consumer_" << port_name << "_i (void);"; os_ << be_uidt_nl << be_nl << "private:" << be_idt_nl; os_ << "::" << obj_name << "Consumer_var" << be_nl << "consumes_" << port_name << "_;"; } return 0; }
void Obj_Module::add_source(const char *p, int imports_only) { ACE_Process nmproc; ACE_Process_Options nm_opts; ACE_CString path (p); ACE_CString::size_type pathsep = path.rfind('/'); ACE_CString src_name; ACE_CString workpath; if (pathsep == ACE_CString::npos) { src_name = path; workpath = "."; } else { src_name = path.substr(pathsep+1); workpath= path.substr(0,pathsep); } ACE_HANDLE pipe[2]; ACE_Pipe io(pipe); nm_opts.working_directory (workpath.c_str()); nm_opts.set_handles (ACE_STDIN,pipe[1]); // Options for the command line shown here are for the GNU nm 2.9.5 int result = nm_opts.command_line ("nm -C %s",src_name.c_str()); // Prevent compiler warning about "unused variable" if ACE_ASSERT is // an empty macro. ACE_UNUSED_ARG (result); ACE_ASSERT (result == 0); nmproc.spawn (nm_opts); if (ACE_OS::close(pipe[1]) == -1) ACE_DEBUG ((LM_DEBUG, "%p\n", "close")); nm_opts.release_handles(); int import_lines = 0; int export_lines = 0; ACE_Message_Block im_buffer (102400); ACE_Message_Block ex_buffer (102400); ACE_Message_Block *im_buf_cur = &im_buffer; ACE_Message_Block *ex_buf_cur = &ex_buffer; char dummy; int eoln = 1; // ACE_Time_Value timeout (1,0); int is_import = 1; int is_export = 1; while (eoln == 1) { for (int i = 0; i < 10; i++) { if (ACE_OS::read(pipe[0],&dummy,1) != 1) { eoln = 2; break; } } if (eoln == 2) break; is_import = dummy == 'U'; is_export = !imports_only && (ACE_OS::strchr("BCDRTVW",dummy) != 0); // if (ACE::recv(pipe[0],&dummy,1,&timeout) != 1) if (ACE_OS::read(pipe[0],&dummy,1) != 1) break; eoln = this->read_line (pipe[0], is_import ? &im_buf_cur : (is_export ? &ex_buf_cur : 0)); import_lines += is_import; export_lines += is_export; } // ACE_DEBUG ((LM_DEBUG, "read %d import lines and %d export lines\n", // import_lines, export_lines)); nmproc.wait (); ACE_OS::close (pipe[0]); this->populate_sig_list (imports_,import_lines,&im_buffer); if (!imports_only) this->populate_sig_list (exports_,export_lines,&ex_buffer); }
int be_visitor_servant_svs::visit_consumes (be_consumes *node) { AST_Type *obj = node->consumes_type (); const char *port_name = node->local_name ()->get_string (); const char *comp_lname = node_->local_name (); ACE_CString comp_sname_str ( ScopeAsDecl (node_->defined_in ())->full_name ()); const char *comp_sname = comp_sname_str.c_str (); const char *global = (comp_sname_str == "" ? "" : "::"); const char *lname = obj->local_name ()->get_string (); const char *fname = obj->full_name (); os_ << be_nl_2 << comp_lname << "_Servant::" << lname << "Consumer_" << port_name << "_Servant::" << lname << "Consumer_" << port_name << "_Servant (" << be_idt << be_idt_nl << global << comp_sname << "::CCM_" << comp_lname << "_ptr executor," << be_nl << global << comp_sname << "::CCM_" << comp_lname << "_Context_ptr c)" << be_uidt_nl << ": executor_ ( " << global << comp_sname << "::CCM_" << comp_lname << "::_duplicate (executor))," << be_idt_nl << "ctx_ ( " << global << comp_sname << "::CCM_" << comp_lname << "_Context::_duplicate (c))" << be_uidt << be_uidt_nl << "{" << be_nl << "}"; os_ << be_nl_2 << comp_lname << "_Servant::" << lname << "Consumer_" << port_name << "_Servant::~" << lname << "Consumer_" << port_name << "_Servant (void)" << be_nl << "{" << be_nl << "}"; os_ << be_nl_2 << "::CORBA::Object_ptr" << be_nl << comp_lname << "_Servant::" << lname << "Consumer_" << port_name << "_Servant::_get_component (void)" << be_nl << "{" << be_idt_nl; if (ACE_OS::strcmp (be_global->ciao_container_type (), "Session") == 0) { os_ << "return this->ctx_->get_CCM_object ();"; } else { os_ << "return ::CORBA::Object::_nil ();"; } os_ << be_uidt_nl << "}"; os_ << be_nl_2 << "void" << be_nl << comp_lname << "_Servant::" << lname << "Consumer_" << port_name << "_Servant::push_" << lname << " (" << be_idt_nl << "::" << fname << " * evt)" << be_uidt_nl << "{" << be_idt_nl << "this->executor_->push_" << port_name << " (evt);" << be_uidt_nl << "}"; os_ << be_nl_2 << "/// Inherited from ::Components::EventConsumerBase." << be_nl << "void" << be_nl << comp_lname << "_Servant::" << lname << "Consumer_" << port_name << "_Servant::push_event (" << be_idt_nl << "::Components::EventBase * ev)" << be_uidt_nl << "{" << be_idt_nl << "::" << fname << " * ev_type =" << be_idt_nl << "::" << fname << "::_downcast (ev);" << be_uidt_nl << be_nl << "if (ev_type != 0)" << be_idt_nl << "{" << be_idt_nl << "this->push_" << lname << " (ev_type);" << be_nl << "return;" << be_uidt_nl << "}" << be_uidt_nl << be_nl << "throw ::Components::BadEventType ();" << be_uidt_nl << "}"; if (!be_global->gen_lwccm ()) { os_ << be_nl_2 << "::" << fname << "Consumer_ptr" << be_nl << node_->local_name () << "_Servant::get_consumer_" << port_name << " (void)" << be_nl << "{" << be_idt_nl << "return" << be_idt_nl << "::" << fname << "Consumer::_duplicate (" << be_idt_nl << "this->consumes_" << port_name << "_.in ());" << be_uidt << be_uidt << be_uidt_nl << "}"; } os_ << be_nl_2 << "void" << be_nl << node_->local_name () << "_Servant::setup_consumer_" << port_name << "_i (void)" << be_nl << "{" << be_idt_nl << "ACE_CString obj_id (this->ins_name_);" << be_nl << "obj_id += \"_" << port_name << "\";" << be_nl_2 << "::CIAO::Container_var cnt_safe =" << be_idt_nl << "::CIAO::Container::_duplicate (" << "this->container_.in ());" << be_uidt_nl << be_nl << "if (::CORBA::is_nil (cnt_safe.in ()))" << be_idt_nl << "{" << be_idt_nl << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl << "}" << be_uidt_nl << be_nl << "PortableServer::POA_var POA = cnt_safe->the_port_POA ();" << be_nl << node_->local_name () << "_Servant::" << lname << "Consumer_" << port_name << "_Servant *" << port_name << "_servant_impl = " << be_idt_nl << "new " << node_->local_name () << "_Servant::" << lname << "Consumer_" << port_name << "_Servant (" << be_idt_nl << " this->executor_, this->context_);" << be_uidt_nl << be_uidt_nl << be_nl << "PortableServer::ServantBase_var safe_base_servant (" << port_name << "_servant_impl);" << be_nl << "PortableServer::ObjectId_var " << port_name << "_servant_oid =" << be_idt_nl << "PortableServer::string_to_ObjectId (obj_id.c_str());" << be_uidt_nl << be_nl << "POA->activate_object_with_id(" << be_idt_nl << port_name << "_servant_oid.in()," << be_nl << port_name << "_servant_impl);" << be_uidt_nl << be_nl << "::CORBA::Object_var " << port_name << "_servant_impl_obj = " << be_idt_nl << "cnt_safe->generate_reference ( " << be_idt_nl << "obj_id.c_str ()," << be_nl << "\""; ACE_CString work (obj->repoID ()); ACE_CString result (work.substr (0, work.rfind (':'))); result += "Consumer:1.0"; os_ << result.c_str (); os_ << "\"," << be_nl << "::CIAO::Container_Types::FACET_CONSUMER_t);" << be_uidt_nl << be_uidt_nl << "::Components::EventConsumerBase_var ecb =" << be_idt_nl << "::Components::EventConsumerBase::_narrow (" << port_name << "_servant_impl_obj.in ());" << be_uidt_nl << be_nl << "this->add_consumer (\"" << port_name << "\", ecb.in ());" << be_uidt_nl << "}"; return 0; }
int be_visitor_servant_svs::visit_uses (be_uses *node) { if (node->uses_type ()->is_local () || be_global->gen_lwccm ()) { return 0; } ACE_CString prefix (this->ctx_->port_prefix ()); prefix += node->local_name ()->get_string (); const char *port_name = prefix.c_str (); const char *obj_name = node->uses_type ()->full_name (); bool const is_multiple = node->is_multiple (); os_ << be_nl_2 << (is_multiple ? "::Components::Cookie *" : "void") << be_nl << node_->local_name () << "_Servant::connect_" << port_name << " (" << be_idt_nl << "::" << obj_name << "_ptr c)" << be_uidt_nl << "{" << be_idt_nl; if (is_multiple) { os_ << "return "; } os_ << "this->context_->connect_" << port_name << " (c);" << be_uidt_nl << "}"; os_ << be_nl_2 << "::" << obj_name << "_ptr" << be_nl << node_->local_name () << "_Servant::disconnect_" << port_name << " ("; if (is_multiple) { os_ << be_idt_nl << "::Components::Cookie * ck" << be_uidt; } else { os_ << "void"; } os_ << ")" << be_nl << "{" << be_idt_nl << "return this->context_->disconnect_" << port_name << " (" << (is_multiple ? "ck" : "") << ");" << be_uidt_nl << "}"; os_ << be_nl_2 << "::"; if (is_multiple) { os_ << node_->full_name () << "::" << port_name << "Connections *"; } else { os_ << obj_name << "_ptr"; } os_ << be_nl << node_->local_name () << "_Servant::get_connection" << (is_multiple ? "s" : "") << "_" << port_name << " (void)" << be_nl << "{" << be_idt_nl << "return this->context_->get_connection" << (is_multiple ? "s" : "") << "_" << port_name << " ();" << be_uidt_nl << "}"; return 0; }
int be_visitor_servant_svs::visit_provides (be_provides *node) { if (node->provides_type ()->is_local ()) // @TODO || be_global->gen_lwccm ()) { return 0; } ACE_CString prefix (this->ctx_->port_prefix ()); prefix += node->local_name ()->get_string (); const char *port_name = prefix.c_str (); AST_Type *obj = node->provides_type (); const char *obj_name = obj->full_name (); AST_Decl *scope = ScopeAsDecl (obj->defined_in ()); ACE_CString sname_str (scope->full_name ()); const char *sname = sname_str.c_str (); // Avoid '_cxx_' prefix. const char *lname = obj->original_local_name ()->get_string (); const char *global = (sname_str == "" ? "" : "::"); const char *prefix_connector = (sname_str == "" ? "" : "_"); if (!be_global->gen_lwccm ()) { os_ << be_nl_2 << "::" << obj_name << "_ptr" << be_nl << node_->local_name () << "_Servant::provide_" << port_name << " (void)" << be_nl << "{" << be_idt_nl; os_ << "return" << be_idt_nl << "::" << obj_name << "::_duplicate (this->provide_" << port_name << "_.in ());" << be_uidt << be_uidt_nl << "}"; } os_ << be_nl_2 << "void" << be_nl << node_->local_name () << "_Servant::setup_" << port_name << "_i (void)" << be_nl << "{" << be_idt_nl << "ACE_CString obj_id (this->ins_name_);" << be_nl << "obj_id += \"_" << port_name << "\";" << be_nl_2 << "::CIAO::Container_var cnt_safe =" << be_idt_nl << "::CIAO::Container::_duplicate (" << "this->container_.in ());" << be_uidt_nl << be_nl << "if (::CORBA::is_nil (cnt_safe.in ()))" << be_idt_nl << "{" << be_idt_nl << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl << "}" << be_uidt_nl << be_nl << "PortableServer::POA_var POA = cnt_safe->the_port_POA ();" << be_nl << "::CORBA::Object_var tmp =" << be_idt_nl << "this->get_facet_executor (\"" << port_name << "\");"<< be_uidt_nl << be_nl << global << sname << "::CCM_" << lname << "_var tmp_var = " << be_idt_nl << global << sname <<"::CCM_" << lname << "::_narrow (tmp.in());" << be_uidt_nl << be_nl << "typedef " << global << "CIAO_FACET" << prefix_connector << scope->flat_name () << "::" << obj->local_name () << "_Servant_T <" << be_idt_nl << "POA_" << sname << global << obj->local_name () << "," << be_nl << global << sname <<"::CCM_" << lname << "," << be_nl << global << "Components::" << be_global->ciao_container_type () << "Context>" << be_idt_nl << lname << "_type;" << be_uidt_nl << be_uidt_nl << lname << "_type *" << port_name << "_servant_impl = 0;" << be_nl << "ACE_NEW_THROW_EX (" << be_idt_nl << port_name << "_servant_impl," << be_nl << lname << "_type (" << be_idt_nl << "tmp_var.in(), " << be_nl << "this->context_)," << be_uidt_nl << "CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl << "PortableServer::ServantBase_var safe_base_servant (" << port_name << "_servant_impl);" << be_nl << be_nl << "PortableServer::ObjectId_var " << port_name << "_servant_oid =" << be_idt_nl << "PortableServer::string_to_ObjectId (obj_id.c_str());" << be_uidt_nl << be_nl << "POA->activate_object_with_id(" << port_name << "_servant_oid.in()," << port_name << "_servant_impl);" << be_nl << "::CORBA::Object_var " << port_name << "_servant_impl_obj = " << be_idt_nl << "cnt_safe->generate_reference ( " << be_idt_nl << "obj_id.c_str ()," << be_nl << "\"" << obj->repoID () << "\"," << be_nl << "::CIAO::Container_Types::FACET_CONSUMER_t);" << be_uidt_nl << be_uidt_nl << "this->add_facet (\"" << port_name << "\", " << port_name << "_servant_impl_obj.in ());" << be_uidt_nl << "}"; return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR* argv[]){ u_long priority_mask = ACE_LOG_MSG->priority_mask (ACE_Log_Msg::PROCESS); ACE_CLR_BITS (priority_mask, LM_DEBUG|LM_TRACE); ACE_LOG_MSG->priority_mask (priority_mask, ACE_Log_Msg::PROCESS); ACE_CString* e = new ACE_CString("1000100000000000"); bn* _pq = new bn(0x10);/* */ _pq->addat(0, 0x3021802f); _pq->addat(1, 0x4c5faba9); _pq->addat(2, 0x18f820dc); _pq->addat(3, 0xc8a28aab); _pq->addat(4, 0x02de8542); _pq->addat(5, 0x8e301566); _pq->addat(6, 0xce281be5); _pq->addat(7, 0x346b2199); _pq->addat(8, 0xd8335836); _pq->addat(9, 0x59cebc36); _pq->addat(10, 0x4b768f8d); _pq->addat(11, 0xda316c22); _pq->addat(12, 0xd6c0f9f4); _pq->addat(13, 0xc46b3a0e); _pq->addat(14, 0x045015c0); _pq->addat(15, 0xbf78c2f6); // _pq->subat(0,0x1); bn* _e = from_hex(e); bn* _d = new bn(0x10); _d->addat(0, 0xf4e5789b); _d->addat(1, 0x27c688d4); _d->addat(2, 0x40cb88fd); _d->addat(3, 0xe8c4c59d); _d->addat(4, 0x6b611a0e); _d->addat(5, 0x4493cfe9); _d->addat(6, 0x6a4d2e51); _d->addat(7, 0x58e231d1); _d->addat(8, 0xafefffe3); _d->addat(9, 0xae1d348b); _d->addat(10, 0x8d147a03); _d->addat(11, 0xddd6a6c5); _d->addat(12, 0x95749cf1); _d->addat(13, 0x5790ba88); _d->addat(14, 0x327997a7); _d->addat(15, 0x8f07aed1); bn* _jg = new bn(0xa); _jg->addat(0, 0xa3e6f7bb); _jg->addat(1, 0xb4594256); _jg->addat(2, 0x059555cf); _jg->addat(3, 0x503806c8); _jg->addat(4, 0x1d775b9f); _jg->addat(5, 0x0667d89e); _jg->addat(6, 0x52ff1ca5); _jg->addat(7, 0x37cd8aa6); _jg->addat(8, 0xf92ec894); _jg->addat(9, 0x674e57d3); _jg->addat(10, 0x1e8516); bn* tmp = new bn(1); tmp->addat(0,0x12345678); bn* _ed = mul(_e, _d); bn* _fv = mul(_ed, _jg); // bn* v = (tmp, _fv, _pq); ACE_CString* str = v->to_hex(); ACE_DEBUG((LM_INFO, "%s\n", str->c_str())); delete str; delete v; delete _ed; delete _pq; delete _e; delete _d; delete tmp; // delete pq; delete e; // delete d; delete _jg; delete _fv; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int status = 0; bool set_cert_file = true; try { // This has to be done before calling CORBA::ORB_init() and // parse_args() has to be called after CORBA::ORB_init(), so we // will look at argv manually. for(int i = 0; i < argc; i++) { if (ACE_OS::strcmp(argv[i], ACE_TEXT("-n")) == 0) { set_cert_file = false; break; } } ACE_CString env ("SSL_CERT_FILE="); env += cert_file; if (set_cert_file) { ACE_OS::putenv (env.c_str ()); } CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var object = orb->string_to_object (ior); if (set_cert_file) { // This test sets creates a Security::QOPPolicy with the // Quality-of-Protection set to "no protection." It then // invokes a method on the server (insecurely), which should // then result in a CORBA::NO_PERMISSION exception. // // The server is not shutdown by this test. status = insecure_invocation_test (orb.in (), object.in ()); ACE_DEBUG ((LM_DEBUG, "insecure_invocation_test returned <%d>\n", status)); } // This test uses the default secure SSLIOP settings to securely // invoke a method on the server. No exception should occur. // // The server *is* shutdown by this test. try { status = secure_invocation_test (object.in ()); ACE_DEBUG ((LM_DEBUG, "secure_invocation_test returned <%d>\n", status)); } catch (const CORBA::Exception &ex) { if (set_cert_file) { ex._tao_print_exception ("Caught unexpected exception " "(probable failure):"); status = 1; } else { ACE_DEBUG ((LM_DEBUG, "Caught an exception as expected due " "to the SSL_CERT_FILE environment " "variable not being set.\n")); } } orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception in main:"); return 1; } if (status == 0) { ACE_DEBUG ((LM_DEBUG, "\n" "Bug_1107_Regression test passed.\n")); } return status; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; try { // Start the Naming Service tasks NamingTask name_service ("NamingORBA", argc, argv); name_service.activate(); // Wait for the Naming Service initialized. name_service.waitInit(); ACE_Argv_Type_Converter satc (argc, argv); CORBA::ORB_var sorb = CORBA::ORB_init (satc.get_argc (), satc.get_TCHAR_argv (), server_orb.c_str ()); ACE_Manual_Event me; Server_Task server_task (name_service.root (), sorb.in (), me, ACE_Thread_Manager::instance ()); if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, 1, 1) == -1) { ACE_ERROR ((LM_ERROR, "Error activating server task\n")); } // Wait for the server thread to do some processing me.wait (); ACE_Argv_Type_Converter catc (argc, argv); CORBA::ORB_var corb = CORBA::ORB_init (catc.get_argc (), catc.get_TCHAR_argv (), client_orb.c_str ()); Client_Task client_task (name_service.root (), corb.in (), ACE_Thread_Manager::instance (), result); if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, 1, 1) == -1) { ACE_ERROR ((LM_ERROR, "Error activating client task\n")); } // Wait for the client and server to finish ACE_Thread_Manager::instance ()->wait (); // Now that all threads have completed we can destroy the ORB sorb->destroy (); if (server_orb != client_orb) { corb->destroy (); } } catch (const CORBA::Exception&) { // Ignore exceptions.. } return 0; }
int launch_plan (const Options &opts, DAnCE::Plan_Launcher_Base *pl_base, const ::Deployment::DeploymentPlan *plan, CORBA::ORB_ptr orb) { DANCE_TRACE ("launch_plan"); try { CORBA::Object_var app_mgr, app; CORBA::String_var uuid_safe (pl_base->launch_plan (*plan, app_mgr.out () , app.out ())); ACE_CString uuid = uuid_safe.in (); DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_NOTICE, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Successfully deployed plan ") ACE_TEXT ("with UUID: <%C>\n"), uuid.c_str ())); if (!opts.output_) return 0; ACE_TString am_output, app_output; if (opts.output_prefix_) am_output = app_output = opts.output_prefix_; else am_output = app_output = ACE_TEXT_CHAR_TO_TCHAR (uuid.c_str ()); am_output += ACE_TEXT ("_AM.ior"); app_output += ACE_TEXT ("_APP.ior"); DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Writing Application Manager IOR to <%s>\n"), am_output.c_str ())); CORBA::String_var tmp = orb->object_to_string (app_mgr.in ()); write_IOR (am_output.c_str (), tmp.in ()); DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Writing Application IOR to <%s>\n"), am_output.c_str ())); tmp = orb->object_to_string (app.in ()); write_IOR (app_output.c_str (), tmp.in ()); } catch (const DAnCE::Deployment_Failure &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Deployment failed, exception: %C\n"), ex.ex_.c_str ())); } return 1; } catch (const Deployment::PlanError &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Caught PlanError exception: %C, %C\n"), ex.name.in (), ex.reason.in () )); } return 1; } catch (const Deployment::StartError &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Caught PlanError exception: %C, %C\n"), ex.name.in (), ex.reason.in () )); } return 1; } catch (const Deployment::StopError &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Caught PlanError exception: %C, %C\n"), ex.name.in (), ex.reason.in () )); } return 1; } catch (const CORBA::Exception &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Deployment failed, caught CORBA exception %C\n"), ex._info ().c_str ())); } return 1; } catch (...) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") ACE_TEXT ("Deployment failed, ") ACE_TEXT ("caught unknown C++ exception\n"))); } return 1; } return 0; }
void alarm_cleared ( ACS::pattern value, const ACSErr::Completion & c, const ACS::CBDescOut & desc ) { ACE_DEBUG ((LM_DEBUG, "(%s::AlarmCBStates::cleared) Value: %s (%Q). Completion (type=%d, code=%d)", prop.c_str(),description[value].in(), value, c.type, c.code)); }
int teardown_plan (const Options &opts, DAnCE::Plan_Launcher_Base *pl_base, const ::Deployment::DeploymentPlan *plan, CORBA::ORB_ptr orb) { DANCE_TRACE ("teardown_plan"); int rc = 0; try { CORBA::Object_var am; CORBA::Object_var app; if (opts.am_ior_ && opts.app_ior_) { DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Tearing down plan with explicitly ") ACE_TEXT ("nominated App and AM IORs.\n"))); am = orb->string_to_object (opts.am_ior_); app = orb->string_to_object (opts.app_ior_); } else { // Need to perform lookup by uuid, // either explicitly provided or in plan. ACE_CString uuid; if (plan) uuid = plan->UUID.in (); else uuid = ACE_TEXT_ALWAYS_CHAR (opts.uuid_); DAnCE::EM_Launcher *em_launcher = dynamic_cast <DAnCE::EM_Launcher *> (pl_base); if (!em_launcher) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Error: Attempting UUID lookup on non") ACE_TEXT ("-EM managed plan not supported\n"))); return 1; } if (em_launcher->lookup_by_uuid (uuid.c_str (), am.out (), app.out ())) { DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Tearing down plan with UUID %C\n"), uuid.c_str ())); } else { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Error: Lookup by UUID failed\n"))); return 1; } } try { pl_base->teardown_application (am, app); } catch (const DAnCE::Deployment_Failure &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Application Teardown failed, exception: %C\n"), ex.ex_.c_str ())); } rc = 1; } catch (const CORBA::Exception &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Application Teardown failed, ") ACE_TEXT ("caught CORBA exception %C\n"), ex._info ().c_str ())); } rc = 1; } catch (...) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Application Teardown failed, ") ACE_TEXT ("caught unknown C++ exception\n"))); } rc = 1; } if (rc == 0 || opts.force_) pl_base->destroy_app_manager (am); } catch (const DAnCE::Deployment_Failure &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Teardown failed, exception: %C\n"), ex.ex_.c_str ())); } return 1; } catch (const CORBA::Exception &ex) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Teardown failed, caught CORBA exception %C\n"), ex._info ().c_str ())); } return 1; } catch (...) { if (!opts.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::teardown_plan - ") ACE_TEXT ("Teardown failed, ") ACE_TEXT ("caught unknown C++ exception\n"))); } return 1; } return rc; }
int ACE_TMAIN (int argc, ACE_TCHAR** argv) { Kokyu::ConfigInfoSet config_info(3); int hi_prio, me_prio, lo_prio; int sched_policy=ACE_SCHED_FIFO; Kokyu::Dispatcher_Attributes attrs; if (parse_args (argc, argv) == -1) return 0; if (ACE_OS::strcasecmp(sched_policy_str.c_str(), "fifo") == 0) { sched_policy = ACE_SCHED_FIFO; } else if (ACE_OS::strcasecmp(sched_policy_str.c_str(), "other") == 0) { sched_policy = ACE_SCHED_OTHER; } else if (ACE_OS::strcasecmp(sched_policy_str.c_str(), "rr") == 0) { sched_policy = ACE_SCHED_RR; } attrs.sched_policy (sched_policy); hi_prio = ACE_Sched_Params::priority_max (sched_policy); me_prio = ACE_Sched_Params::previous_priority (sched_policy, hi_prio); lo_prio = ACE_Sched_Params::previous_priority (sched_policy, me_prio); config_info[0].preemption_priority_ = 1; config_info[0].thread_priority_ = hi_prio ; config_info[0].dispatching_type_ = Kokyu::FIFO_DISPATCHING; config_info[1].preemption_priority_ = 2; config_info[1].thread_priority_ = me_prio; config_info[1].dispatching_type_ = Kokyu::FIFO_DISPATCHING; config_info[2].preemption_priority_ = 3; config_info[2].thread_priority_ = lo_prio; config_info[2].dispatching_type_ = Kokyu::FIFO_DISPATCHING; attrs.config_info_set_ = config_info; ACE_DEBUG ((LM_DEBUG, "before create_dispatcher\n" )); auto_ptr<Kokyu::Dispatcher> disp (Kokyu::Dispatcher_Factory::create_dispatcher (attrs)); ACE_ASSERT (disp.get() != 0); MyCommand cmd1(1), cmd2(2), cmd3(3); Kokyu::QoSDescriptor qos1, qos2, qos3; qos1.preemption_priority_ = 2; ACE_DEBUG ((LM_DEBUG, "Priority of command1 is %d\n", qos1.preemption_priority_)); qos2.preemption_priority_ = 3; ACE_DEBUG ((LM_DEBUG, "Priority of command2 is %d\n", qos2.preemption_priority_)); qos3.preemption_priority_ = 1; ACE_DEBUG ((LM_DEBUG, "Priority of command3 is %d\n", qos3.preemption_priority_)); if (disp->dispatch (&cmd1, qos1) == -1 || disp->dispatch (&cmd2, qos2) == -1 || disp->dispatch (&cmd3, qos3) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error in dispatching command object\n"), -1); if (disp->activate () == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error activating dispatcher. ") ACE_TEXT ("You might not have superuser privileges ") ACE_TEXT ("to run FIFO class. Try \"-p other\"\n")), -1); } disp->shutdown (); ACE_DEBUG ((LM_DEBUG, "after shutdown\n")); return 0; }
// // generate // int CUTS_Dmac_File_Vertical_Generator:: generate (ACE_CString & db_file, int round) { ifstream data_file (db_file.c_str ()); this->row_count_ = 0; if (data_file.is_open()) { CUTS_DMAC_UTILS::sequence_details word_index; vertical_list_t vertical_list; std::set <std::string> word_list; std::set <std::string>::iterator it1; std::string delim (this->delims_.c_str ()); int count = 1; // Read line by line and tokenize while (data_file.good ()) { std::string row; getline (data_file, row); CUTS_Dmac_Vertical_Format * format = new CUTS_Dmac_Vertical_Format (); this->tokenize (row, word_list, delim, format); format->tid (count); vertical_list.push_back (format); count++; } this->row_count_ = count - 1; int number = 1; // print the vertical list to the file for (it1 = word_list.begin (); it1 != word_list.end (); it1++) { word_index.insert (std::pair <std::string, int> (*it1, number)); number++; } std::stringstream output_file; std::ofstream output; output_file << round << ".data"; output.open (output_file.str ().c_str ()); v_iter it2; for (it2 = vertical_list.begin (); it2 != vertical_list.end (); it2++) { ((CUTS_Dmac_Vertical_Format *)(*it2))->populate (word_index); ((CUTS_Dmac_Vertical_Format *)(*it2))->print_row_words (output); } output.close (); data_file.close (); return 1; } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%T (%t) - %M - failed to open %s\n"), db_file.c_str ()), -1); } }
void Plan_Launcher_Base_Impl< Manager, AppManager, Application> ::finish_launch (CORBA::Object_ptr app, const ::Deployment::Connections &provided_connections, bool start) { DANCE_TRACE ("Plan_Launcher_Base_Impl::finish_launch"); Application_var application (Application::_narrow (app)); if (CORBA::is_nil (application.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") ACE_TEXT("Nil Application reference.\n"))); throw Deployment_Failure ("Nil Application reference"); } // Call finish Launch to complete the connections try { DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") ACE_TEXT("before finishLaunch\n"))); application->finishLaunch (provided_connections, start); DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") ACE_TEXT("finishLaunch completed.\n"))); } catch (::Deployment::InvalidConnection &ex) { ACE_CString error; error += "Caught InvalidConnection exception while invoking finishLaunch: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::Deployment::StartError &ex) { ACE_CString error; error += "Caught StartError exception while invoking finishLaunch: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (::CORBA::Exception &ex) { ACE_CString error; error += "Caught CORB exception while invoking finishLaunch: "; error += ex._info (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch(...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - ") ACE_TEXT("An exception was thrown during DA->finishLaunch.\n"))); throw Deployment_Failure ("Unexpected C++ exception in finishLaunch"); } }
// // generate // int CUTS_Dmac_DB_Vertical_Generator:: generate (ACE_CString & db_file, int round) { CUTS_Test_Database testdata; if (!testdata.open (db_file)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%T (%t) - %M - failed to open %s\n"), db_file.c_str()), -1); // Create the query ADBC::SQLite::Query * query = testdata.create_query (); CUTS_Auto_Functor_T <ADBC::SQLite::Query> auto_clean ( query, &ADBC::SQLite::Query::destroy); ADBC::SQLite::Record * record = &query->execute ( "SELECT * FROM cuts_logging ORDER BY lid"); char message [10000]; int count = 1; // Tokenize thr trace and convert to vertical data format CUTS_DMAC_UTILS::sequence_details word_index; CUTS_Dmac_Vertical_Generator::vertical_list_t vertical_list; std::set <std::string> word_list; std::set <std::string>::iterator it1; std::string delim (this->delims_.c_str ()); for ( ; !record->done (); record->advance ()) { // Get the message from the row. record->get_data (5, message, sizeof (message)); std::string row (message); CUTS_Dmac_Vertical_Format * format = new CUTS_Dmac_Vertical_Format (); //CUTS_Dmac_Vertical_Generator:: this->tokenize (row, word_list, delim, format); format->tid (count); vertical_list.push_back (format); count++; } record->reset (); int number = 1; // print the vertical list for (it1 = word_list.begin (); it1 != word_list.end (); it1++) { word_index.insert (std::pair <std::string, int> (*it1, number)); number++; } std::stringstream output_file; std::ofstream output; // The vvertical format needs to be stored in a file called with .data // extension. output_file << round << ".data"; output.open (output_file.str ().c_str ()); v_iter it2; for (it2 = vertical_list.begin (); it2 != vertical_list.end (); it2++) { ((CUTS_Dmac_Vertical_Format *)(*it2))->populate (word_index); ((CUTS_Dmac_Vertical_Format *)(*it2))->print_row_words (output); } output.close (); return 1; }
void Plan_Launcher_Base_Impl< Manager, AppManager, Application> ::teardown_application (CORBA::Object_ptr am_obj, CORBA::Object_ptr app_obj) { DANCE_TRACE ("Plan_Launcher_Base_Impl::teardown_application"); AppManager_var am (AppManager::_narrow (am_obj)); if (CORBA::is_nil (am.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - ") ACE_TEXT("Nil ApplicationManager reference.\n"))); throw Deployment_Failure ("Nil ApplicationManager reference in teardown_application"); } Application_var app (Application::_narrow (app_obj)); if (CORBA::is_nil (app.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_appliocation - ") ACE_TEXT("Nil Application reference.\n"))); throw Deployment_Failure ("Nil Application reference in teardown_application"); } try { am->destroyApplication (app.in ()); } catch (const ::Deployment::StopError &ex) { ACE_CString error; error += "Caught StopError exception while invoking destroyApplication: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (const CORBA::Exception &ex) { ACE_CString error; error += "Caught CORBA exception while invoking destroyApplication: "; error += ex._info ().c_str (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_appliocation - ") ACE_TEXT ("Caught unknown C++ exception\n"))); throw Deployment_Failure ("Unknown C++ exception\n"); } }
void ErrorTraceHelper::setMemberValue (const char* name, ACE_CString& value) { setMemberValue(name, value.c_str()); }
void Plan_Launcher_Base_Impl< Manager, AppManager, Application>::destroy_app_manager(CORBA::Object_ptr am_obj) { DANCE_TRACE ("Plan_Launcher_Base_Impl::destroy_app_manager"); AppManager_var am (AppManager::_narrow (am_obj)); if (CORBA::is_nil (am.in ())) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") ACE_TEXT("Nil ApplicationManager reference.\n"))); throw Deployment_Failure ("Nil ApplicationManager reference in destroy_app_manager"); } try { DANCE_ERROR (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") ACE_TEXT ("Destroying ApplicationManager\n"))); this->manager_->destroyManager (am.in ()); DANCE_ERROR (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") ACE_TEXT ("ApplicationManager destroyed.\n"))); } catch (const ::Deployment::StopError &ex) { ACE_CString error; error += "Caught StopError exception while invoking destroyManager: "; error += ex.name.in (); error += ", "; error += ex.reason.in (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destory_app_manager - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (const CORBA::Exception &ex) { ACE_CString error; error += "Caught CORBA exception while invoking destroyManager: "; error += ex._info ().c_str (); DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - %C\n"), error.c_str ())); throw Deployment_Failure (error); } catch (...) { DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") ACE_TEXT ("Caught unknown C++ exception\n"))); throw Deployment_Failure ("Unknown C++ exception\n"); } }
int be_visitor_ami_pre_proc::visit_interface (be_interface *node) { // We check for an imported node after generating the reply handler. if (node->is_local () || node->is_abstract ()) { return 0; } // The following 3 IF blocks are checks for CCM-related nodes, which // we want to skip until we get AMI integrated with CIAO. // Skip the *EventConsumer added for each eventtype. if (node->is_event_consumer ()) { return 0; } // Check for home equivalent interface. The lookup will find the // home itself, which was declared first. Identifier *node_lname = node->AST_Decl::local_name (); AST_Decl *first_stored = node->defined_in ()->lookup_by_name_local (node_lname, false); if (0 != first_stored && first_stored->node_type () == AST_Decl::NT_home) { return 0; } ACE_CString lname (node_lname->get_string ()); // Skip the *Explict and *Implicit interfaces added for a home. if (lname.substr (lname.length () - 6) == "plicit") { UTL_Scope *s = node->defined_in (); Identifier local_id (lname.substr (0, lname.length () - 8).c_str ()); AST_Decl *d = s->lookup_by_name_local (&local_id, false); local_id.destroy (); if (0 != d) { return 0; } } AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ()); if (!module) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_ami_pre_proc::" "visit_interface - " "module is null\n"), -1); } be_interface *reply_handler = this->create_reply_handler (node); if (reply_handler) { reply_handler->set_defined_in (node->defined_in ()); // Insert the ami handler after the node, the // exception holder will be placed between these two later. module->be_add_interface (reply_handler, node); // Remember from whom we were cloned reply_handler->original_interface (node); // If this was created for an imported node, it will be wrong // unless we set it. reply_handler->set_imported (node->imported ()); } else { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_ami_pre_proc::" "visit_interface - " "creating the reply handler failed\n"), -1); } if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_ami_pre_proc::" "visit_interface - " "visit scope failed\n"), -1); } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize the ORB first. CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); int result = parse_args (argc, argv); if (result != 0) return result; // Obtain the RootPOA. CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); // Get the POA_var object from Object_var. PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); // Get the POAManager of the RootPOA. PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); // Policies for the firstPOA to be created. CORBA::PolicyList policies (3); policies.length (3); // Id Assignment Policy policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID); // Lifespan policy policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT); // Threading policy policies[2] = root_poa->create_thread_policy (PortableServer::ORB_CTRL_MODEL); // Create the firstPOA under the RootPOA. ACE_CString name = "firstPOA"; PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (), poa_manager.in (), policies); policies[2]->destroy (); // Threading policy policies[2] = root_poa->create_thread_policy (PortableServer::SINGLE_THREAD_MODEL); // Create the secondPOA under the firstPOA. name = "secondPOA"; PortableServer::POA_var second_poa = first_poa->create_POA (name.c_str (), poa_manager.in (), policies); // Creation of POAs is over. Destroy the Policy objects. for (CORBA::ULong i = 0; i < policies.length (); ++i) { policies[i]->destroy (); } // Create two Objects of Class test_i (defined in // ./../GenericServant/test_i.h) Create one object at RootPOA // and the other at firstPOA. test_i first_servant (orb.in (), root_poa.in ()); test_i second_servant (orb.in (), first_poa.in ()); // Do "activate_object" to activate the first_servant object. It // returns ObjectId for that object. Operation Used : // ObjectId activate_object(in Servant p_servant) // raises (ServantAlreadyActive, WrongPolicy); PortableServer::ObjectId_var first_oid = root_poa->activate_object (&first_servant); // Get Object Reference for the first_servant object. test_var first_test = first_servant._this (); // Get ObjectId for object secondtest and use that ObjectId to // activate the second_servant object. // Operation Used : // void activate_object_with_id(in ObjectId oid, in Servant p_servant) // raises (ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy); PortableServer::ObjectId_var second_oid = PortableServer::string_to_ObjectId ("second test"); first_poa->activate_object_with_id (second_oid.in (), &second_servant); // Get Object reference for second_servant object. test_var second_test = second_servant._this (); // Get ObjectId for the string thirdPOA Create the object reference // for thirdPOA using that ObjectId. Operation Used : // Object create_reference_with_id (in ObjectId oid, in CORBA::RepositoryId intf ); // This operation creates an object reference that encapsulates the // specified Object Id and interface repository Id values. /* PortableServer::ObjectId_var third_oid = PortableServer::string_to_ObjectId ("thirdtest"); */ // This will test how the POA handles a user given ID PortableServer::ObjectId_var third_oid = PortableServer::string_to_ObjectId ("third test"); third_oid[5] = (CORBA::Octet) '\0'; CORBA::Object_var third_test = second_poa->create_reference_with_id (third_oid.in (), "IDL:test:1.0"); // Stringyfy all the object references and print them out. CORBA::String_var first_ior = orb->object_to_string (first_test.in ()); CORBA::String_var second_ior = orb->object_to_string (second_test.in ()); CORBA::String_var third_ior = orb->object_to_string (third_test.in ()); ACE_DEBUG ((LM_DEBUG, "%C\n%C\n%C\n", first_ior.in (), second_ior.in (), third_ior.in ())); int write_result = write_iors_to_file (first_ior.in (), second_ior.in (), third_ior.in ()); if (write_result != 0) return write_result; // Activate third servant using its ObjectID. test_i third_servant (orb.in (), second_poa.in ()); second_poa->activate_object_with_id (third_oid.in (), &third_servant); poa_manager->activate (); orb->run (); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught"); return -1; } return 0; }
void Locator_XMLHandler::startElement (const ACEXML_Char*, const ACEXML_Char*, const ACEXML_Char* qName, ACEXML_Attributes* attrs) { if (ACE_OS::strcasecmp (qName, SERVER_INFO_TAG) == 0) { ACE_NEW (this->si_, Server_Info); this->env_vars_.clear (); // if attrs exists and if the previously required 9 fields const size_t previous_size = 9; if (attrs != 0 && attrs->getLength () >= previous_size) { size_t index = 0; this->si_->server_id = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->poa_name = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->activator = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->cmdline = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->dir = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->activation_mode_ = ImR_Utils::stringToActivationMode (ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++))); this->si_->start_limit_ = ACE_OS::atoi (attrs->getValue (index++)); this->si_->partial_ior = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); this->si_->ior = ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index++)); if (attrs->getLength () >= index) { this->server_started_ = (ACE_OS::atoi (attrs->getValue (index++)) != 0); } if (attrs->getLength () >= index) { this->si_->is_jacorb = (ACE_OS::atoi (attrs->getValue (index++)) != 0); } for ( ; index < attrs->getLength(); ++index) { ACE_TString name (attrs->getLocalName (index)); ACE_CString value (ACE_TEXT_ALWAYS_CHAR (attrs->getValue (index))); if (name == KEYNAME_TAG) { this->si_->key_name_ = value; } else if (name == ALTKEY_TAG) { if (value.length() > 0 && this->repo_.servers ().find (value, this->si_->alt_info_) != 0) { Server_Info *base_si = 0; ACE_NEW (base_si, Server_Info); base_si->key_name_ = value; this->si_->alt_info_.reset (base_si); this->repo_.servers ().bind (value, this->si_->alt_info_); } } else if (name == PID_TAG) { this->si_->pid = ACE_OS::atoi (attrs->getValue (index++)); } else { const ACE_CString name_cstr (ACE_TEXT_ALWAYS_CHAR (name.c_str ())); this->extra_params_.push_back (std::make_pair (name_cstr, value)); } } } } else if (ACE_OS::strcasecmp (qName, ACTIVATOR_INFO_TAG) == 0) { if (attrs != 0 && attrs->getLength () >= 3) { size_t index = 0; const ACE_CString aname = ACE_TEXT_ALWAYS_CHAR(attrs->getValue (index++)); const ACE_TString token_str = attrs->getValue (index++); long token = ACE_OS::atoi (token_str.c_str ()); const ACE_CString ior = ACE_TEXT_ALWAYS_CHAR(attrs->getValue (index++)); NameValues extra_params; for ( ; index < attrs->getLength(); ++index) { ACE_CString name (ACE_TEXT_ALWAYS_CHAR (attrs->getLocalName(index))); ACE_CString value (ACE_TEXT_ALWAYS_CHAR (attrs->getValue(index))); extra_params.push_back (std::make_pair (name, value)); } this->repo_.load_activator (aname, token, ior, extra_params); } } else if (ACE_OS::strcasecmp (qName, ENVIRONMENT_TAG) == 0) { if (attrs != 0 && attrs->getLength () == 2) { EnvVar ev; ev.name = attrs->getValue ((size_t)0); ev.value = attrs->getValue ((size_t)1); this->env_vars_.push_back (ev); } } else if (ACE_OS::strcasecmp (qName, PEER_TAG) == 0) { if (attrs != 0) { ACE_CString peer (ACE_TEXT_ALWAYS_CHAR (attrs->getValue((size_t)0))); this->peer_list_.push_back (peer); } } }