diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-03 18:59:35 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-03 18:59:35 +0000 |
commit | d70393c1712389a9e8adc8039418776bd7f903bd (patch) | |
tree | 28e566eb6e346187481233d7ed768f6050682b14 | |
parent | 79c79d587fd94b81ee71d40b762dc3a7cc0d6d2a (diff) | |
download | ATCD-d70393c1712389a9e8adc8039418776bd7f903bd.tar.gz |
ChangeLogTag: Wed Dec 3 12:57:45 2003 Dale Wilson <wilson_d@ociweb.com>
10 files changed, 295 insertions, 71 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 7f3c24568cb..dabbf38bcc1 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Wed Dec 3 12:57:45 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc: + build FT_ReplicationManager after FT_ReplicationManager_Lib + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h: + * orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp: + Improved documentation. + Change parameter to Properties_Encoder::from var & to pointer. + Wed Dec 3 09:18:34 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/tests/FT_App/FT_ReplicaFactory_i.h: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index e0150deb73c..5431b7d35c4 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -87,10 +87,7 @@ TAO::FT_ReplicationManager::~FT_ReplicationManager (void) // cleanup happens in fini } - -////////////////////////////////////////////////////// -// FT_ReplicationManager public, non-CORBA methods - +//public int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) { ACE_Get_Opt get_opts (argc, argv, "n:o:f:"); @@ -130,11 +127,13 @@ int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[]) return 0; } +//public const char * TAO::FT_ReplicationManager::identity () const { return this->identity_.c_str (); } +//public int TAO::FT_ReplicationManager::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) { int result = 0; @@ -304,6 +303,7 @@ int TAO::FT_ReplicationManager::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) return result; } +//public int TAO::FT_ReplicationManager::idle (int & result) { ACE_UNUSED_ARG (result); @@ -311,6 +311,7 @@ int TAO::FT_ReplicationManager::idle (int & result) } +//public int TAO::FT_ReplicationManager::fini (ACE_ENV_SINGLE_ARG_DECL) { int result = 0; @@ -333,35 +334,7 @@ int TAO::FT_ReplicationManager::fini (ACE_ENV_SINGLE_ARG_DECL) return result; } -//////////////////////////////////////////// -// FT_ReplicationManager private methods - -int TAO::FT_ReplicationManager::write_ior () -{ - int result = -1; - FILE* out = ACE_OS::fopen (this->ior_output_file_, "w"); - if (out) - { - CORBA::String_var ior_str = this->orb_->object_to_string ( - this->replication_manager_ref_.in ()); - ACE_OS::fprintf (out, "%s", ior_str.in ()); - ACE_OS::fclose (out); - result = 0; - } - else - { - ACE_ERROR ( (LM_ERROR, - ACE_TEXT ("%T %n (%P|%t) - Open failed for %s\n"), this->ior_output_file_ - )); - } - return result; -} - - -////////////////////////////////////////////////////// -// FT::ReplicationManager methods - -/// Registers the Fault Notifier with the Replication Manager. +//CORBA void TAO::FT_ReplicationManager::register_fault_notifier ( FT::FaultNotifier_ptr fault_notifier @@ -371,6 +344,7 @@ TAO::FT_ReplicationManager::register_fault_notifier ( this->register_fault_notifier_i (fault_notifier ACE_ENV_ARG_PARAMETER); } +//private void TAO::FT_ReplicationManager::register_fault_notifier_i ( FT::FaultNotifier_ptr fault_notifier @@ -459,7 +433,8 @@ TAO::FT_ReplicationManager::register_fault_notifier_i ( } -/// Returns the reference of the Fault Notifier. +// Returns the reference of the Fault Notifier. +//CORBA FT::FaultNotifier_ptr TAO::FT_ReplicationManager::get_fault_notifier ( ACE_ENV_SINGLE_ARG_DECL) @@ -473,7 +448,8 @@ TAO::FT_ReplicationManager::get_fault_notifier ( } -/// TAO-specific find factory registry +// TAO-specific find factory registry +//CORBA ::PortableGroup::FactoryRegistry_ptr TAO::FT_ReplicationManager::get_factory_registry ( const PortableGroup::Criteria & selection_criteria @@ -484,7 +460,8 @@ TAO::FT_ReplicationManager::get_factory_registry ( return this->factory_registry_.reference (); } -/// TAO-specific shutdown operation. +// TAO-specific shutdown operation. +//public void TAO::FT_ReplicationManager::shutdown ( ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException)) @@ -493,6 +470,7 @@ void TAO::FT_ReplicationManager::shutdown ( } // Get the type_id associated with an object group. +//CORBA char * TAO::FT_ReplicationManager::type_id ( PortableGroup::ObjectGroup_ptr object_group ACE_ENV_ARG_DECL) @@ -514,6 +492,7 @@ char * TAO::FT_ReplicationManager::type_id ( ////////////////////////////////////////////////////// // PortableGroup::PropertyManager methods +//CORBA void TAO::FT_ReplicationManager::set_default_properties ( const PortableGroup::Properties & props @@ -527,6 +506,7 @@ TAO::FT_ReplicationManager::set_default_properties ( //@@ validate properties? } +//CORBA PortableGroup::Properties * TAO::FT_ReplicationManager::get_default_properties ( ACE_ENV_SINGLE_ARG_DECL) @@ -536,6 +516,7 @@ TAO::FT_ReplicationManager::get_default_properties ( ACE_ENV_SINGLE_ARG_PARAMETER); } +//CORBA void TAO::FT_ReplicationManager::remove_default_properties ( const PortableGroup::Properties & props @@ -548,6 +529,7 @@ TAO::FT_ReplicationManager::remove_default_properties ( ACE_ENV_ARG_PARAMETER); } +//CORBA void TAO::FT_ReplicationManager::set_type_properties ( const char *type_id, @@ -563,6 +545,7 @@ TAO::FT_ReplicationManager::set_type_properties ( ACE_ENV_ARG_PARAMETER); } +//CORBA PortableGroup::Properties * TAO::FT_ReplicationManager::get_type_properties ( const char *type_id @@ -573,6 +556,7 @@ TAO::FT_ReplicationManager::get_type_properties ( ACE_ENV_ARG_PARAMETER); } +//CORBA void TAO::FT_ReplicationManager::remove_type_properties ( const char *type_id, @@ -588,6 +572,7 @@ TAO::FT_ReplicationManager::remove_type_properties ( ACE_ENV_ARG_PARAMETER); } +//CORBA void TAO::FT_ReplicationManager::set_properties_dynamically ( PortableGroup::ObjectGroup_ptr object_group, @@ -611,6 +596,7 @@ TAO::FT_ReplicationManager::set_properties_dynamically ( } } +//CORBA PortableGroup::Properties * TAO::FT_ReplicationManager::get_properties ( PortableGroup::ObjectGroup_ptr object_group @@ -639,6 +625,7 @@ TAO::FT_ReplicationManager::get_properties ( // FT::FTObjectGroupManager methods /// Sets the primary member of a group. +//CORBA PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::set_primary_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -679,6 +666,7 @@ TAO::FT_ReplicationManager::set_primary_member ( METHOD_RETURN (TAO::FT_ReplicationManager::set_primary_member) result._retn (); } +//CORBA PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::create_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -716,6 +704,7 @@ TAO::FT_ReplicationManager::create_member ( } +//CORBA PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::add_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -756,6 +745,7 @@ TAO::FT_ReplicationManager::add_member ( METHOD_RETURN (TAO::FT_ReplicationManager::add_member) result._retn (); } +//CORBA PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::remove_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -789,6 +779,7 @@ TAO::FT_ReplicationManager::remove_member ( return result._retn (); } +//CORBA PortableGroup::Locations * TAO::FT_ReplicationManager::locations_of_members ( PortableGroup::ObjectGroup_ptr object_group @@ -819,6 +810,7 @@ TAO::FT_ReplicationManager::locations_of_members ( return result; } +//CORBA PortableGroup::ObjectGroups * TAO::FT_ReplicationManager::groups_at_location ( const PortableGroup::Location & the_location @@ -828,6 +820,7 @@ TAO::FT_ReplicationManager::groups_at_location ( return this->group_factory_.groups_at_location (the_location ACE_ENV_ARG_PARAMETER); } +//CORBA PortableGroup::ObjectGroupId TAO::FT_ReplicationManager::get_object_group_id ( PortableGroup::ObjectGroup_ptr object_group @@ -856,6 +849,7 @@ TAO::FT_ReplicationManager::get_object_group_id ( return result; } +//CORBA PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::get_object_group_ref ( PortableGroup::ObjectGroup_ptr object_group @@ -884,6 +878,7 @@ TAO::FT_ReplicationManager::get_object_group_ref ( return result._retn(); } +//CORBA, TAO specific PortableGroup::ObjectGroup_ptr TAO::FT_ReplicationManager::get_object_group_ref_from_id ( PortableGroup::ObjectGroupId group_id @@ -914,6 +909,7 @@ TAO::FT_ReplicationManager::get_object_group_ref_from_id ( return result._retn(); } +//CORBA CORBA::Object_ptr TAO::FT_ReplicationManager::get_member_ref ( PortableGroup::ObjectGroup_ptr object_group, @@ -949,6 +945,7 @@ TAO::FT_ReplicationManager::get_member_ref ( ////////////////////////////////////////////////////// // PortableGroup::GenericFactory methods +//CORBA CORBA::Object_ptr TAO::FT_ReplicationManager::create_object ( const char * type_id, @@ -1004,6 +1001,7 @@ TAO::FT_ReplicationManager::create_object ( METHOD_RETURN (TAO::FT_ReplicationManager::create_object) group->reference (); } +//CORBA void TAO::FT_ReplicationManager::delete_object ( const PortableGroup::GenericFactory::FactoryCreationId & factory_creation_id @@ -1025,3 +1023,26 @@ TAO::FT_ReplicationManager::delete_object ( ACE_THROW (PortableGroup::ObjectNotFound ()); } } + +//private +int TAO::FT_ReplicationManager::write_ior () +{ + int result = -1; + FILE* out = ACE_OS::fopen (this->ior_output_file_, "w"); + if (out) + { + CORBA::String_var ior_str = this->orb_->object_to_string ( + this->replication_manager_ref_.in ()); + ACE_OS::fprintf (out, "%s", ior_str.in ()); + ACE_OS::fclose (out); + result = 0; + } + else + { + ACE_ERROR ( (LM_ERROR, + ACE_TEXT ("%T %n (%P|%t) - Open failed for %s\n"), this->ior_output_file_ + )); + } + return result; +} + diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h index 00f6d0079b5..5989510fa7e 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h @@ -40,6 +40,39 @@ namespace TAO /** * Implement the ReplicationManager interfaces. * + * The ReplicationManager does most of its work by delegating to + * support objects. These include: + * + * TAO::PG_Group_Factory group_factory_; + * The group factory contains a collection of TAO::PG_Object_Groups + * It provides methods to create new groups, destroy old groups and + * find existing groups. + * + * TAO::PG_Object_Group + * These objects which can be found through the group factory provde + * methods to create and add group members, remove and delete group + * members and set group properties. + * + * TAO::PG_Properties_Support properties_support_; + * This object maintains sets of properties. In particular it has + * one default property set, and a collection of property sets indexed + * by type_id. The default property set acts as a parent to the type_id + * property sets and the type_id property sets act as parents to the + * property sets contained in PG_Object_Group. + * + * FT::FaultNotifier_var fault_notifier_; + * This notification channel is "the" source of fault notifications. + * + * TAO::FT_FaultConsumer fault_consumer_; + * This object subscribes to the fault_notifier_as a fault consumer. It + * analyzes incoming fault notifications and calls appropriate ReplicationManager + * methods to respond to the fault. + * + * TAO::PG_FactoryRegistry factory_registry_; + * This object maintains a collection of factory registrations. When a factory + * is started it registeres itself with the ReplicationManager (delegated to this + * object). When a member needs to be created in an object group this factory + * registry is queried to find factories that can create the member. */ class FT_ReplicationManager : public virtual POA_FT::ReplicationManager, @@ -51,13 +84,15 @@ namespace TAO public: /** - * Default constructor. - */ + * Default constructor. + * Call init after constructing the object to prepare it for use. + */ FT_ReplicationManager (); /** - * Destructor. - */ + * Destructor. + * Actual cleanup happens in the fini function. + */ virtual ~FT_ReplicationManager (); public: @@ -186,7 +221,7 @@ namespace TAO /** * Set properties associated with a given Replica type. These - * properties override the default properties. + * properties override the default properties on a name-by-name basis. */ virtual void set_type_properties ( const char * type_id, @@ -253,8 +288,7 @@ namespace TAO */ //@{ - /// Create a member using the ObjectGroupManager, and - /// add the created object to the ObjectGroup. + /// Create a member in an object group. virtual PortableGroup::ObjectGroup_ptr create_member ( PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location, @@ -281,11 +315,15 @@ namespace TAO PortableGroup::ObjectNotAdded)); /** - * Remove an object at a specific location from the given - * ObjectGroup. Deletion of application created objects must be + * Remove the member at a specific location from an + * ObjectGroup. Application created objects must be * deleted by the application. Objects created by the * infrastructure (replication manager) will be deleted by the * infrastructure. + * For infrastructure-controlled membership: After the member + * is removed from the group the minumum number of members + * parameter will be checked and new members will be created + * as necessary (if possible.) */ virtual PortableGroup::ObjectGroup_ptr remove_member ( PortableGroup::ObjectGroup_ptr object_group, @@ -315,25 +353,29 @@ namespace TAO ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound)); - /// ? + /** + * Return an update the IOGR for an object group. If no changes have + * been made in the group the return value will be the same as the object_group + * parameter. + */ virtual PortableGroup::ObjectGroup_ptr get_object_group_ref ( PortableGroup::ObjectGroup_ptr object_group ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound)); - /** - * TAO-specific extension. - * Return the ObjectGroup reference for the given ObjectGroupId. - */ - virtual PortableGroup::ObjectGroup_ptr get_object_group_ref_from_id ( - PortableGroup::ObjectGroupId group_id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , PortableGroup::ObjectGroupNotFound - )); + /** + * TAO-specific extension. + * Return the ObjectGroup reference for the given ObjectGroupId. + */ + virtual PortableGroup::ObjectGroup_ptr get_object_group_ref_from_id ( + PortableGroup::ObjectGroupId group_id + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , PortableGroup::ObjectGroupNotFound + )); /** * Return the reference corresponding to the Replica of a given @@ -375,6 +417,10 @@ namespace TAO * restrictions defined by the provided Criteria. The out * FactoryCreationId parameter may be passed to the delete_object() * method to delete the object. + * + * Infrastructure controlled membership: The initial number of members + * property will be honored by creating new members and adding them to + * the group. */ virtual CORBA::Object_ptr create_object ( const char * type_id, @@ -390,10 +436,10 @@ namespace TAO PortableGroup::CannotMeetCriteria)); /** - * Delete the object corresponding to the provided - * FactoryCreationId. If the object is actually an ObjectGroup, - * then all members within the ObjectGroup will be deleted. - * Afterward, the ObjectGroup itself will be deleted. + * Delete the object group corresponding to the provided + * FactoryCreationId. For infratructure-controlled membership + * all members will be deleted. For application-controlled membership + * the application is responsible for deleting group members. */ virtual void delete_object ( const PortableGroup::GenericFactory::FactoryCreationId & @@ -450,9 +496,10 @@ namespace TAO /// A human-readable string to identify this Replication Manager. ACE_CString identity_; + /// an object that manages a collection of object groups TAO::PG_Group_Factory group_factory_; - + /// an object that manages default and type_id related properties TAO::PG_Properties_Support properties_support_; /// The fault notifier. diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc index dedb0ecab50..c49e50d2b92 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.mpc @@ -14,6 +14,7 @@ project(*Lib): orbsvcslib, core, notification, fault_tolerance, ftorb, portableg project : taoserver, orbsvcsexe, fault_tolerance, iormanip, ftorb { exename = FT_ReplicationManager libs += TAO_ReplicationManagerLib + after += FT_ReplicationManager_Lib Source_Files { FT_ReplicationManager.cpp FT_ReplicationManager_Main.cpp diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp index 3701d10aff6..fc904d9cffe 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp @@ -11,6 +11,8 @@ * Note: this started as a simple helper class to make decoding sets of properties * easier, but expanded to provide more general support for managing sets of properties. * + * A more appropriate name would be PG_Properties_Set. Maybe this can be changed someday. + * * @author Dale Wilson <wilson_d@ociweb.com> */ //============================================================================= diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h index e35a0050f8f..585ff516a86 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h @@ -11,6 +11,8 @@ * Note: this started as a simple helper class to make decoding sets of properties * easier, but expanded to provide more general support for managing sets of properties. * + * A more appropriate name would be PG_Properties_Set. Maybe this can be changed someday. + * * @author Dale Wilson <wilson_d@ociweb.com> */ //============================================================================= @@ -32,7 +34,12 @@ namespace TAO_PG * * It supports "chains" of property sets to implement default value semantics. * If a requested property is not found in this set, the default set(s) are searched. - * Thus any property found at this level overrides the defaults. + * Thus, any property found at this level overrides the defaults. + * + * See: PG_Properties_Support for more details on use of this object. + * + * A Properties_Decoder may also be used for it's original purpose as a stand-alone + * helper class for extracting values from PortableGroup::Properties. */ class TAO_PortableGroup_Export Properties_Decoder diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.cpp index d9ac6f060f2..73a4497f2d6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.cpp @@ -34,28 +34,28 @@ void TAO_PG::Properties_Encoder::add ( } void TAO_PG::Properties_Encoder::encode ( - PortableGroup::Properties_var & property_set) const + PortableGroup::Properties * property_set) const { + ACE_ASSERT (property_set != 0); size_t count = values_.size(); property_set->length(count); for( size_t nItem = 0; nItem < count; ++nItem ) { const NamedValue & nv = values_[nItem]; - PortableGroup::Property & property = property_set[nItem]; + PortableGroup::Property & property = (*property_set)[nItem]; PortableGroup::Name & nsName = property.nam; PortableGroup::Value & anyValue = property.val; // assign the value anyValue = (nv.second()); // assign the name - // TODO: This restricts the name to a single level with no "kind" - // TODO: remove this restriction (?) + // @@: This restricts the name to a single level with no "kind" + // @@: remove this restriction (?) nsName.length(1); CosNaming::NameComponent & nc = nsName[0]; nc.id = CORBA::string_dup (nv.first().c_str()); // nc.kind defaults to empty. Leave it that way (for now) - } } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.h index 431d0fc25f5..ab5a4e56242 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Encoder.h @@ -21,18 +21,40 @@ namespace TAO_PG { + /** + * A helper to assemble a set of properties into a PortableGroup::Properties structure. + * + * To use a Properties_Encoder: + * Create it. + * Add properties to it using the add method. + * Allocate a new PortableGroup::Properties. + * Use the encode method to transfer the properties into the + * PortableGroup::Properties. + */ class TAO_PortableGroup_Export Properties_Encoder { typedef ACE_Pair< ACE_CString, PortableGroup::Value> NamedValue; typedef ACE_Vector< NamedValue, 10 > NamedValueVec; public: + /** + * Construct an empty set of properties. + */ Properties_Encoder (); + + /// standard destructor ~Properties_Encoder (); + /** + * add a name/value property to the Properties_Encoder. + */ void add (const char * name, const PortableGroup::Value & value); - void encode (PortableGroup::Properties_var & property_set) const; + /** + * Encode all properties in this Properties_Encoder into a PortableGroup::Properties. + * + */ + void encode (PortableGroup::Properties * property_set) const; private: Properties_Encoder (const Properties_Encoder & rhs); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h index 2c8e9e8c7f9..bf18b3e0839 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h @@ -6,6 +6,10 @@ * $Id$ * * This file declares classes to help manage the PortableGroup::Properties + * It serves roughly the same purpose as PG_PropertiesManager, but takes a + * different approach that suits the needs of FT CORBA. + * It would be possible to replace PG_PropertiesManager, or implement it in + * terms of PG_Properties_Support at some time in the future. * * @author Dale Wilson <wilson_d@ociweb.com> */ @@ -17,6 +21,30 @@ namespace TAO { + /** + * This Properties Support object manages Property Sets (that go by the name + * of PG_Properties_Decoder for historical reasons.) One set, default_properties_, + * acts as a "global" default set of properties. + * + * The collection, properties_map_, contains a set of properties for each + * PortableGroup::type_id. The default set acts as a "parent" for each of + * these type_id sets. + * + * Expected use: When an object group is created that implements the interface + * identified by type_id, the corresponding typed_id propery set acts as a + * parent to the Property set contained in the PG_Object_Group. + * + * This heirarchy of property sets provides the correct property behavior. A + * request for a propery to an ObjectGroup will be satisfied from: + * by the object group group property set, or + * the typed_id property set, or + * the default property set, or + * the request will fail.. + * + * Note that changes to type_id or default properties will be visible + * immediately at the ObjectGroup level. + */ + class TAO_PortableGroup_Export PG_Properties_Support { typedef ACE_Hash_Map_Manager< @@ -32,18 +60,56 @@ namespace TAO PG_Properties_Support (); ~PG_Properties_Support (); + /** + * Update the default property set. + * + * Properties that appear in props are replaced in or added to the default + * property set. Properties that do not appear in props are unchanged. + * + * @param props the set of properties to update the defaults. + */ void set_default_properties (const PortableGroup::Properties & props); + /** + * Export the default properties in PortableGroup::Properties format. + * + * This produces the properties in a format suitable for use across + * a CORBA interface. + * The caller owns the resulting Properties and must release it to avoid + * resource leaks. + * @returns a newly allocated PortableGroup::Properties. + */ PortableGroup::Properties * get_default_properties (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)); + /** + * Undefine default properties that appear in props. + * + * Properties that are defined in props are removed from the default + * property set. Removal is done by name. The property values do not + * have to match. There is no penalty for attempting to remove a property + * that does not exist. + * @param props a set of propertys to be removed by name. + */ void remove_default_properties ( const PortableGroup::Properties & props ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); + /** + * Override or define properties associated with a type_id. + * + * If a property set does not exist for type_id, a new one will be created. + * Any property included in overrides will be set or replaced in the type_id + * property set. Any property not in overrides will be unchanged. + * + * Contrary to the "throws" specification, this method does not attempt + * to validate the properties because doing so would unnecessarily constrain + * the uses to which this class could be put (although one could strategize the + * validation.) + */ void set_type_properties ( const char *type_id, const PortableGroup::Properties & overrides @@ -53,16 +119,55 @@ namespace TAO PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)); + /** + * Export the property set in a PortableGroup::Properties format. + * + * This produces the properties associated with a type_id -- including + * any default properties that have not been overridden at the type_id level + * in a format suitable for use across a CORBA interface. + * + * The caller owns the resulting Properties and must release it to avoid + * resource leaks. + * + * Compare this method to find_typeid_properties which returns a pointer + * to the internal representation of the properties in TAO_PG::Properties_Decoder + * format. This is more efficient, but suitable only for internal use. + * + * @param type_id identifies the set of properties to be exported. + * @returns a newly allocated PortableGroup::Properties that must be released by the caller. + */ PortableGroup::Properties * get_type_properties ( const char *type_id ACE_ENV_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException)); + /** + * Export the property set in a PortableGroup::Properties format. + * + * This method is intended to provide a parent + * for the property set in a newly-created Object Group of the given + * type_id. + * + * Callers who intend to send the property set across a CORBA interface + * should use the get_type_properties method. + * + * @param type_id identifies the set of properties to be found. + * @returns a pointer to a Properties_Decoder owned by this Properties_Support object. + */ TAO_PG::Properties_Decoder * TAO::PG_Properties_Support::find_typeid_properties ( const char *type_id ACE_ENV_ARG_PARAMETER) ACE_THROW_SPEC ((CORBA::SystemException)); + /** + * Undefine default properties that appear in props. + * + * Properties that are defined in props are removed from the type_id + * property set. Removal is done by name. The property values do not + * have to match. There is no penalty for attempting to remove a property + * that does not exist. + * @param props a set of propertys to be removed by name from the type_id set. + */ void remove_type_properties ( const char *type_id, const PortableGroup::Properties & props @@ -78,7 +183,10 @@ namespace TAO TAO_SYNCH_MUTEX internals_; typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; + /// The default property set. TAO_PG::Properties_Decoder default_properties_; + + /// A collection of property sets indexed by type_id. Properties_Map properties_map_; }; } //namespace TAO_PG diff --git a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp index cc0872f871e..e8a4cf3c9a3 100755 --- a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp +++ b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp @@ -277,7 +277,7 @@ int ReplicationManagerFaultConsumerAdapter::init ( TAO_PG::Properties_Encoder encoder; PortableGroup::Value value; - value <<= notifier_in (); + value <<= notifier_.in (); encoder.add(::FT::FT_NOTIFIER, value); value <<= replica.in (); |