diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-29 20:19:16 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-29 20:19:16 +0000 |
commit | d0ca10a3c4a3965aad296e569f3a8b03abc2ff12 (patch) | |
tree | 2af81a399374ef191f9944642c3d5d68df7ee466 | |
parent | 60dcd93d4c41dc09d104cb867de366694fa73443 (diff) | |
download | ATCD-d0ca10a3c4a3965aad296e569f3a8b03abc2ff12.tar.gz |
ChangeLogTag: Wed Oct 29 13:52:36 2003 Dale Wilson <wilson_d@ociweb.com>
19 files changed, 1093 insertions, 94 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index c8e276147d9..3635ed75a0f 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,51 @@ +Wed Oct 29 13:52:36 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + Support IOGR in create_object and add_member. + + * orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp: + unregister during fini. + + * orbsvcs/orbsvcs/FT_FaultDetectorFactory.idl: + Define factory registration information for FaultDetectorFactory + + * orbsvcs/orbsvcs/FT_Replica.idl: + Remove commented out GenericFactory declaration (it's in PortableGroup.idl) + + * orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp: + Add debug messages. + + * orbsvcs/orbsvcs/PortableGroup.idl: + Add interface TAO_UpdateObjectGroup for IOGR distribution. + + * orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp:\ + Add a missing string_dup (ouch). + + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h: + New files used by ReplicationManager to store object group information. + Among other things, includes support for distributing updated IOGR via TAO_UpdateObjectGroup interface. + + * orbsvcs/tests/FT_App/FT_Client.cpp: + Cosmetic changes. + + * orbsvcs/tests/FT_App/FT_TestReplica.idl: + * orbsvcs/tests/FT_App/FT_TestReplica_i.h: + * orbsvcs/tests/FT_App/FT_TestReplica_i.cpp: + Derive from TAO_UpdateObjectGroup + Stub implemntation of TAO_UpdateObjectGroup + + * orbsvcs/tests/FT_App/run_test_basic.pl: + Add dummy -ORBInitRef to prevent multicasting for ReplicationManager. + + * utils/catior/catior.cpp: + Add partial support for TAG_GROUP and TAG_FT_PRIMARY + + These changes were made in the oci_haft branch. + Tue Oct 28 10:28;20 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/tests/FaultTolerance/IOGR/FaultTolerance_IOGR.mpc: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index 79b26d690b1..9f3f5735315 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -15,16 +15,26 @@ #include "FT_ReplicationManager.h" #include "FT_Property_Validator.h" -#include "ace/Get_Opt.h" -#include "tao/Messaging/Messaging.h" -#include "tao/IORTable/IORTable.h" -#include "tao/debug.h" -#include "orbsvcs/PortableGroup/PG_Properties_Decoder.h" -#include "orbsvcs/PortableGroup/PG_Properties_Encoder.h" -#include "orbsvcs/PortableGroup/PG_Property_Utils.h" -#include "orbsvcs/PortableGroup/PG_conf.h" -#include "orbsvcs/FaultTolerance/FT_IOGR_Property.h" -#include "orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h" +#include <ace/Get_Opt.h> +#include <tao/Messaging/Messaging.h> +#include <tao/IORTable/IORTable.h> +#include <tao/debug.h> +#include <orbsvcs/PortableGroup/PG_Object_Group.h> +#include <orbsvcs/PortableGroup/PG_Properties_Decoder.h> +#include <orbsvcs/PortableGroup/PG_Properties_Encoder.h> +#include <orbsvcs/PortableGroup/PG_Property_Utils.h> +#include <orbsvcs/PortableGroup/PG_conf.h> +#include <orbsvcs/PortableGroup/PG_Utils.h> + + +/////////////////////////////////////////////////////////////// +// parallel Object Group Map that is FT/IOGR aware +// @@ todo reconcile this with the LB centric implementation +#include <orbsvcs/PortableGroup/PG_Object_Group_Map.h> + + +#include <orbsvcs/FaultTolerance/FT_IOGR_Property.h> +#include <orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h> ACE_RCSID (FT_ReplicationManager, FT_ReplicationManager, @@ -48,16 +58,12 @@ TAO::FT_ReplicationManager::FT_ReplicationManager () , factory_registry_("ReplicationManager::FactoryRegistry") , quit_(0) { - //@@Note: this->init() is not called here (in the constructor) - // since it may throw an exception. Throwing an exception in - // a constructor in an emulated exception environment is - // problematic since native exception semantics cannot be - // reproduced in such a case. As such, init() must be called - // by whatever code instantiates this ReplicationManager. + // @@ init must be called before using this object. } TAO::FT_ReplicationManager::~FT_ReplicationManager (void) { + // @@ cleanup happens in fini } @@ -650,6 +656,7 @@ TAO::FT_ReplicationManager::create_member ( ACE_ENV_ARG_PARAMETER); } + PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::add_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -661,6 +668,18 @@ TAO::FT_ReplicationManager::add_member ( PortableGroup::MemberAlreadyPresent, PortableGroup::ObjectNotAdded)) { + + FT::TagFTGroupTaggedComponent ft_tag_component; + TAO_FT_IOGR_Property prop (ft_tag_component); + CORBA::Boolean first_member = ! iorm_->is_primary_set(&prop, object_group); + + PortableGroup::TagGroupTaggedComponent tag_component; + + if (! TAO::PG_Utils::get_tagged_component (object_group, tag_component)) + { + ACE_THROW (PortableGroup::ObjectGroupNotFound()); + } + ///////////////////////////////////////////// // create a list containing the existing ObjectGroup // and the newly added member @@ -677,26 +696,48 @@ TAO::FT_ReplicationManager::add_member ( // Now merge the list into one new IOGR PortableGroup::ObjectGroup_var merged = - iorm_->merge_iors (iors ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + iorm_->merge_iors (iors ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - FT::TagFTGroupTaggedComponent ft_tag_component; - TAO_FT_IOGR_Property prop (ft_tag_component); - if (! iorm_->is_primary_set (&prop, merged.in () - ACE_ENV_ARG_PARAMETER) ) + if (first_member) { -#if 10 // DEBUG_DISABLE + // remove the original profile. It's a dummy entry supplied by create_object. + PortableGroup::ObjectGroup_var cleaned = + iorm_->remove_profiles (merged, object_group); ACE_CHECK; - if (! iorm_->set_primary (&prop, member, merged.in () ACE_ENV_ARG_PARAMETER)) + if (! iorm_->set_primary (&prop, member, cleaned.in () ACE_ENV_ARG_PARAMETER)) { ACE_ERROR ((LM_ERROR, "Can't set primary in IOGR after adding first replica.\n" )); } -#endif //DEBUG_DISABLE + ACE_CHECK; + merged = cleaned; } ACE_CHECK; + tag_component.object_group_ref_version += 1; + ACE_DEBUG ((LM_DEBUG, + "add_member: Setting IOGR version to %u\n", ACE_static_cast(unsigned, tag_component.object_group_ref_version) + )); + + // Set the property + TAO::PG_Utils::set_tagged_component (merged, + tag_component); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + /////////////////////// + // Now we do it again using + // our own object group collection + TAO::PG_Object_Group * group; + if (this->object_group_map_.find_group (merged, group)) + { + group->add_member (the_location, member ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + // Set the new group reference + // and distribute it to all members + group->set_reference (merged, 1); + } return merged._retn(); } @@ -809,14 +850,37 @@ TAO::FT_ReplicationManager::create_object ( PortableGroup::InvalidProperty, PortableGroup::CannotMeetCriteria)) { - //@@ Can we really use the TAO_PG_GenericFactory - // implementation to create an object group? + /// Start with the LB-oriented create_object CORBA::Object_var obj = this->generic_factory_.create_object ( type_id, the_criteria, factory_creation_id ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + //////////////////////////////// + // then create the corresponding + // entry in our object group map + + PortableGroup::ObjectGroupId oid; + if (! ((*factory_creation_id) >>= oid )) + { + ACE_ERROR ((LM_ERROR, + "ReplicationManager::create_object: unexpected type of factory creation id.\n" + )); + ACE_THROW (PortableGroup::ObjectNotCreated()); + ACE_CHECK_RETURN (CORBA::Object::_nil()); + } + + TAO::PG_Object_Group * objectGroup; + ACE_NEW_THROW_EX ( + objectGroup, + TAO::PG_Object_Group (oid, type_id, the_criteria), + CORBA::NO_MEMORY()); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->object_group_map_.insert_group(oid, objectGroup); + return obj._retn(); } diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h index 90992dfb4c2..f8424ed7e89 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h @@ -23,18 +23,18 @@ //@@ Review all these header files and make sure they are all needed // or if some can be replaced with forward declarations. -#include "orbsvcs/FT_ReplicationManagerS.h" -#include "orbsvcs/FT_NotifierC.h" -#include "tao/IORManipulation/IORC.h" -#include "orbsvcs/PortableGroupC.h" -#include "orbsvcs/PortableGroup/PG_PropertyManager.h" -#include "orbsvcs/PortableGroup/PG_GenericFactory.h" -#include "orbsvcs/PortableGroup/PG_ObjectGroupManager.h" +#include <orbsvcs/FT_ReplicationManagerS.h> +#include <orbsvcs/FT_NotifierC.h> +#include <tao/IORManipulation/IORC.h> +#include <orbsvcs/PortableGroupC.h> +#include <orbsvcs/PortableGroup/PG_PropertyManager.h> +#include <orbsvcs/PortableGroup/PG_GenericFactory.h> +#include <orbsvcs/PortableGroup/PG_ObjectGroupManager.h> #include <orbsvcs/PortableGroup/PG_FactoryRegistry.h> -#include "orbsvcs/FaultTolerance/FT_Service_Activate.h" -#include "orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h" -#include "orbsvcs/CosNamingC.h" - +#include <orbsvcs/PortableGroup/PG_Object_Group_Map.h> +#include <orbsvcs/FaultTolerance/FT_Service_Activate.h> +#include <orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h> +#include <orbsvcs/CosNamingC.h> namespace TAO { @@ -436,8 +436,8 @@ namespace TAO * Implementation methods should assume the mutex is * locked if necessary. */ - ACE_Mutex internals_; - typedef ACE_Guard<ACE_Mutex> InternalGuard; + ACE_SYNCH_MUTEX internals_; + typedef ACE_Guard<ACE_SYNCH_MUTEX> InternalGuard; /// The orb CORBA::ORB_var orb_; @@ -465,6 +465,7 @@ namespace TAO /// The ObjectGroupManager that implements the functionality /// necessary for application-controlled object group membership. +// TAO::PG_ObjectGroupManager object_group_manager_; TAO_PG_ObjectGroupManager object_group_manager_; /// The PropertyManager that is reponsible for parsing all criteria, @@ -475,7 +476,9 @@ namespace TAO TAO_PG_GenericFactory generic_factory_; - + /// A container for our object group information + TAO::PG_Object_Group_Map object_group_map_; + /// The fault notifier. FT::FaultNotifier_var fault_notifier_; diff --git a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp index 66b55475e01..1dfb540239e 100644 --- a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp +++ b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp @@ -41,10 +41,6 @@ return /* value goes here */ -// todo: find me a home -static const char * role_name = "FaultDetector"; - - ////////////////////////////////////////////////////// // FT_FaultDetectorFactory_i Construction/destruction @@ -277,14 +273,14 @@ int TAO::FT_FaultDetectorFactory_i::init (CORBA::ORB_var & orb ACE_ENV_ARG_DECL) info.the_criteria.length(1); info.the_criteria[0].nam.length(1); info.the_criteria[0].nam[0].id = CORBA::string_dup(PortableGroup::role_criterion); - info.the_criteria[0].val <<= CORBA::string_dup(role_name); + info.the_criteria[0].val <<= CORBA::string_dup(FT::FAULT_DETECTOR_ROLE_NAME); ACE_DEBUG ((LM_DEBUG, "FaultDetector registering with ReplicationManager.\n" )); this->factory_registry_->register_factory( - role_name, - role_name, + FT::FAULT_DETECTOR_ROLE_NAME, + FT::FAULT_DETECTOR_ROLE_NAME, info ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -368,6 +364,16 @@ int TAO::FT_FaultDetectorFactory_i::fini (ACE_ENV_SINGLE_ARG_DECL) ACE_ENV_ARG_PARAMETER); this->ns_name_ = 0; } + + if (this->registered_) + { + this->factory_registry_->unregister_factory( + FT::FAULT_DETECTOR_ROLE_NAME, + this->location_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + this->registered_ = 0; + } return 0; } diff --git a/TAO/orbsvcs/orbsvcs/FT_FaultDetectorFactory.idl b/TAO/orbsvcs/orbsvcs/FT_FaultDetectorFactory.idl index a29cc47eb3a..2e626c57449 100644 --- a/TAO/orbsvcs/orbsvcs/FT_FaultDetectorFactory.idl +++ b/TAO/orbsvcs/orbsvcs/FT_FaultDetectorFactory.idl @@ -59,6 +59,12 @@ module FT // end of names from FT CORBA specification /////////////////////////////////////////// + + ///////////////////////////// + // RoleName FaultDetectorFactory uses to register + // with Factory Registery + const string FAULT_DETECTOR_ROLE_NAME = "FT_FaultDetector"; + /** * A FaultDetectorFactory creates and manages a set of FaultDetectors. * diff --git a/TAO/orbsvcs/orbsvcs/FT_Replica.idl b/TAO/orbsvcs/orbsvcs/FT_Replica.idl index 7065c6a0ca5..eb351729e6e 100644 --- a/TAO/orbsvcs/orbsvcs/FT_Replica.idl +++ b/TAO/orbsvcs/orbsvcs/FT_Replica.idl @@ -13,25 +13,6 @@ module FT { -#if 0 - // Specification of GenericFactory Interface - // which ReplicationManager Inherits and Application Objects Implement - interface GenericFactory { - typedef any FactoryCreationId; - Object create_object(in _TypeId type_id, - in Criteria the_criteria, - out FactoryCreationId factory_creation_id) - raises (NoFactory, - ObjectNotCreated, - InvalidCriteria, - InvalidProperty, - CannotMeetCriteria); - - void delete_object(in FactoryCreationId factory_creation_id) - raises (ObjectNotFound); - }; -#endif - // Specification of PullMonitorable Interface // which Application Objects Inherit interface PullMonitorable { diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp index a82900b78ef..c6298aa48f5 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp @@ -81,9 +81,12 @@ namespace TAO ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - if (ACE_OS::strcmp (op.in (), - "tao_update_object_group") == 0) + if (ACE_OS::strcmp (op.in (), + "tao_update_object_group") == 0) { + ACE_DEBUG ((LM_DEBUG, + "FT_ServerRequestInterceptor updating IOGR.\n" + )); this->update_iogr (ri ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -147,12 +150,20 @@ namespace TAO this->object_group_ref_version_) { ACE_ERROR ((LM_ERROR, - "TAO-FT (%P|%t) - Wrong version information ", - "within the interceptor \n")); + "TAO-FT (%P|%t) - Wrong version information " + "within the interceptor [%u | %u] \n", + ACE_static_cast( unsigned, fgvsc.object_group_ref_version ), + ACE_static_cast( unsigned, this->object_group_ref_version_) + )); } else if (fgvsc.object_group_ref_version < this->object_group_ref_version_) { + ACE_DEBUG ((LM_DEBUG, + "Forwarding request to new IOGR [%u | %u] \n", + ACE_static_cast( unsigned, fgvsc.object_group_ref_version ), + ACE_static_cast( unsigned, this->object_group_ref_version_) + )); // Notice that this is a permanent forward. ACE_THROW (PortableInterceptor::ForwardRequest ( this->iogr_, @@ -162,6 +173,12 @@ namespace TAO this->object_group_ref_version_) && !this->is_primary_) { + + ACE_DEBUG ((LM_DEBUG, + "Request arrived at backup replica. Throwing TRANSIENT.[%u] \n", + ACE_static_cast( unsigned, this->object_group_ref_version_) + )); + ACE_THROW (CORBA::TRANSIENT ( CORBA::SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup.idl b/TAO/orbsvcs/orbsvcs/PortableGroup.idl index 135ebd41938..ed0088d1345 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup.idl +++ b/TAO/orbsvcs/orbsvcs/PortableGroup.idl @@ -292,6 +292,19 @@ module PortableGroup }; // end of FactoryRegistry + + const string TAO_UPDATE_OBJECT_GROUP_METHOD_NAME = "tao_update_object_group"; + + interface TAO_UpdateObjectGroup { + /** + * Pseudo used method to update IOGR in Object Group Members + * TAO specific. The CORBA spec. doesn't address the issue. + */ + void tao_update_object_group (in PortableGroup::ObjectGroup iogr); + }; + + + }; // end PortableGroup #endif /* _PORTABLEGROUP_IDL_ */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp index a3a8cb935c5..093ca2af618 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_FactoryRegistry.cpp @@ -616,7 +616,7 @@ void TAO::PG_FactoryRegistry::unregister_factory_by_location ( } else { - type_id = ""; + type_id = CORBA::string_dup(""); ACE_ERROR(( LM_INFO, "%s: list_factories_by_role: unknown role %s\n", this->identity_.c_str(), diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp new file mode 100644 index 00000000000..f8381023de7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -0,0 +1,302 @@ +// -*- C++ -*- +// +// $Id$ + +#include "PG_Object_Group.h" + +#include <ace/Get_Opt.h> +#include <ace/Vector_T.h> +#include <tao/PortableServer/ORB_Manager.h> +#include <orbsvcs/PortableGroup/PG_Operators.h> // Borrow operator == on CosNaming::Name + +/** + * The single POA used to manage object groups + */ +//static +PortableServer::POA_var TAO::PG_Object_Group::poa_; + + +TAO::PG_Object_Group::MemberInfo::MemberInfo (CORBA::Object_var member) + : member_(member) + , factory_(PortableGroup::GenericFactory::_nil()) +{ +} + +TAO::PG_Object_Group::MemberInfo::MemberInfo ( + CORBA::Object_var member, + PortableGroup::GenericFactory_var factory, + PortableGroup::GenericFactory::FactoryCreationId factory_id) + : member_(member) + , factory_(factory) + , factory_id_(factory_id) +{ +} + +TAO::PG_Object_Group::MemberInfo::~MemberInfo () +{ + if( ! CORBA::is_nil (factory_)) + { + ACE_TRY_NEW_ENV + { + factory_->delete_object (factory_id_); + } + ACE_CATCHANY; + { + // ignore this. It may have faulted and gone away. + // (and besides, we're in a destructor. + } + ACE_ENDTRY; + } +} + +TAO::PG_Object_Group::PG_Object_Group () + : role_ ("") + , type_id_ ("") + , group_id_( 0) + , reference_ (0) + , primary_location_(0) + , properties_ (0) +{ +} + + +TAO::PG_Object_Group::PG_Object_Group ( + PortableGroup::ObjectGroupId oid, + const char * type_id, + PortableGroup::Criteria the_criteria) + : role_ (type_id) + , type_id_ (CORBA::string_dup(type_id)) + , group_id_(oid) + , reference_ (0) + , primary_location_(0) + , properties_ (the_criteria) +{ +} + +TAO::PG_Object_Group::~PG_Object_Group () +{ + for (MemberMap_Iterator it = this->members_.begin(); + it != this->members_.end(); + this->members_.begin()) + { + MemberInfo * member = (*it).int_id_; + delete member; + members_.unbind((*it).ext_id_); + } +} + +void TAO::PG_Object_Group::set_reference (PortableGroup::ObjectGroup_ptr reference, int distribute) +{ + this->reference_ = PortableGroup::ObjectGroup::_duplicate (reference); + if (distribute) + { + for ( MemberMap_Iterator it = members_.begin(); + it != members_.end(); + ++it) + { + MemberInfo const * info = (*it).int_id_; + PortableGroup::TAO_UpdateObjectGroup_var uog = PortableGroup::TAO_UpdateObjectGroup::_narrow ( info->member_); + if (! CORBA::is_nil (uog) ) + { + ACE_TRY_NEW_ENV + { + uog->tao_update_object_group (PortableGroup::ObjectGroup::_duplicate (this->reference_)); + } + ACE_CATCHANY + { + // we expect an exception + // tao_update_object_group is not a real method + } + ACE_ENDTRY; + } + else + { + ACE_ERROR ((LM_ERROR, + "TAO::PG_Object_Group::set_reference can't narrow member reference to PortableGroup::TAO_UpdateObjectGroup.\n" + )); + } + } + } +} + + +PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group::reference()const +{ + return PortableGroup::ObjectGroup::_duplicate (this->reference_); +} + +void TAO::PG_Object_Group::set_membership_style (PortableGroup::MembershipStyleValue style) +{ + this->membership_style_ = style; +} + +PortableGroup::MembershipStyleValue TAO::PG_Object_Group::membership_style () const +{ + return this->membership_style_; +} + +void TAO::PG_Object_Group::initial_number_replicas (PortableGroup::InitialNumberReplicasValue count) +{ + this->initial_number_replicas_ = count; +} + +PortableGroup::InitialNumberReplicasValue TAO::PG_Object_Group::initial_number_replicas () const +{ + return this->initial_number_replicas_; +} + +void TAO::PG_Object_Group::set_minimum_number_replicas (PortableGroup::MinimumNumberReplicasValue count) +{ + this->minimum_number_replicas_ = count; +} + +PortableGroup::MinimumNumberReplicasValue TAO::PG_Object_Group::minimum_number_replicas ()const +{ + return this->minimum_number_replicas_; +} + +void TAO::PG_Object_Group::set_group_specific_factories (const PortableGroup::FactoryInfos & infos) +{ + this->group_specific_factories_ = infos; +} + + +void TAO::PG_Object_Group::group_specific_factories (PortableGroup::FactoryInfos & result) const +{ + // copy is needed to have some semblance of thread safeness. + // if performance is an issue avoid this method. + result = this->group_specific_factories_; +} + + +void TAO::PG_Object_Group::set_primary_location (PortableGroup::Location & location) +{ + this->primary_location_ = location; +} + +const PortableGroup::Location & TAO::PG_Object_Group::primary_location() const +{ + return this->primary_location_; +} + +#ifdef NOT_IMPLEMENTED +void TAO::PG_Object_Group::create_member ( + const PortableGroup::Location & the_location, + const char * type_id, + const PortableGroup::Criteria & the_criteria + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberAlreadyPresent, + PortableGroup::ObjectNotCreated, + PortableGroup::InvalidCriteria, + PortableGroup::CannotMeetCriteria)) +{ + ACE_ASSERT(0); + int todo; +} +#endif + +void TAO::PG_Object_Group::add_member ( + const PortableGroup::Location & the_location, + CORBA::Object_ptr member + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberAlreadyPresent, + PortableGroup::ObjectNotAdded)) +{ + MemberInfo * info = 0; + ACE_NEW_THROW_EX (info, MemberInfo(member), + CORBA::NO_MEMORY()); + + if (members_.bind (the_location, info) != 0) + { + ACE_THROW(CORBA::NO_MEMORY()); + ACE_CHECK; + } +} + +#ifdef NOT_IMPLEMENTED +void TAO::PG_Object_Group::remove_member ( + const PortableGroup::Location & the_location + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberNotFound)) +{ + ACE_ASSERT(0); + int todo; +} +#endif + +#ifdef NOT_IMPLEMENTED +void TAO::PG_Object_Group::locations_of_members ( + PortableGroup::Locations & locations + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_ASSERT(0); + int todo; +} +#endif + +PortableGroup::ObjectGroupId TAO::PG_Object_Group::get_object_group_id () const +{ + return this->group_id_; +} + +#ifdef NOT_IMPLEMENTED + +CORBA::Object_ptr TAO::PG_Object_Group::get_member_ref ( + const PortableGroup::Location & loc + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberNotFound)) +{ + CORBA::Object_ptr result = CORBA::Object::_nil(); + ACE_ASSERT(0); + int todo; + return result; +} +#endif + +#ifdef NOT_IMPLEMENTED +void TAO::PG_Object_Group::set_properties_dynamically ( + const PortableGroup::Properties & overrides + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)) +{ + int todo; +} +#endif + +void TAO::PG_Object_Group::get_properties (PortableGroup::Properties_var & result) const +{ + (*result) = this->properties_; +} + + +PortableGroup::TypeId TAO::PG_Object_Group::get_type_id () const +{ + return CORBA::string_dup(this->type_id_); +} + + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + + template ACE_Hash_Map_Manager_Ex <PortableGroup::Location, MemberInfo *, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, MapMutex>; + template ACE_Hash_Map_Entry <PortableGroup::Location, MemberInfo *>; + template ACE_Hash_Map_Iterator_Ex <PortableGroup::Location, MemberInfo *, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, MapMutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate ACE_Hash_Map_Manager_Ex <PortableGroup::Location, MemberInfo *, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, MapMutex> +# pragma instantiate ACE_Hash_Map_Entry <PortableGroup::Location, MemberInfo *> +# pragma instantiate ACE_Hash_Map_Iterator_Ex <PortableGroup::Location, MemberInfo *, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, MapMutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h new file mode 100644 index 00000000000..6439f95212c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h @@ -0,0 +1,291 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file PG_Object_Group.h + * + * $Id$ + * + * Manage all information related to an object group. + * @@ Note: the above description is optimistic. The hope is to eventually + * @@ consolidate all information related to an object group into this object. + * @@ however at the moment GenericFactory, ObjectGroupManager, and FT_ReplicationManager + * @@ have parallel collections of object group information. + * + * @author Dale Wilson <wilson_d@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_PG_OBJECT_GROUP_H_ +#define TAO_PG_OBJECT_GROUP_H_ +#include /**/ <ace/pre.h> +#include <ace/ACE.h> + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +////////////////////////////////// +// Classes declared in this header +namespace TAO +{ + class PG_Object_Group; +} + +///////////////////////////////// +// Includes needed by this header +#include <orbsvcs/PortableGroupC.h> +#include <tao/PortableServer/PortableServer.h> +#include <ace/Hash_Map_Manager_T.h> +#include "PG_Location_Hash.h" +#include "PG_Location_Equal_To.h" + + +///////////////////// +// Forward references + +namespace TAO +{ + /** + */ + class TAO_PortableGroup_Export PG_Object_Group + { + + // Information about an object group member + struct MemberInfo + { + /// Reference to the object. + CORBA::Object_var member_; + /// The factory that was used to create this object + /// nil if application created. + PortableGroup::GenericFactory_var factory_; + /// FactoryCreationId assigned to the member. Empty if application created + PortableGroup::GenericFactory::FactoryCreationId factory_id_; + /// Construct an application-supplied member. + MemberInfo (CORBA::Object_var member); + /// Construct a infrastructure-created member. + MemberInfo ( + CORBA::Object_var member, + PortableGroup::GenericFactory_var factory, + PortableGroup::GenericFactory::FactoryCreationId factory_id); + ~MemberInfo(); + }; + + typedef TAO_SYNCH_MUTEX MemberMapMutex; + typedef ACE_Hash_Map_Manager_Ex < + PortableGroup::Location, + MemberInfo *, + TAO_PG_Location_Hash, + TAO_PG_Location_Equal_To, + MemberMapMutex> MemberMap; + typedef ACE_Hash_Map_Entry <PortableGroup::Location, MemberInfo *> MemberMap_Entry; + typedef ACE_Hash_Map_Iterator_Ex < + PortableGroup::Location, + MemberInfo *, + TAO_PG_Location_Hash, + TAO_PG_Location_Equal_To, + MemberMapMutex> MemberMap_Iterator; + + public: + /// Constructor + PG_Object_Group (); + + /// Constructor + PG_Object_Group ( + PortableGroup::ObjectGroupId oid, + const char * type_id, + PortableGroup::Criteria the_criteria); + + /// Destructor + ~PG_Object_Group (); + + + ///////////////// + // public methods + + public: + + + void set_oid (PortableGroup::ObjectGroupId oid); + void set_typeid (PortableGroup::TypeId type_id); + void set_properties (PortableGroup::Criteria the_criteria); + /** + * + * @ param reference the new IOGR for this group. + * @ distribute bool if true, distribute IOGR to all members + */ + void set_reference (PortableGroup::ObjectGroup_ptr reference, int distribute); + + PortableGroup::ObjectGroup_ptr reference()const; + + void set_membership_style (PortableGroup::MembershipStyleValue style); + PortableGroup::MembershipStyleValue membership_style () const; + + void initial_number_replicas (PortableGroup::InitialNumberReplicasValue count); + PortableGroup::InitialNumberReplicasValue initial_number_replicas () const; + + void set_minimum_number_replicas (PortableGroup::MinimumNumberReplicasValue count); + PortableGroup::MinimumNumberReplicasValue minimum_number_replicas ()const; + + void set_group_specific_factories (const PortableGroup::FactoryInfos & infos); + /** + * Note the caller receives a copy of the factoryinfos in the result argument. + * inefficient, but thread safe. + */ + void group_specific_factories (PortableGroup::FactoryInfos & result) const; + + // Note: primary location is a concept from FT CORBA. + // It doesn't hurt other PortableGroup-based services to + // have these two metods and the underlying member. + void set_primary_location (PortableGroup::Location & primary_location_); + const PortableGroup::Location & primary_location() const; + + /** + * returns a duplicate + * caller must release + */ + PortableGroup::TypeId get_type_id ()const; + + void get_properties (PortableGroup::Properties_var & result) const; + + ///////////////////////////////////////////// + // Applicable ObjectGroupManager(OGM) methods + // The following methods in OGM all have an object group as the + // first parameter. The OGM should implement these methods by finding + // the corresponding TAO_PG_Object_Group and delegating to these methods. +#ifdef NOT_IMPLEMENTED + void create_member ( + const PortableGroup::Location & the_location, + const char * type_id, + const PortableGroup::Criteria & the_criteria + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberAlreadyPresent, + PortableGroup::ObjectNotCreated, + PortableGroup::InvalidCriteria, + PortableGroup::CannotMeetCriteria)); +#endif + + void add_member ( + const PortableGroup::Location & the_location, + CORBA::Object_ptr member + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberAlreadyPresent, + PortableGroup::ObjectNotAdded)); + +#ifdef NOT_IMPLEMENTED + void remove_member ( + const PortableGroup::Location & the_location + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberNotFound)); +#endif + +#ifdef NOT_IMPLEMENTED + void locations_of_members ( + PortableGroup::Locations & locations + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); +#endif + + PortableGroup::ObjectGroupId get_object_group_id () const; + +#ifdef NOT_IMPLEMENTED + CORBA::Object_ptr get_member_ref ( + const PortableGroup::Location & loc + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::MemberNotFound)); +#endif + +#ifdef NOT_IMPLEMENTED + void set_properties_dynamically ( + const PortableGroup::Properties & overrides + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)); + +#endif + + ///////////////////////// + // Implementation methods + private: + + ///////////////////////// + // Forbidden methods + private: + PG_Object_Group (const PG_Object_Group & rhs); + PG_Object_Group & operator = (const PG_Object_Group & rhs); + + + ///////////////// + // Static Methods + public: + /** + * Set the poa to be used to manage object groups + * Note: this is NOT the poa used to create object group members. + * @param poa a reference to a var to avoid reference count confusion. + */ + void set_poa (PortableServer::POA_var & poa); + + /////////////// + // Static Data + private: + /** + * The POA used to manage object groups + */ + static PortableServer::POA_var poa_; + + + /////////////// + // Data Members + private: + + /** + * Protect internal state. + * Implementation methods should assume the mutex is + * locked if necessary. + */ + ACE_SYNCH_MUTEX internals_; + typedef ACE_Guard<ACE_SYNCH_MUTEX> InternalGuard; + + ACE_CString role_; + PortableGroup::TypeId type_id_; + PortableGroup::ObjectGroupId group_id_; + /** + * the reference (IOGR) to this group + */ + PortableGroup::ObjectGroup_var reference_; + + /** + * The CORBA object id assigned to this object group + */ + PortableServer::ObjectId_var object_id_; + + // group members + MemberMap members_; + + PortableGroup::Location primary_location_; + + // Cached property information + + PortableGroup::MembershipStyleValue membership_style_; + PortableGroup::InitialNumberReplicasValue initial_number_replicas_; + PortableGroup::MinimumNumberReplicasValue minimum_number_replicas_; + PortableGroup::FactoryInfos group_specific_factories_; + + // Miscellaneous properties passed to create_object when this group + // was initially created. To be used to create new replicas. + PortableGroup::Properties properties_; + + }; +} // namespace TAO + +#include /**/ <ace/post.h> + +#endif // TAO_PG_OBJECT_GROUP_H_ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.cpp new file mode 100644 index 00000000000..e1257bdef8c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.cpp @@ -0,0 +1,116 @@ +// -*- C++ -*- +// +//============================================================================= +/** + * @file PG_Object_Group_Map.cpp + * + * $Id$ + * + * Container for TAO::PG_Object_Groups indexed by ObjectGroupId + * Note this was developed as part of FT CORBA + * @@ For now its but one of several parallel containers for object group information + * @@ TODO: Combine these parallel containers into a single one that consolidates everything + * @@ known about object groups. + * @author Dale Wilson <wilson_d@ociweb.com> + */ +//============================================================================= + +#include "PG_Object_Group_Map.h" +#include "PG_Object_Group.h" +#include <orbsvcs/orbsvcs/PortableGroup/PG_Utils.h> + +TAO::PG_Object_Group_Map::PG_Object_Group_Map () +{ +} + +TAO::PG_Object_Group_Map::~PG_Object_Group_Map () +{ + // todo: destroy all members +} + +////////////////////////////////////////////////////// +// PG_Object_Group_Map public methods + + + // insert group. Take ownership +int TAO::PG_Object_Group_Map::insert_group ( ::TAO::PG_Object_Group * group) +{ + return insert_group (group->get_object_group_id(), group); +} + +int TAO::PG_Object_Group_Map::insert_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group * group) +{ + return (this->bind (group_id, group) == 0); +} + +int TAO::PG_Object_Group_Map::find_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group *& group) const +{ + return (this->find (group_id , group) == 0); +} + +int TAO::PG_Object_Group_Map::find_group (PortableGroup::ObjectGroup_ptr object_group, ::TAO::PG_Object_Group *& group) const +{ + PortableGroup::TagGroupTaggedComponent tc; + TAO::PG_Utils::get_tagged_component (object_group, tc); + return find_group (tc.object_group_id, group); +} + +int TAO::PG_Object_Group_Map::destroy_group (PortableGroup::ObjectGroupId group_id) +{ + ::TAO::PG_Object_Group * group; + int result = (this->unbind (group_id, group) == 0); + if (result) + { + delete group; + } + return result; +} + +int TAO::PG_Object_Group_Map::destroy_group (PortableGroup::ObjectGroup_ptr object_group) +{ + PortableGroup::TagGroupTaggedComponent tc; + TAO::PG_Utils::get_tagged_component (object_group, tc); + return destroy_group (tc.object_group_id); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + + template class ACE_Hash_Map_Manager_Ex< + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_Synch_Mutex>; + + template class ACE_Hash_Map_Entry < + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *>; + + template class ACE_Hash_Map_Iterator_Ex < + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_Synch_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate ACE_Hash_Map_Manager_Ex< + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_Synch_Mutex>; + +# pragma instantiate ACE_Hash_Map_Entry < + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *>; + +# pragma instantiate ACE_Hash_Map_Iterator_Ex < + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_Synch_Mutex>; + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.h new file mode 100644 index 00000000000..2f31162a228 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Map.h @@ -0,0 +1,110 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file PG_Object_Group_Map.h + * + * $Id$ + * + * Container for TAO::PG_Object_Groups indexed by ObjectGroupId + * Note this was developed as part of FT CORBA + * @@ For now its but one of several parallel containers for object group information + * @@ TODO: Combine these parallel containers into a single one that consolidates everything + * @@ known about object groups. + * @author Dale Wilson <wilson_d@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_PG_OBJECT_GROUP_MAP_H +#define TAO_PG_OBJECT_GROUP_MAP_H + +#include /**/ "ace/pre.h" +#include "orbsvcs/PortableGroupS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//////////////////////////////////////////////////// +// Forward reference to class(es) defined in this header +namespace TAO +{ + class PG_Object_Group_Map; +} // namespace TAO + +//#include "PG_Object_Group.h" +namespace TAO +{ + class PG_Object_Group; +} // namespace TAO + +namespace TAO +{ + /** + * class TAO::PG_Object_Group_Map + * A container of Object_Groups indexed by ObjectGroupId + */ + class TAO_PortableGroup_Export PG_Object_Group_Map + : public ACE_Hash_Map_Manager_Ex< + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_SYNCH_MUTEX> + { + public: + typedef ACE_Hash_Map_Entry <PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *> Entry; + typedef ACE_Hash_Map_Iterator_Ex < + PortableGroup::ObjectGroupId, + ::TAO::PG_Object_Group *, + ACE_Hash<ACE_UINT64>, + ACE_Equal_To<ACE_UINT64>, + TAO_SYNCH_MUTEX> Iterator; + + /// Constructor. + PG_Object_Group_Map (); + + /// Destructor. + virtual ~PG_Object_Group_Map (); + + /// insert existing group. Take ownership + /// note: uses group id extracted from group object + /// @return bool true if insertion successful + int insert_group ( ::TAO::PG_Object_Group * group); + + /// insert group. Take ownership + /// @return bool true if insertion successful + int insert_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group * group); + + /// find group + /// @return bool true if found + int find_group (PortableGroup::ObjectGroupId group_id, ::TAO::PG_Object_Group *& group) const; + + /// find group + /// note: uses group id extracted from object_group + /// @return bool true if found + int find_group (PortableGroup::ObjectGroup_ptr object_group, ::TAO::PG_Object_Group *& group) const; + + /// remove group from map and delete it. + /// @return bool true if found + int destroy_group (PortableGroup::ObjectGroupId object_group_id); + + /// remove group from map and delete it. + /// note: uses group id extracted from object_group + /// @return bool true if found + int destroy_group (PortableGroup::ObjectGroup_ptr object_group); + + //////////////////////////// + // Implementation methods + private: + + /////// + // Data + private: + }; +} // namespace TAO + +#include /**/ "ace/post.h" + +#endif /* TAO_PG_OBJECT_GROUP_MAP_H */ diff --git a/TAO/orbsvcs/tests/FT_App/FT_Client.cpp b/TAO/orbsvcs/tests/FT_App/FT_Client.cpp index c3a32c771eb..c2ccd5a4470 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_Client.cpp +++ b/TAO/orbsvcs/tests/FT_App/FT_Client.cpp @@ -153,7 +153,7 @@ FTClientMain::parse_args (int argc, char *argv[]) // note: dfnkx are simple_util options // include them here so we can detect bad args - ACE_Get_Opt get_opts (argc, argv, "c:df:g:nk:x"); + ACE_Get_Opt get_opts (argc, argv, "c:f:"); int c; while (result == 0 && (c = get_opts ()) != -1) @@ -182,20 +182,7 @@ FTClientMain::parse_args (int argc, char *argv[]) break; } - case 'd': - case 'k': - case 'n': - case 'x': - // ignore args used by other command line parsers - // poor design, but its ubiquitous - break; - default: - std::cerr << "FT Client: Unknown argument -" << (char) c << std::endl; - usage(std::cerr); - result = 1; - break; - case '?': usage(std::cerr); result = 1; @@ -208,9 +195,7 @@ void FTClientMain::usage(ostream & out)const { out << "usage" << " -c <command file>" - << " -f <ior file list>" - << " -d (debug)" - << " -k (ior)" + << " [-f <ior file>]..." << std::endl; } diff --git a/TAO/orbsvcs/tests/FT_App/FT_TestReplica.idl b/TAO/orbsvcs/tests/FT_App/FT_TestReplica.idl index 72f7bdde80c..ba1e71e62df 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_TestReplica.idl +++ b/TAO/orbsvcs/tests/FT_App/FT_TestReplica.idl @@ -25,7 +25,7 @@ module FT_TEST * It declares a simple counter that can be set, incremented, and read * via method calls. The counter is also exposed as a property. */ - interface TestReplica : ::FT::Updateable, ::FT::PullMonitorable + interface TestReplica : ::FT::Updateable, ::FT::PullMonitorable, ::PortableGroup::TAO_UpdateObjectGroup { /** * set the counter to an specific value. diff --git a/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.cpp b/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.cpp index 74bbe47d5d6..c9b462892c4 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.cpp +++ b/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.cpp @@ -288,6 +288,13 @@ void FT_TestReplica_i::set_state (const FT::State & s) #endif // FT_TEST_LACKS_STATE } +void FT_TestReplica_i::tao_update_object_group ( PortableGroup::ObjectGroup_ptr iogr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT()); +} + ////////////////////////////// // implement FT_TEST::Replica diff --git a/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.h b/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.h index e001e82e393..1efbbf511c1 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.h +++ b/TAO/orbsvcs/tests/FT_App/FT_TestReplica_i.h @@ -138,6 +138,13 @@ private: virtual void set_state (const FT::State & s) ACE_THROW_SPEC ((CORBA::SystemException, FT::InvalidState)); + //////////////// + // Implement TAO_UpdateObjectGroup + + virtual void tao_update_object_group ( PortableGroup::ObjectGroup_ptr iogr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + ///////////////// // implementation private: diff --git a/TAO/orbsvcs/tests/FT_App/run_test_basic.pl b/TAO/orbsvcs/tests/FT_App/run_test_basic.pl index 6fee05ba2aa..afdbefdcb69 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_basic.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_basic.pl @@ -24,12 +24,12 @@ unlink $replica2_ior; unlink $data_file; my($status) = 0; -my($SV1) = new PerlACE::Process ("release/ft_replica", "-o $factory1_ior -t $replica1_ior -q"); -my($SV2) = new PerlACE::Process ("release/ft_replica", "-o $factory2_ior -t $replica2_ior -q"); +my($SV1) = new PerlACE::Process ("release/ft_replica", "-o $factory1_ior -t $replica1_ior -q -ORBInitRef ReplicationManager=NULL"); +my($SV2) = new PerlACE::Process ("release/ft_replica", "-o $factory2_ior -t $replica2_ior -q -ORBInitRef ReplicationManager=NULL"); my($CL) = new PerlACE::Process ("release/ft_client", "-f file://$replica1_ior -f file://$replica2_ior -c testscript"); #my($CL) = new PerlACE::Process ("release/ft_client", "-f file://$replica1_iogr -c testscript"); -print "\nTest: Starting replica 1" . $SV1->CommandLine . "\n" if ($debug); +print "\nTest: Starting replica 1 " . $SV1->CommandLine . "\n" if ($debug); $SV1->Spawn (); print "waiting for replica 1's IOR\n" if ($debug); @@ -40,7 +40,7 @@ if (PerlACE::waitforfile_timed ($replica1_ior, 5) == -1) { exit 1; } -print "\nTest: Starting replica 2" . $SV2->CommandLine . "\n" if ($debug); +print "\nTest: Starting replica 2 " . $SV2->CommandLine . "\n" if ($debug); $SV2->Spawn (); print "waiting for replica 2's IOR\n" if ($debug); @@ -71,6 +71,7 @@ if ($server != 0) { $status = 1; } +if ($status == 0) { print "Clean up scratch files\n" if ($debug); unlink $factory1_ior; @@ -78,5 +79,6 @@ unlink $factory2_ior; unlink $replica1_ior; unlink $replica2_ior; unlink $data_file; +} exit $status; diff --git a/TAO/utils/catior/catior.cpp b/TAO/utils/catior/catior.cpp index b90d50ea3f6..b3c913702be 100644 --- a/TAO/utils/catior/catior.cpp +++ b/TAO/utils/catior/catior.cpp @@ -616,6 +616,37 @@ cat_tao_tag_endpoints (TAO_InputCDR& stream) { return 1; } +static CORBA::Boolean +cat_tag_group (TAO_InputCDR& stream) { +/* +ID is 27 +Component Value len: 36 +Component Value as hex: +01 01 00 cd 0f 00 00 00 64 65 66 61 75 6c 74 2d +64 6f 6d 61 69 6e 00 cd 01 00 00 00 00 00 00 00 +02 00 00 00 +The Component Value as string: + ...-....default-domain.-............ +*/ + +#if 1 + cat_octet_seq ("TAG_GROUP", stream); +#else + CORBA::Octet version_major; + if (stream.read_octet(version_major) == 0) + { + return 1; + } + + CORBA::Octet version_minor; + if (stream.read_octet(version_minor) == 0) + { + return 1; + } + +#endif + return 1; +} static CORBA::Boolean cat_tag_policies (TAO_InputCDR& stream) { @@ -958,6 +989,16 @@ cat_tagged_components (TAO_InputCDR& stream) ACE_DEBUG ((LM_DEBUG, "%{%{")); cat_tag_policies(stream); ACE_DEBUG ((LM_DEBUG, "%}%}")); + } else if (tag == IOP::TAG_FT_GROUP) { //@@ PortableGroup will rename this TAG_GROUP + ACE_DEBUG ((LM_DEBUG,"%d (TAG_GROUP)\n", tag)); + ACE_DEBUG ((LM_DEBUG, "%{%{")); + cat_tag_group (stream); + ACE_DEBUG ((LM_DEBUG, "%}%}")); + } else if (tag == IOP::TAG_FT_PRIMARY) { //@@ PortableGroup will rename this TAG_PRIMARY + ACE_DEBUG ((LM_DEBUG,"%d (TAG_PRIMARY)\n", tag)); + ACE_DEBUG ((LM_DEBUG, "%{%{")); + cat_octet_seq ("TAG_PRIMARY", stream); + ACE_DEBUG ((LM_DEBUG, "%}%}")); } else { ACE_DEBUG ((LM_DEBUG,"%d\n", tag)); ACE_DEBUG ((LM_DEBUG, "%{%{")); |