PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group::add_member_to_iogr (CORBA::Object_ptr member) { // assume internals is locked PortableGroup::ObjectGroup_var result; //////////////////////////// // @@ HACK ALERT // The PortableGroup::ObjectGroupManager creates an object reference // containing a dummy entry so it will have a place to store the // tagged group component. If this is the first entry, we need to // remove that entry once we have a *real* member. This can be // avoided when we get support for TAG_MULTIPLE_COMPONENTS. For // now, we already have a copy of the tagGroupTagged component and // we're going to use it below wen we increment the group version so // we can clean out the dummy entry. PortableGroup::ObjectGroup_var cleaned = PortableGroup::ObjectGroup::_duplicate (this->reference_.in ()); if (this->empty_) { // remove the original profile. It's a dummy entry supplied by // create_object. cleaned = this->manipulator_.remove_profiles (cleaned.in (), this->reference_.in ()); this->empty_ = 0; } // create a list of references to be merged TAO_IOP::TAO_IOR_Manipulation::IORList iors (2); iors.length (2); iors [0] = CORBA::Object::_duplicate (cleaned.in()); iors [1] = CORBA::Object::_duplicate (member); // Now merge the list into one new IOGR result = this->manipulator_.merge_iors (iors); return result._retn (); }
CORBA::Boolean TAO_LB_ObjectReferenceFactory::find_object_group ( const char * repository_id, CORBA::ULong & index, PortableGroup::ObjectGroup_out object_group) { if (!this->load_managed_object (repository_id, index)) return false; PortableGroup::ObjectGroup_var group; if (this->table_.find (repository_id, group) != 0) { if (ACE_OS::strcasecmp (this->object_groups_[index], "CREATE") == 0) { PortableGroup::Criteria criteria (1); criteria.length (1); PortableGroup::Property & property = criteria[0]; property.nam.length (1); property.nam[0].id = CORBA::string_dup ("org.omg.PortableGroup.MembershipStyle"); // Configure for application-controlled membership. PortableGroup::MembershipStyleValue msv = PortableGroup::MEMB_APP_CTRL; property.val <<= msv; PortableGroup::GenericFactory::FactoryCreationId_var fcid; group = this->lm_->create_object (repository_id, criteria, fcid.out ()); CORBA::ULong const len = this->fcids_.size (); this->fcids_.size (len + 1); // Incremental growth. Yuck! this->fcids_[len] = fcid; } else { group = this->orb_->string_to_object (this->object_groups_[index]); } if (this->table_.bind (repository_id, group) != 0) { if (TAO_debug_level > 0) ORBSVCS_ERROR ((LM_ERROR, "TAO_LB_ObjectReferenceFactory::" "find_object_group - " "Couldn't bind object group reference.\n")); throw CORBA::INTERNAL (); } object_group = group._retn (); } return 1; }
int FTAPP::FT_Creator::run (void) { int result = 0; size_t typeCount = this->create_roles_.size(); size_t nType = 0; for ( nType = 0; result == 0 && nType < typeCount; ++nType) { const char * role = this->create_roles_[nType].c_str(); ACE_OS::fprintf (stdout, "\nCreator: Creating group of %s\n", role); PortableGroup::ObjectGroup_var group = this->creator_.create_group ( role, this->write_iors_); if (this->write_iogr_) { CORBA::String_var iogr = this->orb_->object_to_string (group.in ()); char iogr_filename[1000]; ACE_OS::snprintf (iogr_filename, sizeof(iogr_filename), "%s%s_" ACE_SIZE_T_FORMAT_SPECIFIER_ASCII ".iogr", this->prefix_.c_str (), role, this->iogr_seq_); FILE * iogr_file = ACE_OS::fopen (iogr_filename, "w"); if (iogr_file != 0) { char const * siogr = static_cast<const char *> (iogr.in ()); ACE_OS::fwrite (siogr, 1, ACE_OS::strlen(siogr), iogr_file); ACE_OS::fclose (iogr_file); } else { ACE_OS::fprintf (stderr, "Can't open iogr output file %s\n", iogr_filename); result = 1; } } if(this->ns_register_) { char iogr_name[1000]; ACE_OS::snprintf (iogr_name, sizeof(iogr_name), "%s_%s_" ACE_SIZE_T_FORMAT_SPECIFIER_ASCII, this->prefix_.c_str (), role, this->iogr_seq_); CosNaming::Name this_name (1); this_name.length (1); this_name[0].id = CORBA::string_dup (iogr_name); this->naming_context_->rebind (this_name, group.in()); } iogr_seq_ += 1; } typeCount = this->unregister_roles_.size(); for ( nType = 0; result == 0 && nType < typeCount; ++nType) { const char * role = this->unregister_roles_[nType].c_str(); result = this->creator_.unregister_role (role); } return result; }