TAO_Active_Object_Map::TAO_Active_Object_Map ( int user_id_policy, int unique_id_policy, int persistent_id_policy, const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters & creation_parameters) : user_id_map_ (0) , servant_map_ (0) , id_uniqueness_strategy_ (0) , lifespan_strategy_ (0) , id_assignment_strategy_ (0) , id_hint_strategy_ (0) , using_active_maps_ (false) { TAO_Active_Object_Map::set_system_id_size (creation_parameters); TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0; if (unique_id_policy) { ACE_NEW_THROW_EX (id_uniqueness_strategy, TAO_Unique_Id_Strategy, CORBA::NO_MEMORY ()); } else { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_uniqueness_strategy, TAO_Multiple_Id_Strategy, CORBA::NO_MEMORY ()); #else TAOLIB_ERROR ((LM_ERROR, "Multiple Id Strategy not supported with CORBA/e\n")); #endif } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy); TAO_Lifespan_Strategy *lifespan_strategy = 0; if (persistent_id_policy) { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (lifespan_strategy, TAO_Persistent_Strategy, CORBA::NO_MEMORY ()); #else ACE_UNUSED_ARG (persistent_id_policy); TAOLIB_ERROR ((LM_ERROR, "Persistent Id Strategy not supported with CORBA/e\n")); #endif } else { ACE_NEW_THROW_EX (lifespan_strategy, TAO_Transient_Strategy, CORBA::NO_MEMORY ()); } // Give ownership to the auto pointer. auto_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy); TAO_Id_Assignment_Strategy *id_assignment_strategy = 0; if (user_id_policy) { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_assignment_strategy, TAO_User_Id_Strategy, CORBA::NO_MEMORY ()); #else TAOLIB_ERROR ((LM_ERROR, "User Id Assignment not supported with CORBA/e\n")); #endif } else if (unique_id_policy) { ACE_NEW_THROW_EX (id_assignment_strategy, TAO_System_Id_With_Unique_Id_Strategy, CORBA::NO_MEMORY ()); } else { #if !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (id_assignment_strategy, TAO_System_Id_With_Multiple_Id_Strategy, CORBA::NO_MEMORY ()); #else TAOLIB_ERROR ((LM_ERROR, "System Id Assignment with multiple " "not supported with CORBA/e\n")); #endif } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy); TAO_Id_Hint_Strategy *id_hint_strategy = 0; if ((user_id_policy || creation_parameters.allow_reactivation_of_system_ids_) && creation_parameters.use_active_hint_in_ids_) { this->using_active_maps_ = true; ACE_NEW_THROW_EX (id_hint_strategy, TAO_Active_Hint_Strategy ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); } else { ACE_NEW_THROW_EX (id_hint_strategy, TAO_No_Hint_Strategy, CORBA::NO_MEMORY ()); } // Give ownership to the auto pointer. auto_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy); servant_map *sm = 0; if (unique_id_policy) { switch (creation_parameters.reverse_object_lookup_strategy_for_unique_id_policy_) { case TAO_LINEAR: #if (TAO_HAS_MINIMUM_POA_MAPS == 0) ACE_NEW_THROW_EX (sm, servant_linear_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else TAOLIB_ERROR ((LM_ERROR, "linear option for " "-ORBUniqueidPolicyReverseDemuxStrategy " "not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: ACE_NEW_THROW_EX (sm, servant_hash_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } // Give ownership to the auto pointer. auto_ptr<servant_map> new_servant_map (sm); user_id_map *uim = 0; if (user_id_policy || creation_parameters.allow_reactivation_of_system_ids_) { switch (creation_parameters.object_lookup_strategy_for_user_id_policy_) { case TAO_LINEAR: #if (TAO_HAS_MINIMUM_POA_MAPS == 0) ACE_NEW_THROW_EX (uim, user_id_linear_map ( creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else TAOLIB_ERROR ((LM_ERROR, "linear option for -ORBUseridPolicyDemuxStrategy " "not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } else { switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: ACE_NEW_THROW_EX (uim, user_id_linear_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; case TAO_DYNAMIC_HASH: ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; #else case TAO_LINEAR: case TAO_DYNAMIC_HASH: TAOLIB_ERROR ((LM_ERROR, "linear and dynamic options for -ORBSystemidPolicyDemuxStrategy " "are not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_ACTIVE_DEMUX: default: this->using_active_maps_ = true; ACE_NEW_THROW_EX (uim, user_id_active_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); break; } } // Give ownership to the auto pointer. auto_ptr<user_id_map> new_user_id_map (uim); id_uniqueness_strategy->set_active_object_map (this); lifespan_strategy->set_active_object_map (this); id_assignment_strategy->set_active_object_map (this); // Finally everything is fine. Make sure to take ownership away // from the auto pointer. this->id_uniqueness_strategy_ = new_id_uniqueness_strategy; this->lifespan_strategy_ = new_lifespan_strategy; this->id_assignment_strategy_ = new_id_assignment_strategy; this->id_hint_strategy_ = new_id_hint_strategy; this->servant_map_ = new_servant_map; this->user_id_map_ = new_user_id_map; #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1) ACE_NEW (this->monitor_, ACE::Monitor_Control::Size_Monitor); #endif /* TAO_HAS_MONITOR_POINTS==1 */ }
int ACE_TMAIN (int , ACE_TCHAR **) { #if (CIAO_DDS4CCM_NDDS == 1) // first turn on or off tracing ACE_Env_Value<int> trace (ACE_TEXT("DDS4CCM_TRACE_ENABLE"), 0); if (trace) { DDS4CCM_ENABLE_TRACE (); } else { DDS4CCM_DISABLE_TRACE (); } DDS4CCM_debug_level = 0; int ret = 0; try { int domain_id = 0; ACE_Env_Value<int> id (ACE_TEXT("DDS4CCM_DEFAULT_DOMAIN_ID"), domain_id); domain_id = id; DomainParticipantFactory pf; ::DDS::DomainParticipantQos qos; ::DDS::DomainParticipant_var dp1 = pf.create_participant ( domain_id, qos, ::DDS::DomainParticipantListener::_nil (), 0); ::DDS::DomainParticipant_var dp2 = pf.create_participant ( domain_id, qos, ::DDS::DomainParticipantListener::_nil (), 0); const char * type1 = "DataType1"; const char * type2 = "DataType2"; const char * type3 = "DataType3"; TestTypeFactory * f1 = 0; TestTypeFactory * f2 = 0; TestTypeFactory * f3 = 0; ACE_NEW_THROW_EX (f1, TestTypeFactory (), ::CORBA::NO_MEMORY ()); ACE_NEW_THROW_EX (f2, TestTypeFactory (), ::CORBA::NO_MEMORY ()); ACE_NEW_THROW_EX (f3, TestTypeFactory (), ::CORBA::NO_MEMORY ()); /// Register type 1 with f1 if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type1, f1)) { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 successfully registered\n", type1, f1)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could not be registered\n", type1, f1)); ++ret; } /// DP1 should now contain one type-factory combination /// Register the same factory again if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type1, f1)) { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could be registered\n", type1, f1)); ++ret; } else { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 could not be registered\n", type1, f1)); } /// DP1 should now contain one type-factory combination /// Register the same factory again but with another name if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type2, f1)) { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 could be registered\n", type2, f1)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could not be registered\n", type2, f1)); ++ret; } /// DP1 should now contain two type-factory combinations /// Register the same type with another factory if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type2, f2)) { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could be registered\n", type2, f2)); ++ret; } else { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 could not be registered\n", type2, f2)); } /// DP1 should now contain two type-factory combinations /// Just register type 3 with f3 if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type3, f3)) { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 successfully registered\n", type3, f3)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could not be registered\n", type3, f3)); ++ret; } /// DP1 should now contain three type-factory combinations /// Unregister an unused factory by using an unused domain participant bool tmp = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type(dp2.in(), type1); if (tmp) { ACE_ERROR ((LM_ERROR, "ERROR - Unregistered type <%C> for DP2 could be unregistered\n", type1)); ++ret; } else { ACE_DEBUG ((LM_DEBUG, "OK - Unregistered type <%C> for DP2 could not be unregistered\n", type1)); } /// Unregister a registered type by using a used domain participant tmp = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type(dp1.in(), type1); if (tmp) { ACE_DEBUG ((LM_DEBUG, "OK - Unregistered type <%C> for DP1 could be unregistered\n", type1)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Unregistered type <%C> for DP1 could not be unregistered\n", type1)); ++ret; } /// DP1 should now contain two type-factory combinations /// Unregister the same type and domain participant again tmp = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type(dp1.in(), type1); if (tmp) { ACE_DEBUG ((LM_DEBUG, "OK - Unregistered type <%C> for DP1 could be unregistered\n", type1)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Unregistered type <%C> for DP1 could not be unregistered\n", type1)); ++ret; } /// DP1 should now contain two type-factory combinations /// Call Close on TypeSupport. This should remove the last remaining entries. ::CIAO::NDDS::DDS_TypeSupport_i::close(); /// Unregister the type and domain participant which should be removed by 'close' tmp = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type(dp1.in(), type2); if (tmp) { ACE_ERROR ((LM_ERROR, "ERROR - Deleted type <%C> for DP1 could be unregistered\n", type2)); ++ret; } else { ACE_DEBUG ((LM_DEBUG, "OK - Deleted type <%C> for DP1 could not be unregistered\n", type2)); } /// Unregister the type and domain participant which should be removed by 'close' tmp = ::CIAO::NDDS::DDS_TypeSupport_i::unregister_type(dp1.in(), type3); if (tmp) { ACE_ERROR ((LM_ERROR, "ERROR - Deleted type <%C> for DP1 could be unregistered\n", type3)); ++ret; } else { ACE_DEBUG ((LM_DEBUG, "OK - Deleted type <%C> for DP1 could not be unregistered\n", type3)); } /// Since we've invoked ::close f3 has been deleted. Therefor we need to create it again. ACE_NEW_THROW_EX (f3, TestTypeFactory (), ::CORBA::NO_MEMORY ()); /// We should now be able to register type 3 again if (::CIAO::NDDS::DDS_TypeSupport_i::register_type(dp1.in(), type3, f3)) { ACE_DEBUG ((LM_DEBUG, "OK - Type <%C> and Factory <%@> for DP1 successfully registered\n", type3, f3)); } else { ACE_ERROR ((LM_ERROR, "ERROR - Type <%C> and Factory <%@> for DP1 could not be registered\n", type3, f3)); ++ret; } /// DP1 should now contain one type-factory combination /// Call Close on TypeSupport. This should remove the last remaining entries. ::CIAO::NDDS::DDS_TypeSupport_i::close(); /// No need to delete f1, f2, and f3 since ::close will delete them. pf.delete_participant(dp1); pf.delete_participant(dp2); #if (CIAO_DDS4CCM_NDDS==1) DDSDomainParticipantFactory::finalize_instance (); #endif } catch (const ::CORBA::Exception& e) { e._tao_print_exception ("ACE_TMAIN - Caught unexpected " "CORBA exception\n"); return 1; } catch (...) { ACE_ERROR ((LM_ERROR, "ACE_TMAIN - ERROR: Caught unexpected " "exception\n")); return 1; } if (ret == 0) { ACE_DEBUG ((LM_DEBUG, "Test passed !\n")); } else { ACE_ERROR ((LM_ERROR, "%d errors found during test. \n", ret)); } return ret; #else ACE_DEBUG ((LM_DEBUG, "NDDS only test\n")); return 0; #endif }
int Notify_Logging_Service::init (int argc, ACE_TCHAR *argv[]) { // initialize the ORB. if (this->init_ORB (argc, argv) != 0) return -1; if (this->parse_args (argc, argv) == -1) return -1; this->notify_service_->init_service (this->orb_.in ()); // Activate the factory this->notify_factory_ = notify_service_->create (this->poa_.in ()); ACE_NEW_THROW_EX (this->notify_log_factory_, TAO_NotifyLogFactory_i (this->notify_factory_.in ()), CORBA::NO_MEMORY ()); DsNotifyLogAdmin::NotifyLogFactory_var obj = notify_log_factory_->activate (this->orb_.in (), this->poa_.in ()); CORBA::String_var ior = this->orb_->object_to_string (obj.in ()); if (true) { CORBA::Object_var table_object = this->orb_->resolve_initial_references ("IORTable"); IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); adapter->bind("NotifyLogService", ior.in ()); } if (this->ior_file_name_ != 0) { FILE* iorf = ACE_OS::fopen (this->ior_file_name_, ACE_TEXT("w")); if (iorf == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", this->ior_file_name_), -1); } ACE_OS::fprintf (iorf, "%s\n", ior.in ()); ACE_OS::fclose (iorf); } if (this->pid_file_name_ != 0) { FILE* pidf = ACE_OS::fopen (this->pid_file_name_, ACE_TEXT("w")); if (pidf != 0) { ACE_OS::fprintf (pidf, "%ld\n", static_cast<long> (ACE_OS::getpid ())); ACE_OS::fclose (pidf); } } if (this->bind_to_naming_service_) { // Resolve the naming service. this->resolve_naming_service (); CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup (this->service_name_.c_str ()); this->naming_->rebind (name, obj.in ()); } return 0; }
CORBA::ValueBase * NullValue_Factory::create_for_unmarshal () { CORBA::ValueBase *vb= 0; ACE_NEW_THROW_EX (vb, NullValue_impl (), CORBA::NO_MEMORY ()); return vb; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { DANCE_DISABLE_TRACE (); int retval = 0; Options options; try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); ORB_Destroyer safe_orb (orb); DAnCE::Logger_Service * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); if (dlf) { dlf->init (argc, argv); } if (!parse_args (argc, argv, options)) { return 1; } auto_ptr<DAnCE::Plan_Launcher_Base> pl_base (0); Deployment::DeploymentPlan_var dp; DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher - ") ACE_TEXT ("Parsing deployment plan\n"))); if (options.cdr_plan_) { dp = DAnCE::Convert_Plan::read_cdr_plan (options.cdr_plan_); if (!dp.ptr ()) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - ") ACE_TEXT ("Error: Unable to read ") ACE_TEXT ("in CDR plan\n"))); } return 1; } } else if (options.xml_plan_) { dp = DAnCE::Convert_Plan::read_xml_plan (options.xml_plan_); if (!dp.ptr ()) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - Error: ") ACE_TEXT ("Unable to read in XML plan\n"))); } return 1; } } if (options.domain_file_) { ::DAnCE::Config_Handlers::XML_File_Intf file (options.domain_file_); file.add_search_path (ACE_TEXT ("DANCE_ROOT"), ACE_TEXT ("/docs/schema/")); ::Deployment::Domain *plan = file.release_domain (); if (!plan) { DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT("PlanLauncher - Error - ") ACE_TEXT("Error: Processing file <%C>\n"), options.domain_file_)); return false; } DAnCE_Domain_Validator_i validator (orb); validator.load_domain (*plan); ::DAnCE::Time_Value tv; tv.seconds (options.domain_timeout_); CORBA::StringSeq_var late_nodes; if (!validator.block_for_domain (tv, late_nodes.out ())) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - Error: ") ACE_TEXT ("Not all nodes in domain ready\n"))); for (CORBA::ULong i = 0; i < late_nodes->length (); ++i) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - Error: ") ACE_TEXT ("Node <%C> is not started\n"), late_nodes[i].in ())); } return 1; } } ACE_Time_Value timeout (ACE_OS::gettimeofday () + ACE_Time_Value (options.em_timeout_)); if (options.em_ior_) { // Resolve ExecutionManager IOR for EM base deployment. DAnCE::EM_Launcher *em_pl (0); Deployment::ExecutionManager_var tmp_em = resolve_manager<Deployment::ExecutionManager> (timeout, options.em_ior_, orb); if (CORBA::is_nil (tmp_em)) { DANCE_ERROR(DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") ACE_TEXT ("Unable to resolve EM object reference\n"))); return 0; } ACE_NEW_THROW_EX (em_pl, DAnCE::EM_Launcher (orb.in (), tmp_em.in ()), CORBA::NO_MEMORY ()); pl_base.reset (em_pl); } else if (options.nm_ior_) { // Resolve NM IOR for NM based deployment. DAnCE::NM_Launcher *nm_pl (0); CORBA::Object_var obj = orb->string_to_object (options.nm_ior_); Deployment::NodeManager_var tmp_em = Deployment::NodeManager::_narrow (obj); if (CORBA::is_nil (tmp_em.in ())) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") ACE_TEXT ("Unable to resolve ") ACE_TEXT ("NodeManager reference <%s>\n"), options.nm_ior_)); } return 1; } ACE_NEW_THROW_EX (nm_pl, DAnCE::NM_Launcher (orb.in (), tmp_em.in ()), CORBA::NO_MEMORY ()); pl_base.reset (nm_pl); } else if (options.lm_ior_) { // Resolve NM IOR for NM based deployment. DAnCE::LM_Launcher *lm_pl (0); CORBA::Object_var obj = orb->string_to_object (options.lm_ior_); DAnCE::LocalityManager_var tmp_em = DAnCE::LocalityManager::_narrow (obj); if (CORBA::is_nil (tmp_em.in ())) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") ACE_TEXT ("Unable to resolve ") ACE_TEXT ("LocalityManager reference <%s>\n"), options.lm_ior_)); } return 1; } ACE_NEW_THROW_EX (lm_pl, DAnCE::LM_Launcher (orb.in (), tmp_em.in ()), CORBA::NO_MEMORY ()); pl_base.reset (lm_pl); } switch (options.mode_) { case Options::LAUNCH: retval = launch_plan (options, pl_base.get (), dp, orb.in ()); break; case Options::TEARDOWN: retval = teardown_plan (options, pl_base.get (), dp, orb.in ()); break; default: if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher -") ACE_TEXT ("Mode not yet supported\n"))); } break; }; } catch (const Deployment::PlanError &ex) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - ") ACE_TEXT ("Error in plan: <%C>, <%C>\n"), ex.name.in (), ex.reason.in ())); } retval = -1; } catch (const DAnCE::Deployment_Failure& e) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - ") ACE_TEXT ("Error: %C.\n"), e.ex_.c_str())); } retval = 1; } catch (const CORBA::Exception& ex) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ( "PlanLauncher - ") ACE_TEXT ("Error: %C\n"), ex._info ().c_str ())); } retval = 1; } catch (...) { if (!options.quiet_) { DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, ACE_TEXT ("PlanLauncher - ") ACE_TEXT ("Error: Unknown exception.\n"))); } retval = 1; } return retval; }
CORBA::ExceptionDefSeq * TAO_AttributeDef_i::put_exceptions (void) { ACE_Unbounded_Queue<ACE_TString> path_queue; int index = 0; ACE_Configuration::VALUETYPE type; ACE_TString field_name; ACE_Configuration_Section_Key put_excepts_key; int status = this->repo_->config ()->open_section (this->section_key_, "put_excepts", 0, put_excepts_key); // This section may not have been created. if (status == 0) { ACE_TString put_except_path; ACE_Configuration_Section_Key dummy; while (this->repo_->config ()->enumerate_values (put_excepts_key, index++, field_name, type) == 0) { this->repo_->config ()->get_string_value (put_excepts_key, field_name.c_str (), put_except_path); // This exception may have been destroyed status = this->repo_->config ()->expand_path (this->repo_->root_key (), put_except_path, dummy, 0); if (status == 0) { path_queue.enqueue_tail (put_except_path); } } } CORBA::ULong size = static_cast<CORBA::ULong> (path_queue.size ()); CORBA::ExceptionDefSeq *put_ed_seq = 0; ACE_NEW_THROW_EX (put_ed_seq, CORBA::ExceptionDefSeq (size), CORBA::NO_MEMORY ()); put_ed_seq->length (size); CORBA::ExceptionDefSeq_var retval = put_ed_seq; for (CORBA::ULong i = 0; i < size; ++i) { ACE_TString path; path_queue.dequeue_head (path); CORBA::Object_var obj = TAO_IFR_Service_Utils::create_objref (CORBA::dk_Exception, path.c_str (), this->repo_); retval[i] = CORBA::ExceptionDef::_narrow (obj.in ()); } return retval._retn (); }
void Echo_Collocated_ORBInitializer::post_init ( PortableInterceptor::ORBInitInfo_ptr info) { CORBA::String_var orb_id = info->orb_id (); // TAO-Specific way to get to the ORB Core (and thus, the ORB). TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info); CORBA::ORB_var orb = CORBA::ORB::_duplicate(tao_info->orb_core()->orb()); if (CORBA::is_nil(orb.in())) { throw CORBA::INTERNAL (); } PortableInterceptor::ORBInitInfo_3_1_var info_3_1 = PortableInterceptor::ORBInitInfo_3_1::_narrow(info); if (CORBA::is_nil(info_3_1.in())) { throw CORBA::INTERNAL (); } if (!ACE_OS::strcmp (orb_id.in (), "client_orb")) { PortableInterceptor::ClientRequestInterceptor_ptr interceptor = PortableInterceptor::ClientRequestInterceptor::_nil (); // Install the Echo client request interceptor ACE_NEW_THROW_EX (interceptor, Echo_Client_Request_Interceptor, CORBA::NO_MEMORY ()); PortableInterceptor::ClientRequestInterceptor_var client_interceptor = interceptor; CORBA::Any client_proc_mode_as_any; client_proc_mode_as_any <<= this->client_processing_mode_; CORBA::PolicyList policy_list (1); policy_list.length (1); policy_list[0] = orb->create_policy (PortableInterceptor::PROCESSING_MODE_POLICY_TYPE, client_proc_mode_as_any); info_3_1->add_client_request_interceptor_with_policy ( client_interceptor.in (), policy_list); policy_list[0]->destroy (); policy_list[0] = CORBA::Policy::_nil (); } else if (!ACE_OS::strcmp (orb_id.in (), "server_orb")) { PortableInterceptor::ServerRequestInterceptor_ptr interceptor = PortableInterceptor::ServerRequestInterceptor::_nil (); // Install the Echo server request interceptor ACE_NEW_THROW_EX (interceptor, Echo_Server_Request_Interceptor, CORBA::NO_MEMORY ()); PortableInterceptor::ServerRequestInterceptor_var server_interceptor = interceptor; CORBA::Any server_proc_mode_as_any; server_proc_mode_as_any <<= this->server_processing_mode_; CORBA::PolicyList policy_list (1); policy_list.length (1); policy_list[0] = orb->create_policy (PortableInterceptor::PROCESSING_MODE_POLICY_TYPE, server_proc_mode_as_any); info_3_1->add_server_request_interceptor_with_policy ( server_interceptor.in (), policy_list); policy_list[0]->destroy (); policy_list[0] = CORBA::Policy::_nil (); } else { } }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { ORBInitializer *initializer = 0; ACE_NEW_RETURN (initializer, ORBInitializer, -1); // No exceptions yet! PortableInterceptor::ORBInitializer_var orb_initializer = initializer; PortableInterceptor::register_orb_initializer (orb_initializer.in ()); CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; poa_manager->activate (); CORBA::Object_var lm_object = orb->resolve_initial_references ("LoadManager"); CosLoadBalancing::LoadManager_var load_manager = CosLoadBalancing::LoadManager::_narrow (lm_object.in ()); RPS_Monitor * monitor_servant; ACE_NEW_THROW_EX (monitor_servant, RPS_Monitor (initializer->interceptor ()), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var safe_monitor_servant (monitor_servant); CosLoadBalancing::LoadMonitor_var load_monitor = monitor_servant->_this (); PortableGroup::Location_var location = load_monitor->the_location (); CORBA::Object_var stockfactory = ::join_object_group (orb.in (), load_manager.in (), location.in ()); TAO_LB_LoadAlert & alert_servant = initializer->load_alert (); CosLoadBalancing::LoadAlert_var load_alert = alert_servant._this (); CORBA::String_var ior = orb->object_to_string (stockfactory.in ()); // If the ior_output_file exists, output the ior to it FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); load_manager->register_load_monitor (location.in (), load_monitor.in ()); load_manager->register_load_alert (location.in (), load_alert.in ()); orb->run (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); root_poa->destroy (1, 1); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("lb_server exception"); return 1; } return 0; }
CORBA::Object_ptr join_object_group (CORBA::ORB_ptr orb, CosLoadBalancing::LoadManager_ptr lm, const PortableGroup::Location & location) { CORBA::Object_var ns_object = orb->resolve_initial_references ("NameService"); CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow (ns_object.in ()); CosNaming::Name name (1); name.length (1); name[0].id = "StockFactoryObjectGroup"; name[0].kind = "Object Group"; CORBA::Object_var group; try { group = nc->resolve (name); } catch (const CosNaming::NamingContext::NotFound& ) { // Object group not created. Create one. const char repository_id[] = "IDL:Test/StockFactory:1.0"; PortableGroup::Criteria criteria (1); criteria.length (1); PortableGroup::Property & property = criteria[0]; property.nam.length (1); property.nam[0].id = CORBA::string_dup ("omg.org.PortableGroup.MembershipStyle"); PortableGroup::MembershipStyleValue msv = PortableGroup::MEMB_APP_CTRL; property.val <<= msv; PortableGroup::GenericFactory::FactoryCreationId_var fcid; group = lm->create_object (repository_id, criteria, fcid.out ()); try { nc->bind (name, group.in ()); PortableGroup::Properties props (1); props.length (1); props[0].nam.length (1); props[0].nam[0].id = CORBA::string_dup ("org.omg.CosLoadBalancing.StrategyInfo"); CosLoadBalancing::StrategyInfo strategy_info; strategy_info.name = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(strategy)); if (ACE_OS::strcasecmp (strategy, ACE_TEXT("LeastLoaded")) == 0 && (!ACE::is_equal (reject_threshold, 0.0f) || !ACE::is_equal (critical_threshold, 0.0f) || !ACE::is_equal (dampening, 0.0f))) { CORBA::ULong len = 1; PortableGroup::Properties & props = strategy_info.props; if (!ACE::is_equal (reject_threshold, 0.0f)) { const CORBA::ULong i = len - 1; props.length (len++); props[i].nam.length (1); props[i].nam[0].id = CORBA::string_dup ("org.omg.CosLoadBalancing.Strategy.LeastLoaded.RejectThreshold"); props[i].val <<= reject_threshold; } if (!ACE::is_equal (critical_threshold, 0.0f)) { const CORBA::ULong i = len - 1; props.length (len++); props[i].nam.length (1); props[i].nam[0].id = CORBA::string_dup ("org.omg.CosLoadBalancing.Strategy.LeastLoaded.CriticalThreshold"); props[i].val <<= critical_threshold; } if (!ACE::is_equal (dampening, 0.0f)) { const CORBA::ULong i = len - 1; props.length (len++); props[i].nam.length (1); props[i].nam[0].id = CORBA::string_dup ("org.omg.CosLoadBalancing.Strategy.LeastLoaded.Dampening"); props[i].val <<= dampening; } } props[0].val <<= strategy_info; lm->set_default_properties (props); } catch (const CosNaming::NamingContext::AlreadyBound& ) { // Somebody beat us to creating the object group. Clean up // the one we created. lm->delete_object (fcid.in ()); group = nc->resolve (name); } } StockFactory * stockfactory_impl; ACE_NEW_THROW_EX (stockfactory_impl, StockFactory (orb, number), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var owner_transfer (stockfactory_impl); Test::StockFactory_var stockfactory = stockfactory_impl->_this (); group = lm->add_member (group.in (), location, stockfactory.in ()); return group._retn (); }
DsLogAdmin::RecordList* TAO_Hash_Iterator_i::get (CORBA::ULong position, CORBA::ULong how_many) { ACE_READ_GUARD_THROW_EX (ACE_SYNCH_RW_MUTEX, guard, this->recordstore_->lock (), CORBA::INTERNAL ()); if (position < current_position_) { throw DsLogAdmin::InvalidParam (); } if (how_many == 0) { how_many = this->max_rec_list_len_; } // Use an Interpreter to build an expression tree. TAO_Log_Constraint_Interpreter interpreter (constraint_.in ()); // Sequentially iterate over all the records and pick the ones that // meet the constraints. // Allocate the list of <how_many> length. DsLogAdmin::RecordList* rec_list = 0; ACE_NEW_THROW_EX (rec_list, DsLogAdmin::RecordList (how_many), CORBA::NO_MEMORY ()); rec_list->length (how_many); CORBA::ULong count = 0; CORBA::ULong current_position = this->current_position_; for ( ; ((this->iter_ != this->iter_end_) && (count < how_many)); ++this->iter_) { // Use an evaluator. TAO_Log_Constraint_Visitor visitor (this->iter_->item ()); // Does it match the constraint? if (interpreter.evaluate (visitor) == 1) { if (++current_position >= position) { (*rec_list)[count] = this->iter_->item (); // copy the log record. count++; } } } rec_list->length (count); this->current_position_ = current_position; if (count == 0 && this->iter_ == this->iter_end_) { // destroy this object.. this->destroy (); } return rec_list; }
::Deployment::NodeApplicationManager_ptr NodeManager_Impl::preparePlan (const ::Deployment::DeploymentPlan & plan, ::Deployment::ResourceCommitmentManager_ptr /*resourceCommitment*/) { DANCE_TRACE ( "NodeManager_Impl::preparePlan"); DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_DEBUG, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - ") ACE_TEXT("started for node %C and plan %C\n"), this->name_.c_str(), plan.UUID.in())); #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 "NodeManager_impl::preparePlan - %C", plan_stream.str ().c_str ())); } #endif /* GEN_OSTREAM_OPS */ // resourceCommitment will be used on next development stage if (0 == this->managers_.find (plan.UUID.in())) { // What should we do here if we already have application for this plan? // Probably it is mistake because we should previously call destroyApplication // before performe relaunching of application DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - ") ACE_TEXT("ApplicationManager for UUID %C already exists\n"), plan.UUID.in ())); throw ::Deployment::PlanError(plan.UUID.in (), "Plan with same UUID already exists"); } DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - creating NodeApplicationManager...\n"))); NodeApplicationManager_Impl* manager = 0; ACE_NEW_THROW_EX (manager, NodeApplicationManager_Impl (this->orb_.in(), this->poa_.in(), this->installer_. in (), this->name_, this->properties_), CORBA::NO_MEMORY()); Safe_NodeApplicationManager_Impl safe_manager (manager); DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_TRACE, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - ") ACE_TEXT ("invoking preparePlan on NodeApplicationManager...\n"))); manager->preparePlan (plan); DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_TRACE, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - activating NodeApplicationManager...\n"))); PortableServer::ObjectId_var id = this->poa_->activate_object (manager); CORBA::Object_var nam = this->poa_->id_to_reference (id.in()); // There is an idea to check if plan.UUID really exists this->managers_.bind (plan.UUID.in(), safe_manager._retn ()); // narrow should return a nil reference if it fails. DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_INFO, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - ") ACE_TEXT ("NodeApplicationManager for plan %C completed\n"), plan.UUID.in ())); return Deployment::NodeApplicationManager::_narrow (nam.in ()); }
::DDS::DataReader_ptr DDS_Subscriber_i::create_datareader_with_profile ( ::DDS::TopicDescription_ptr a_topic, const char * qos_profile, ::DDS::DataReaderListener_ptr a_listener, ::DDS::StatusMask mask) { DDS4CCM_TRACE ("DDS_Subscriber_i::create_datareader_with_profile"); DDS_DataReaderListener_i *ccm_dds_drl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_drl, DDS_DataReaderListener_i (a_listener, ::DDS::DataReader::_nil ()), ::CORBA::NO_MEMORY ()); } DDSDataReader * ccm_dds_dr = 0; DDS_Topic_i * topic = dynamic_cast < DDS_Topic_i * > (a_topic); if (!topic) { DDS_ContentFilteredTopic_i * cf_topic = dynamic_cast < DDS_ContentFilteredTopic_i * > (a_topic); if (!cf_topic) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_CAST_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_Subscriber_i::create_datareader_with_profile <%C> - " "Error: Unable to cast provided topic to one " "of its servant.\n", qos_profile)); delete ccm_dds_drl; return ::DDS::DataReader::_nil (); } else { ccm_dds_dr = this->create_datareader_with_profile (cf_topic->get_rti_entity (), qos_profile, ccm_dds_drl, mask); } } else { ccm_dds_dr = this->create_datareader_with_profile (topic->get_rti_entity (), qos_profile, ccm_dds_drl, mask); } if (!ccm_dds_dr) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO "DDS_Subscriber_i::create_datareader_with_profile <%C>- " "Error: RTI Topic returned a nil datareader.\n", qos_profile)); delete ccm_dds_drl; return ::DDS::DataReader::_nil (); } else { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DDS_Subscriber_i::create_datareader_with_profile - " "Successfully created datareader with profile <%C>.\n", qos_profile)); } ::DDS::DataReader_var reader = DDS_TypeSupport_i::create_datareader (ccm_dds_dr, this->dp_.in (), this); if (ccm_dds_drl) { ccm_dds_drl->set_dds_entity (reader.in ()); } return reader._retn (); }
Test::Process_ptr Process_Factory::create_new_process (void) { Startup_Callback *startup_callback_impl; ACE_NEW_THROW_EX (startup_callback_impl, Startup_Callback, CORBA::NO_MEMORY ()); PortableServer::ServantBase_var owner_transfer(startup_callback_impl); CORBA::Object_var poa_object = this->orb_->resolve_initial_references("RootPOA"); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::ObjectId_var id = root_poa->activate_object (startup_callback_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); Test::Startup_Callback_var startup_callback = Test::Startup_Callback::_narrow (object.in ()); CORBA::String_var ior = this->orb_->object_to_string (startup_callback.in ()); const ACE_TCHAR* argv[3] = { ACE_TEXT("child"), ACE_TEXT_CHAR_TO_TCHAR(ior.in ()), 0}; ACE_Process_Options options; #if !defined(ACE_WIN32) options.avoid_zombies (1); #endif /* ACE_WIN32 */ options.command_line (argv); ACE_Process child_process; pid_t pid = child_process.spawn (options); if (pid == -1) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) Process_Factory::create_new_process, " " spawn call failed (%d)\n", ACE_ERRNO_GET)); throw Test::Spawn_Failed (); } int process_has_started = 0; Test::Process_var the_process; for (int i = 0; i != 500 && !process_has_started; ++i) { ACE_Time_Value interval (0, 10000); this->orb_->perform_work (interval); process_has_started = startup_callback_impl->process_has_started (the_process.out ()); } try { PortableServer::POA_var poa = startup_callback_impl->_default_POA (); PortableServer::ObjectId_var id = poa->servant_to_id (startup_callback_impl); poa->deactivate_object (id.in ()); } catch (const CORBA::Exception&) { } if (process_has_started == 0) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) Process_Factory::create_new_process, " " timeout while waiting for child\n")); (void) child_process.terminate (); throw Test::Spawn_Failed (); } return the_process._retn (); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { Server_ORBInitializer *temp_initializer = 0; ACE_NEW_RETURN (temp_initializer, Server_ORBInitializer, -1); // No exceptions yet! PortableInterceptor::ORBInitializer_var orb_initializer = temp_initializer; PortableInterceptor::register_orb_initializer (orb_initializer.in ()); CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "Server ORB"); CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); // Create a child POA configured to use a ServantLocator. CORBA::PolicyList policies (2); policies.length (2); policies[0] = root_poa->create_request_processing_policy ( PortableServer::USE_SERVANT_MANAGER); policies[1] = root_poa->create_servant_retention_policy (PortableServer::NON_RETAIN); PortableServer::POA_var child_poa = root_poa->create_POA ("child", poa_manager.in (), policies); ServantLocator* sl = 0; ACE_NEW_THROW_EX (sl, ServantLocator (orb.in ()), CORBA::NO_MEMORY ()); PortableServer::ServantLocator_var servant_locator = sl; child_poa->set_servant_manager (servant_locator.in ()); poa_manager->activate (); CORBA::Object_var obj = child_poa->create_reference ("IDL:test:1.0"); CORBA::String_var ior = orb->object_to_string (obj.in ()); if (::parse_args (argc, argv) != 0) return -1; // Write IOR to a file. FILE *output_file= ACE_OS::fopen (ior_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file <%s> for writing " "IOR:\n%s\n", ior_file, ior.in ()), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); // Run the ORB event loop. orb->run (); root_poa->destroy (1, 1); orb->destroy (); if (sl->error_status_ == false) { ACE_DEBUG ((LM_DEBUG, "PortableInterceptor / ServantLocator test passed.\n")); } else { ACE_ERROR ((LM_ERROR, "PortableInterceptor / ServantLocator test failed.\n")); return 1; } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception:"); return -1; } return 0; }
void TAO_MonitorProxySupplier_T<ProxyPushSupplier>::configure( TAO_Notify_ConsumerAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id) { admin_ = dynamic_cast<TAO_MonitorConsumerAdmin *> (& admin); if (admin_ == 0) { throw CORBA::INTERNAL(); } event_channel_ = admin_->get_ec (); TAO_Notify_Buffering_Strategy* bs = 0; TAO_Notify_Worker_Task * worker_task = this->TAO_Notify_Object::get_worker_task (); TAO_Notify_ThreadPool_Task* tpt = dynamic_cast<TAO_Notify_ThreadPool_Task*> (worker_task); if (tpt != 0) { bs = tpt->buffering_strategy (); } if (bs != 0) { bs->set_tracker (admin_); } else { ORBSVCS_DEBUG ((LM_DEBUG, "Warning MC cannot enable statistics for buffering strategy.\n")); } this->base_stat_name_ = admin_->stat_name (); char name[64]; ACE_OS::sprintf(name, "%d", proxy_id); this->base_stat_name_ += name; this->base_stat_name_ += "/"; this->queue_item_stat_name_ = base_stat_name_; this->queue_item_stat_name_ += NotifyMonitoringExt::EventChannelQueueElementCount; ACE_NEW_THROW_EX (this->queue_item_count_, Monitor_Base (this->queue_item_stat_name_.c_str (), Monitor_Control_Types::MC_NUMBER), CORBA::NO_MEMORY ()); if (!event_channel_->register_statistic (this->queue_item_stat_name_, this->queue_item_count_)) { delete this->queue_item_count_; this->queue_item_count_ = 0; throw NotifyMonitoringExt::NameAlreadyUsed (); } this->overflow_stat_name_ = base_stat_name_; this->overflow_stat_name_ += NotifyMonitoringExt::EventChannelQueueOverflows; ACE_NEW_THROW_EX (this->overflows_, Monitor_Base (this->overflow_stat_name_.c_str (), Monitor_Control_Types::MC_COUNTER), CORBA::NO_MEMORY ()); if (!event_channel_->register_statistic (this->overflow_stat_name_, this->overflows_)) { delete this->overflows_; this->overflows_ = 0; throw NotifyMonitoringExt::NameAlreadyUsed (); } admin_->register_child (this); }
int CIAO::DDS4CCM::Logger_Service::init (int argc, ACE_TCHAR * argv[]) { this->init (); this->parse_args (argc, argv); if (this->filename_.length () > 0) { #if defined (ACE_LACKS_IOSTREAM_TOTALLY) FILE* output_stream = ACE_OS::fopen (this->filename_.c_str (), ACE_TEXT ("a")); ACE_LOG_MSG->msg_ostream (output_stream, 1); #else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ ofstream* output_stream = 0; ACE_NEW_THROW_EX (output_stream, ofstream (), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( 0, ENOMEM), CORBA::COMPLETED_NO)); output_stream->open (ACE_TEXT_ALWAYS_CHAR (this->filename_.c_str ()), ios::out | ios::app); if (!output_stream->bad ()) { ACE_LOG_MSG->msg_ostream (output_stream, 1); } #endif /* ACE_LACKS_IOSTREAM_TOTALLY */ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER); ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); } if (this->backend_.length () > 0) { ACE_Log_Msg_Backend* logger_be = ACE_Dynamic_Service<ACE_Log_Msg_Backend>::instance(this->backend_.c_str ()); // backend->open (""); if (logger_be == 0) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_EMERGENCY, DDS4CCM_INFO "Logger_Service::init - " "Unable to load backend %s\n", this->backend_.c_str ())); return -1; } ACE_Log_Msg::msg_backend (logger_be); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER); ACE_LOG_MSG->set_flags (ACE_Log_Msg::CUSTOM); } return 0; }
void create (BASE_COLLECTION* &collection) { ACE_NEW_THROW_EX (collection, COLLECTION (), CORBA::INTERNAL ()); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); // Get initial reference to the Root POA CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); // Narrow down to the appropriate type PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Panic: nil RootPOA\n"), 1); // Get referencee to the POA manager PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); // Parse the arguments if (parse_args (argc, argv) != 0) return 1; ACE_DEBUG(( LM_DEBUG, "ior file = %s\t#threads = %d\t" "msglen = %d\n", ior_output_file, nthreads, msglen)); // Create the factory servant Object_Factory_i *factory_impl = 0; ACE_NEW_THROW_EX (factory_impl, Object_Factory_i (orb.in (), msglen), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var safe (factory_impl); // _this method registers the object withe the POA and returns // an object reference PortableServer::ObjectId_var id = root_poa->activate_object (factory_impl); CORBA::Object_var object_act = root_poa->id_to_reference (id.in ()); Two_Objects_Test::Object_Factory_var factory = Two_Objects_Test::Object_Factory::_narrow (object_act.in ()); // Convert the object reference to a string so that it can // be saved in a file and used by clinet programs later CORBA::String_var ior = orb->object_to_string (factory.in ()); // If the ior_output_file exists, output the ior to it FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); // Activate the POA manager poa_manager->activate (); // Instantiate the specified # of worker threads Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate server threads\n"), 1); // Wait for all threads to get done worker.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) event loop finished\n")); root_poa->destroy (1, 1); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return 0; }
void AsyncListManager::final_state (void) { if (ImR_Locator_i::debug() > 4) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) AsyncListManager::final_state, ") ACE_TEXT ("waiters count = %d, pinger not null? %d\n"), this->waiters_, (this->pinger_ != 0))); } if (this->pinger_ != 0 && this->waiters_ > 0) { return; } bool excepted = false; CORBA::ULong len = this->server_list_.length (); if (!CORBA::is_nil (this->primary_.in())) { ImplementationRepository::ServerInformationIterator_var server_iterator; if (len < this->repo_->servers ().current_size()) { try { ImR_AsyncIterator* imr_iter = 0; ACE_NEW_THROW_EX (imr_iter, ImR_AsyncIterator (len, this), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var tmp (imr_iter); PortableServer::ObjectId_var id = this->poa_->activate_object (imr_iter); CORBA::Object_var obj = this->poa_->id_to_reference (id.in ()); server_iterator = ImplementationRepository:: ServerInformationIterator::_unchecked_narrow (obj.in ()); } catch (CORBA::Exception& ex) { ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); this->primary_->list_excep (&h); excepted = true; } } else { server_iterator = ImplementationRepository::ServerInformationIterator::_nil (); } if (!excepted) { try { this->primary_->list (this->server_list_, server_iterator.in ()); } catch (CORBA::Exception &ex) { ex._tao_print_exception ("ALM:final state sending list\n"); ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); this->primary_->list_excep (&h); } } this->primary_ = ImplementationRepository::AMH_AdministrationResponseHandler::_nil (); } else if (!CORBA::is_nil (this->secondary_.in())) { CORBA::Boolean done = this->first_ + this->server_list_.length () >= this->repo_->servers ().current_size (); this->secondary_->next_n (done, this->server_list_); this->secondary_ = ImplementationRepository::AMH_ServerInformationIteratorResponseHandler::_nil (); } }
CosNaming::NamingContext_ptr TAO_Persistent_Naming_Context::make_new_context (PortableServer::POA_ptr poa, const char *poa_id, size_t context_size, TAO_Persistent_Context_Index * ind) { // Store the stub we will return here. CosNaming::NamingContext_var result; // Put together a servant for the new Naming Context. TAO_Persistent_Naming_Context *context_impl = ind->create_naming_context_impl( poa, poa_id); // Verify that a context implementation was created. If not, throw an exception if (context_impl == 0) throw CORBA::NO_MEMORY (); // Put <context_impl> into the auto pointer temporarily, in case next // allocation fails. ACE_Auto_Basic_Ptr<TAO_Persistent_Naming_Context> temp (context_impl); if (context_impl->init (context_size) == -1) throw CORBA::NO_MEMORY (); // Insure appropriate cleanup in case of exception conditions ahead. context_impl->set_cleanup_level (1); // Register with the index of Naming Contexts. if (ind->bind (context_impl->poa_id_.c_str (), context_impl->counter_, context_impl->persistent_context_->map ()) == -1) throw CORBA::INTERNAL (); // Insure appropriate cleanup in case of exception conditions ahead. context_impl->set_cleanup_level (2); TAO_Naming_Context *context = 0; ACE_NEW_THROW_EX (context, TAO_Naming_Context (context_impl), CORBA::NO_MEMORY ()); // Let <implementation> know about it's <interface>. context_impl->interface (context); // Release auto pointer, and start using reference counting to // control our servant. temp.release (); PortableServer::ServantBase_var s = context; // Register the new context with the POA. PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId (poa_id); poa->activate_object_with_id (id.in (), context); result = context->_this (); // Everything went smoothly, without errors - we don't need any cleanup. context_impl->set_cleanup_level (0); return result._retn (); }
CORBA::ValueBase * NullValue_impl::_copy_value () { CORBA::ValueBase *vb= 0; ACE_NEW_THROW_EX (vb, NullValue_impl (), CORBA::NO_MEMORY ()); return vb; }
void TAO_Persistent_Naming_Context::list (CORBA::ULong how_many, CosNaming::BindingList_out &bl, CosNaming::BindingIterator_out &bi) { // Allocate nil out parameters in case we won't be able to complete // the operation. bi = CosNaming::BindingIterator::_nil (); ACE_NEW_THROW_EX (bl, CosNaming::BindingList (0), CORBA::NO_MEMORY ()); // Obtain a lock before we proceed with the operation. ACE_GUARD_THROW_EX (TAO_SYNCH_RECURSIVE_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); // Check to make sure this object didn't have <destroy> method // invoked on it. if (this->destroyed_) throw CORBA::OBJECT_NOT_EXIST (); // Dynamically allocate hash map iterator. HASH_MAP::ITERATOR *hash_iter = 0; ACE_NEW_THROW_EX (hash_iter, HASH_MAP::ITERATOR (*persistent_context_->map ()), CORBA::NO_MEMORY ()); // Store <hash_iter temporarily in auto pointer, in case we'll have // some failures and throw an exception. ACE_Auto_Basic_Ptr<HASH_MAP::ITERATOR> temp (hash_iter); // Silliness below is required because of broken old g++!!! E.g., // without it, we could have just said HASH_MAP::ITERATOR everywhere we use ITER_DEF. typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>::ITERATOR ITER_DEF; typedef ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId, TAO_Persistent_IntId>::ENTRY ENTRY_DEF; // Typedef to the type of BindingIterator servant for ease of use. typedef TAO_Bindings_Iterator<ITER_DEF, ENTRY_DEF> ITER_SERVANT; // A pointer to BindingIterator servant. ITER_SERVANT *bind_iter = 0; // Number of bindings that will go into the BindingList. CORBA::ULong n; // Calculate number of bindings that will go into bl. if (this->context_->current_size () > how_many) n = how_many; else n = static_cast<CORBA::ULong> (this->context_->current_size ()); // Use hash iterator to populate a BindingList with bindings. bl->length (n); ENTRY_DEF *hash_entry = 0; for (CORBA::ULong i = 0; i < n; i++) { hash_iter->next (hash_entry); hash_iter->advance (); if (ITER_SERVANT::populate_binding (hash_entry, bl[i]) == 0) throw CORBA::NO_MEMORY(); } // Now we are done with the BindingsList, and we can follow up on // the iterator business. // If we do not need to pass back BindingIterator. if (this->context_->current_size () <= how_many) return; else { // Create a BindingIterator for return. ACE_NEW_THROW_EX (bind_iter, ITER_SERVANT (this, hash_iter, this->poa_.in (), this->lock_), CORBA::NO_MEMORY ()); // Release <hash_iter> from auto pointer, and start using the // reference counting to control our servant. temp.release (); PortableServer::ServantBase_var iter = bind_iter; // Increment reference count on this Naming Context, so it doesn't get // deleted before the BindingIterator servant gets deleted. interface_->_add_ref (); // Register with the POA. char poa_id[BUFSIZ]; ACE_OS::sprintf (poa_id, "%s_%d", this->poa_id_.c_str (), (*this->counter_)++); PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId (poa_id); this->poa_->activate_object_with_id (id.in (), bind_iter); bi = bind_iter->_this (); } }
bool Policy_Verifier::init (int argc, ACE_TCHAR *argv[]) { this->orb_ = CORBA::ORB_init (argc, argv); ACE_Arg_Shifter arg_shifter (argc, argv); while (arg_shifter.is_anything_left ()) { const ACE_TCHAR *arg = 0; // IOR File Name Option. if (0 != (arg = arg_shifter.get_the_parameter (ACE_TEXT("-POAConfigFile")))) { this->rt_poa_properties_ = RT_Properties::read_from (arg); this->priority_bands_ = this->rt_poa_properties_->priority_bands ().length (); } else if (0 != (arg = arg_shifter.get_the_parameter (ACE_TEXT("-ObjectConfigFile")))) { this->rt_object_properties_ = RT_Properties::read_from (arg); } else if (0 != (arg = arg_shifter.get_the_parameter (ACE_TEXT("-BaseObjectIOR")))) { if (this->rt_poa_properties_ == 0) { ACE_NEW_THROW_EX (this->rt_poa_properties_, RT_Properties, CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO)); } this->rt_poa_properties_->ior_source (arg); ACE_OS::strcpy (this->base_object_ref_, ACE_TEXT("file://")); ACE_OS::strcat (this->base_object_ref_, this->rt_poa_properties_->ior_source ()); } else if (0 != (arg = arg_shifter.get_the_parameter (ACE_TEXT("-OverriddenIOR")))) { if (this->rt_object_properties_ == 0) { ACE_NEW_THROW_EX (this->rt_object_properties_, RT_Properties, CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO)); } this->rt_object_properties_->ior_source (arg); ACE_OS::strcpy (this->overridden_object_ref_, ACE_TEXT("file://")); ACE_OS::strcat (this->overridden_object_ref_, this->rt_object_properties_->ior_source ()); } else { arg_shifter.consume_arg (); } } if ((this->rt_poa_properties_ == 0) || (this->rt_object_properties_ == 0)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Configuration file missing!\n"))); return false; } // Get the Object references. CORBA::Object_var object = this->orb_->string_to_object (this->base_object_ref_); if (!Policy_Verifier::check_reference (object.in (), "Invalid IOR file!\n")) return false; this->base_object_ = Counter::_narrow (object.in ()); if (!Policy_Verifier::check_reference (this->base_object_.in (), "Unable to convert the IOR to the proper object reference.\n")) return false; object = this->orb_->string_to_object (this->overridden_object_ref_); if (!Policy_Verifier::check_reference (object.in (), "Invalid IOR file!\n")) return false; this->overridden_object_ = Counter::_narrow (object.in ()); if (!Policy_Verifier::check_reference (this->overridden_object_.in (), "Unable to convert the IOR to the proper object reference.\n")) return false; return true; }
CosLoadBalancing::LoadList * TAO_LB_CPU_Load_Average_Monitor::loads (void) { CORBA::Float load = 0; // Obtain the number of processors each time a load is computed. // The idea is to take into account the processor failures that can // occur on platforms that continue running with the remaining // processors. // // @@ Is this a realistic scenario? Perhaps we should just cache // the number of processors and assume that any processor failure // is a catastrophic one. #if 0 // defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) SYSTEM_INFO sys_info; ::GetNativeSystemInfo (&sys_info); if (sys_info.dwNumberOfProcessors > 0) { // Retrieve systimes from windows FILETIME idle; FILETIME kernel; FILETIME user; ::GetSystemTimes (&idle, &kernel, &user); // Convert all times to ULONGLONG so that we can calculate with them ULONGLONG idle_ll = (((ULONGLONG) idle.dwHighDateTime) << 32) + idle.dwLowDateTime; ULONGLONG kernel_ll = (((ULONGLONG) kernel.dwHighDateTime) << 32) + kernel.dwLowDateTime; ULONGLONG user_ll = (((ULONGLONG) user.dwHighDateTime) << 32) + user.dwLowDateTime; ULONGLONG system_ll = kernel_ll + user_ll; // Calculate the load load = ((system_ll - idle_ll) * 100 / system_ll) / sys_info.dwNumberOfProcessors; } #elif defined (linux) || defined (sun) // Only bother getting the load average over the last minute. // // @todo Make this configurable so that the load average over the // last 5 and 15 minutes can be used instead. double loadavg[1]; # if defined (linux) \ && ((defined (__GLIBC__) && defined (__GLIBC_MINOR__) \ && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2) \ || (!defined (_BSD_SOURCE) && !defined (_GNU_SOURCE))) // GLibc < 2.2 does not implement getloadavg(). Furthermore, // getloadavg() is only "visible" if _BSD_SOURCE or _GNU_SOURCE is // defined. // Obtain the load average directly from the `/proc' filesystem. FILE * s = ACE_OS::fopen ("/proc/loadavg", "r"); if (s == 0) throw CORBA::NO_IMPLEMENT ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, errno), CORBA::COMPLETED_NO); fscanf (s, "%f", &loadavg[0]); (void) ACE_OS::fclose (s); const int samples = 1; # else # if defined (ACE_LACKS_GETLOADAVG) const int samples = 0; # else const int samples = ::getloadavg (loadavg, 1); # endif /* ACE_LACKS_GETLOADAVG */ # endif /* linux && ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) || (!_BSD_SOURCE && !_GNU_SOURCE)) */ if (samples == 1) { const long num_processors = ACE_OS::sysconf (_SC_NPROCESSORS_ONLN); ACE_ASSERT (num_processors > 0); if (num_processors > 0) load = loadavg[0] / num_processors; else throw CORBA::TRANSIENT (); // Correct exception? } else throw CORBA::TRANSIENT (); // Correct exception? #elif defined (__NetBSD__) || defined (__APPLE__) double loadavg[1]; const int samples = ::getloadavg (loadavg, 1); if (samples == 1) { int mib[2], num_processors; size_t len; mib[0] = CTL_HW; mib[1] = HW_NCPU; len = sizeof(num_processors); sysctl(mib, 2, &num_processors, &len, 0, 0); ACE_ASSERT (num_processors > 0); if (num_processors > 0) load = loadavg[0] / num_processors; else throw CORBA::TRANSIENT (); // Correct exception? } else throw CORBA::TRANSIENT (); // Correct exception? #elif defined (__hpux) struct pst_dynamic psd; if (::pstat_getdynamic (&psd, sizeof (psd), (size_t) 1, 0) != -1) { const long & num_processors = psd.psd_proc_cnt; ACE_ASSERT (num_processors > 0); if (num_processors > 0) load = psd.psd_avg_1_min / num_processors; else throw CORBA::TRANSIENT (); // Correct exception? } else throw CORBA::TRANSIENT (); // Correct exception? #endif #if defined (linux) || defined (sun) || defined (__hpux) || defined(__NetBSD__) || defined (__APPLE__) CosLoadBalancing::LoadList * tmp = 0; ACE_NEW_THROW_EX (tmp, CosLoadBalancing::LoadList (1), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); CosLoadBalancing::LoadList_var load_list = tmp; load_list->length (1); load_list[0].id = CosLoadBalancing::LoadAverage; load_list[0].value = load; return load_list._retn (); #else ACE_UNUSED_ARG (load); throw CORBA::NO_IMPLEMENT (); #endif /* linux || sun || __hpux || __NetBSD__ || __APPLE__ */ }
FtRtecEventChannelAdmin::EventChannel_ptr TAO_FTEC_Event_Channel::activate(TAO_FTEC_Event_Channel::MEMBERSHIP membership) { FTRTEC::Fault_Detector_Loader* detector_loader = ACE_Dynamic_Service<FTRTEC::Fault_Detector_Loader>::instance("FTRTEC_Fault_Detector"); detector_loader->init(0, 0); if (FTRTEC::Identification_Service::instance() == 0) ORBSVCS_ERROR_RETURN((LM_ERROR, "No Identification\n"), 0); // initialize naming_contex CosNaming::NamingContext_var naming_context = resolve_init<CosNaming::NamingContext>(orb_.in(), "NameService"); // initialize group info publisher GroupInfoPublisher::instance()->set_naming_context(naming_context); if (FTRTEC::Replication_Service::instance()->init(0,0) == -1) return 0; GroupInfoPublisher::instance()->subscribe(FTRTEC::Replication_Service::instance()); Request_Context_Repository().init(orb_.in()); // get POAManager PortableServer::POAManager_var mgr = poa_->the_POAManager(); TAO::Utils::PolicyList_Destroyer policy_list(2); persistent_poa_ = create_persistent_poa(poa_, mgr, "FTEC_Persistant_POA", policy_list); // Activate the Event channel implementation TAO_EC_Event_Channel_Attributes attr (persistent_poa_.in (), persistent_poa_.in ()); TAO_FTEC_Event_Channel_Impl* ec = 0; ACE_NEW_THROW_EX (ec, TAO_FTEC_Event_Channel_Impl (attr), CORBA::NO_MEMORY()); this->ec_impl_ = ec; const FtRtecEventComm::ObjectId& object_id = FTRTEC::Identification_Service::instance()->object_id(); FtRtecEventComm::ObjectId consumer_admin_object_id(object_id); consumer_admin_object_id[9]++; FtRtecEventComm::ObjectId supplier_admin_object_id(consumer_admin_object_id); supplier_admin_object_id[9]++; ec->activate_object(orb_, supplier_admin_object_id, consumer_admin_object_id); FtRtecEventChannelAdmin::EventChannel_var result; activate_object_with_id(result.out(), persistent_poa_.in(), this, object_id); setup_object_group(this, naming_context.in(), membership, result.in()); return result._retn(); }
::DDS::DomainParticipant_ptr DDS_DomainParticipantFactory_i::create_participant_with_profile ( ::DDS::DomainId_t domain_id, const char * qos_profile, ::DDS::DomainParticipantListener_ptr a_listener, ::DDS::StatusMask mask) { DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::" "create_participant_with_profile"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO "DDS_DomainParticipantFactory_i::create_participant_with_profile - " "Start creating domain participant: " "profile <%C> - domain <%d>\n", qos_profile, domain_id)); DDS_DomainParticipantListener_i *ccm_dds_dpl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_dpl, DDS_DomainParticipantListener_i (a_listener), ::CORBA::NO_MEMORY ()); } DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO "DDS_DomainParticipantFactory_i::create_participant_with_profile - " "Creating participant: profile <%C> - domain <%d>\n", qos_profile, domain_id)); char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); DDSDomainParticipant * dds_dp = 0; if (lib_name != 0 && prof_name != 0) { dds_dp = DDSDomainParticipantFactory::get_instance ()-> create_participant_with_profile (domain_id, lib_name, prof_name, ccm_dds_dpl, mask); } ACE_OS::free (lib_name); ACE_OS::free (prof_name); if (!dds_dp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - " "Error: Unable to create DomainParticipant for domain <%d>\n", qos_profile, domain_id)); delete ccm_dds_dpl; return ::DDS::DomainParticipant::_nil (); } ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); DDS_ReturnCode_t retcode = dds_dp->enable (); if (retcode != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - " "Error: Unable to enable DomainParticipant for domain <%d>: <%C>\n", qos_profile, domain_id, ::CIAO::DDS4CCM::translate_retcode (retcode))); delete ccm_dds_dpl; throw ::CORBA::INTERNAL (); } if (ccm_dds_dpl) { ccm_dds_dpl->set_dds_dp (retval.in ()); } DDS_DomainParticipant_i * typed_dp = dynamic_cast < DDS_DomainParticipant_i *> (retval.in ()); if (typed_dp) { typed_dp->set_rti_entity (dds_dp); } return retval._retn (); }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL void TAO::Security::ORBInitializer::pre_init ( PortableInterceptor::ORBInitInfo_ptr info) { // Narrow to a TAO_ORBInitInfo object to get access to the // allocate_tss_slot_id() TAO extension. TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info); if (CORBA::is_nil (tao_info.in ())) { if (TAO_debug_level > 0) ORBSVCS_ERROR ((LM_ERROR, "(%P|%t) Security_ORBInitializer::pre_init:\n" "(%P|%t) Unable to narrow " "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" "(%P|%t) \"TAO_ORBInitInfo_ptr.\"\n")); throw CORBA::INTERNAL (); } // Reserve a TSS slot in the ORB core internal TSS resources for the // thread-specific portion of Security::Current. size_t tss_slot = tao_info->allocate_tss_slot_id (0 /* no cleanup function */); #if 1 #if 0 // why am I getting a BAD_OPERATION from no SSL context?! CORBA::String_var orb_id = info->orb_id (); // Create the SecurityLevel2::Current object. SecurityLevel2::Current_ptr current = SecurityLevel2::Current::_nil (); ACE_NEW_THROW_EX (current, TAO_Security_Current (tss_slot, orb_id.in ()), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); SecurityLevel2::Current_var security_current = current; // Register the SecurityLevel2::Current object reference with the // ORB. info->register_initial_reference ("SecurityCurrent", security_current.in ()); #endif /* * Instantiate and register the SecurityLevel2::SecurityManager */ SecurityLevel2::SecurityManager_ptr manager2; ACE_NEW_THROW_EX (manager2, TAO::Security::SecurityManager (/*need args*/), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); SecurityLevel2::SecurityManager_var security_manager2 = manager2; // Register the SecurityLevel2::SecurityManager object reference // with the ORB. info->register_initial_reference ("SecurityLevel2:SecurityManager", security_manager2.in ()); #endif // Rather than reserve another TSS slot in the ORB core internal TSS // resources for the thread-specific portion of // SecurityLevel3::SecurityCurrent object, we will re-use the slot // allocated earlier. // Create the SecurityLevel3::Current object. SecurityLevel3::SecurityCurrent_ptr current3; ACE_NEW_THROW_EX (current3, TAO::SL3::SecurityCurrent (tss_slot, tao_info->orb_core ()), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); SecurityLevel3::SecurityCurrent_var security_current3 = current3; // Register the SecurityLevel2::Current object reference with the // ORB. info->register_initial_reference ("SecurityLevel3:SecurityCurrent", security_current3.in ()); // Create the SecurityLevel3::CredentialsCurator object. SecurityLevel3::CredentialsCurator_ptr curator; ACE_NEW_THROW_EX (curator, TAO::SL3::CredentialsCurator, CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); SecurityLevel3::CredentialsCurator_var credentials_curator = curator; // Register the SecurityLevel3::CredentialsCurator object reference // with the ORB. info->register_initial_reference ("SecurityLevel3:CredentialsCurator", credentials_curator.in ()); // Create the SecurityLevel3::SecurityManager object. SecurityLevel3::SecurityManager_ptr manager3; ACE_NEW_THROW_EX (manager3, TAO::SL3::SecurityManager (credentials_curator.in ()), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); SecurityLevel3::SecurityManager_var security_manager3 = manager3; // Register the SecurityLevel3::SecurityManager object reference // with the ORB. info->register_initial_reference ("SecurityLevel3:SecurityManager", security_manager3.in ()); }
::DDS::DomainParticipant_ptr DDS_DomainParticipantFactory_i::create_participant (::DDS::DomainId_t domain_id, const ::DDS::DomainParticipantQos & qos, ::DDS::DomainParticipantListener_ptr a_listener, ::DDS::StatusMask mask) { DDS4CCM_TRACE ("DDS_DomainParticipantFactory_i::create_participant"); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO "DDS_DomainParticipantFactory_i::create_participant - " "Start creating domain participant for domain <%d>\n", domain_id)); DDS_DomainParticipantListener_i *ccm_dds_dpl = 0; if (! ::CORBA::is_nil (a_listener)) { ACE_NEW_THROW_EX (ccm_dds_dpl, DDS_DomainParticipantListener_i (a_listener), ::CORBA::NO_MEMORY ()); } ACE_CString qos_profile = "default"; DDS_DomainParticipantQos ccm_dds_qos; DDS_ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance()->get_default_participant_qos (ccm_dds_qos); if (retcode != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipantFactory_i" "::create_participant - " "Error: Unable to retrieve default participant qos\n")); return ::DDS::DomainParticipant::_nil (); } ccm_dds_qos <<= qos; DDSDomainParticipant * dds_dp = DDSDomainParticipantFactory::get_instance ()-> create_participant (domain_id, ccm_dds_qos, ccm_dds_dpl, mask); if (!dds_dp) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipantFactory_i" "::create_participant - " "Error: Unable to create DomainParticipant for domain <%d>\n", domain_id)); delete ccm_dds_dpl; return ::DDS::DomainParticipant::_nil (); } ::DDS::DomainParticipant_var retval; ACE_NEW_THROW_EX (retval, DDS_DomainParticipant_i (dds_dp), ::CORBA::NO_MEMORY ()); retcode = dds_dp->enable (); if (retcode != DDS_RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_DomainParticipantFactory_i" "::create_participant - " "Error: Unable to enable the domainparticipant " "for domain <%d>: <%C>\n", domain_id, ::CIAO::DDS4CCM::translate_retcode (retcode))); delete ccm_dds_dpl; throw ::CORBA::INTERNAL (); } if (ccm_dds_dpl) { ccm_dds_dpl->set_dds_dp (retval.in ()); } return retval._retn (); }
PortableGroup::ObjectGroup_ptr TAO_PG_ObjectGroupManager::add_member_i ( PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location, CORBA::Object_ptr member, const CORBA::Boolean check_type_id) { TAO_PG_ObjectGroup_Map_Entry * group_entry = this->get_group_entry (object_group); if (check_type_id) { CORBA::Boolean right_type_id = this->valid_type_id (object_group, group_entry, member); if (!right_type_id) { // The member's type_id does not match the object group's // type_id. throw PortableGroup::ObjectNotAdded (); } } TAO_PG_ObjectGroup_Array * groups = 0; if (this->location_map_.find (the_location, groups) == 0 && this->member_already_present (*groups, group_entry)) throw PortableGroup::MemberAlreadyPresent (); TAO_PG_MemberInfo member_info; member_info.group = PortableGroup::ObjectGroup::_duplicate (object_group); member_info.member = CORBA::Object::_duplicate (member); member_info.location = the_location; member_info.is_alive = true; if (groups == 0) { ACE_NEW_THROW_EX (groups, TAO_PG_ObjectGroup_Array, CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO::VMCID, ENOMEM), CORBA::COMPLETED_NO)); auto_ptr<TAO_PG_ObjectGroup_Array> safe_groups (groups); // This should not fail! if (this->location_map_.bind (the_location, groups) != 0) { throw PortableGroup::ObjectNotAdded (); } (void) safe_groups.release (); } // No object group member of the object group with the given // ObjectGroupId resides at the location. Add the object group // entry to array of object groups residing at the location. const size_t groups_len = groups->size (); groups->size (groups_len + 1); (*groups)[groups_len] = group_entry; // Don't bother checking for duplicates since a check is already // performed when binding to the location map above. if (group_entry->member_infos.insert_tail (member_info) != 0) throw PortableGroup::ObjectNotAdded (); return PortableGroup::ObjectGroup::_duplicate (object_group); }
CORBA::Any_ptr TAO_DynArray_i::to_any (void) { if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::TypeCode_var field_tc = this->get_element_type (); TAO_OutputCDR out_cdr; CORBA::Any_var field_any; size_t length = this->da_members_.size (); for (size_t i = 0; i < length; ++i) { // Recursive step. field_any = this->da_members_[i]->to_any (); TAO::Any_Impl *field_impl = field_any->impl (); TAO_OutputCDR field_out; TAO_InputCDR field_cdr (static_cast<ACE_Message_Block *> (0)); if (field_impl->encoded ()) { TAO::Unknown_IDL_Type * const field_unk = dynamic_cast<TAO::Unknown_IDL_Type *> (field_impl); if (!field_unk) throw CORBA::INTERNAL (); field_cdr = field_unk->_tao_get_cdr (); } else { field_impl->marshal_value (field_out); TAO_InputCDR tmp_in (field_out); field_cdr = tmp_in; } (void) TAO_Marshal_Object::perform_append (field_tc.in (), &field_cdr, &out_cdr); } TAO_InputCDR in_cdr (out_cdr); CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX (retval, CORBA::Any, CORBA::NO_MEMORY ()); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), CORBA::NO_MEMORY ()); retval->replace (unk); return retval; }