diff options
author | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-28 17:39:28 +0000 |
---|---|---|
committer | wilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-28 17:39:28 +0000 |
commit | ceb2d2821895344a81faedd2a094b8f92866c681 (patch) | |
tree | b2b596e87f5bd98d8943b98279cbde23b3c510a5 | |
parent | 657b49518e642d1ea97033df067e360f92ef2d95 (diff) | |
download | ATCD-ceb2d2821895344a81faedd2a094b8f92866c681.tar.gz |
ChangeLogTag: Fri Nov 28 11:36:06 2003 Dale Wilson <wilson_d@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 31 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp | 102 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h | 7 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp | 29 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp | 167 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h | 86 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.cpp | 40 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h | 30 | ||||
-rwxr-xr-x[-rw-r--r--] | TAO/orbsvcs/tests/FT_App/run_test_demo.pl (renamed from TAO/orbsvcs/tests/FT_App/demo.pl) | 0 |
12 files changed, 368 insertions, 151 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 93e63250f04..f56b0bef5f0 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,32 @@ +Fri Nov 28 11:36:06 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/tests/FT_App/demo.pl: + Rename this to be.... + * orbsvcs/tests/FT_App/run_test_demo.pl: + ...new name. It's still a "full" test. + + * orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.cpp: + Rename these to be PG_Properties_Support.* + + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp: + Expand properties map into support for PropertiesManager interface. + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + Use new PG_Properties_Support class to manage properties. + + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp: + Add "internals_" mutex. + + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp: + Documentation change. + + + Fri Nov 28 08:33:56 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp: @@ -9,7 +38,7 @@ Wed Nov 26 19:20:54 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h: * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp: - Enhance Properties_Decoder to provide everything necessary + Enhance Properties_Decoder to provide functions to implement the PropertyManager interface. --the name is no longer ideal. diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index 704513567da..980460362a3 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -33,6 +33,9 @@ ACE_RCSID (FT_ReplicationManager, "$Id$") +#define SUPPORT_OLD_PROPERTY_MANAGER +//#define USE_OLD_PROPERTY_MANAGER + // Use this macro at the beginning of CORBA methods // to aid in debugging. #define METHOD_ENTRY(name) \ @@ -532,12 +535,13 @@ TAO::FT_ReplicationManager::set_default_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#ifdef SUPPORT_OLD_PROPERTY_MANAGER this->property_manager_.set_default_properties (props ACE_ENV_ARG_PARAMETER); ACE_CHECK; +#endif //SUPPORT_OLD_PROPERTY_MANAGER - // Alternative implementation - this->default_properties_.decode(props); + this->properties_support_.set_default_properties (props); //@@ validate properties? } @@ -546,17 +550,14 @@ TAO::FT_ReplicationManager::get_default_properties ( ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException)) { -#if 0 +#ifdef USE_OLD_PROPERTY_MANAGER return this->property_manager_.get_default_properties ( ACE_ENV_SINGLE_ARG_PARAMETER); -#else - PortableGroup::Properties_var result; - ACE_NEW_THROW_EX ( result, PortableGroup::Properties(), CORBA::NO_MEMORY()); - this->default_properties_.export_properties (*result ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableGroup::Properties::_nil()); - return result._retn (); -#endif +#else // USE_OLD_PROPERTY_MANAGER + return this->properties_support_.get_default_properties ( + ACE_ENV_SINGLE_ARG_PARAMETER); +#endif //USE _OLD_PROPERTY_MANAGER } void @@ -567,11 +568,13 @@ TAO::FT_ReplicationManager::remove_default_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#ifdef SUPPORT_OLD_PROPERTY_MANAGER this->property_manager_.remove_default_properties (props ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - this->default_properties_.remove (props ACE_ENV_ARG_PARAMETER); +#endif //SUPPORT_OLD_PROPERTY_MANAGER + this->properties_support_.remove_default_properties (props + ACE_ENV_ARG_PARAMETER); } void @@ -583,24 +586,16 @@ TAO::FT_ReplicationManager::set_type_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#ifdef SUPPORT_OLD_PROPERTY_MANAGER this->property_manager_.set_type_properties (type_id, overrides ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - - TAO_PG::Properties_Decoder * typeid_properties; - if ( 0 != this->typeid_properties_map_.find (type_id, typeid_properties)) - { - ACE_NEW_THROW_EX ( - typeid_properties, - TAO_PG::Properties_Decoder (overrides, & this->default_properties_), - CORBA::NO_MEMORY()); - this->typeid_properties_map_.bind (type_id, typeid_properties); - } - typeid_properties->clear (); - typeid_properties->decode (overrides ACE_ENV_ARG_PARAMETER); - ACE_CHECK; +#endif //SUPPORT_OLD_PROPERTY_MANAGER + this->properties_support_.set_type_properties ( + type_id, + overrides + ACE_ENV_ARG_PARAMETER); } PortableGroup::Properties * @@ -609,22 +604,15 @@ TAO::FT_ReplicationManager::get_type_properties ( ACE_ENV_ARG_DECL) ACE_THROW_SPEC ( (CORBA::SystemException)) { -#if 0 +#ifdef USE_OLD_PROPERTY_MANAGER return this->property_manager_.get_type_properties (type_id - ACE_ENV_ARG_PARAMETER); -#else - PortableGroup::Properties_var result; - ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ()); + ACE_ENV_ARG_PARAMETER); +#else // USE_OLD_PROPERTY_MANAGER + return this->properties_support_.get_type_properties (type_id + ACE_ENV_ARG_PARAMETER); - TAO_PG::Properties_Decoder * typeid_properties; - if ( 0 != this->typeid_properties_map_.find (type_id, typeid_properties)) - { - typeid_properties->export_properties (*result ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - return result._retn (); -#endif +#endif //USE_OLD_PROPERTY_MANAGER } void @@ -636,16 +624,15 @@ TAO::FT_ReplicationManager::remove_type_properties ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#ifdef SUPPORT_OLD_PROPERTY_MANAGER this->property_manager_.remove_type_properties (type_id, props ACE_ENV_ARG_PARAMETER); - - TAO_PG::Properties_Decoder * typeid_properties; - if ( 0 != this->typeid_properties_map_.find (type_id, typeid_properties)) - { - typeid_properties->remove (props ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } +#endif //SUPPORT_OLD_PROPERTY_MANAGER + this->properties_support_.remove_type_properties ( + type_id, + props + ACE_ENV_ARG_PARAMETER); } void @@ -658,9 +645,12 @@ TAO::FT_ReplicationManager::set_properties_dynamically ( PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)) { +#ifdef SUPPORT_OLD_PROPERTY_MANAGER this->property_manager_.set_properties_dynamically (object_group, overrides ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +#endif //SUPPORT_OLD_PROPERTY_MANAGER TAO::PG_Object_Group * group = 0; if (this->object_group_map_.find_group (object_group, group)) @@ -681,11 +671,11 @@ TAO::FT_ReplicationManager::get_properties ( ACE_THROW_SPEC ( (CORBA::SystemException, PortableGroup::ObjectGroupNotFound)) { -#if 0 +#ifdef USE_OLD_PROPERTY_MANAGER return this->property_manager_.get_properties (object_group ACE_ENV_ARG_PARAMETER); -#else +#else // USE_OLD_PROPERTY_MANAGER PortableGroup::Properties_var result; ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ()); @@ -700,7 +690,7 @@ TAO::FT_ReplicationManager::get_properties ( ACE_THROW (PortableGroup::ObjectGroupNotFound ()); } return result._retn(); -#endif +#endif // USE_OLD_PROPERTY_MANAGER } @@ -973,15 +963,11 @@ TAO::FT_ReplicationManager::create_object ( // entry in our object group map // first find the properties for this type of object group - TAO_PG::Properties_Decoder * typeid_properties; - if ( 0 != this->typeid_properties_map_.find (type_id, typeid_properties)) - { - ACE_NEW_THROW_EX ( - typeid_properties, - TAO_PG::Properties_Decoder (& this->default_properties_), - CORBA::NO_MEMORY()); - this->typeid_properties_map_.bind (type_id, typeid_properties); - } + TAO_PG::Properties_Decoder * typeid_properties + = this->properties_support_.find_typeid_properties ( + type_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); TAO::PG_Object_Group * objectGroup = TAO::PG_Object_Group::create ( diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h index 3b69261425e..17140753f35 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h @@ -31,7 +31,7 @@ // Note: the new, improved versions... #include <orbsvcs/PortableGroup/PG_Object_Group_Map.h> -#include <orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h> +#include <orbsvcs/PortableGroup/PG_Properties_Support.h> namespace TAO { @@ -471,10 +471,7 @@ namespace TAO /// A container for our object group information TAO::PG_Object_Group_Map object_group_map_; - TAO_PG::Properties_Decoder default_properties_; - - TAO::PG_Typeid_Properties_Map typeid_properties_map_; - + TAO::PG_Properties_Support properties_support_; /// The fault notifier. FT::FaultNotifier_var fault_notifier_; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp index 34405e45a09..6997a38d145 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -63,7 +63,7 @@ TAO::PG_Object_Group::PG_Object_Group ( CORBA::Object_ptr empty_group, const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, - PortableGroup::Criteria the_criteria, + const PortableGroup::Criteria & the_criteria, TAO_PG::Properties_Decoder * type_properties) : internals_() , orb_ (CORBA::ORB::_duplicate (orb)) @@ -87,7 +87,7 @@ TAO::PG_Object_Group * TAO::PG_Object_Group::create ( CORBA::ORB_ptr orb, CORBA::Object_ptr empty_group, // empty group as created by ObjectManager const char * type_id, - PortableGroup::Criteria the_criteria, + const PortableGroup::Criteria & the_criteria, TAO_PG::Properties_Decoder * type_properties ACE_ENV_ARG_DECL) { @@ -100,7 +100,7 @@ TAO::PG_Object_Group * TAO::PG_Object_Group::create ( ACE_CHECK_RETURN (0); iorm = TAO_IOP::TAO_IOR_Manipulation::_narrow ( iorm_obj.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + ACE_CHECK_RETURN (0); if (CORBA::is_nil (iorm.in ())) { if (TAO_debug_level > 3) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h index c4398017cd5..84d6cadf72b 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h @@ -114,7 +114,7 @@ namespace TAO CORBA::Object_ptr empty_group, const PortableGroup::TagGroupTaggedComponent & tag_component, const char * type_id, - PortableGroup::Criteria the_criteria, + const PortableGroup::Criteria & the_criteria, TAO_PG::Properties_Decoder * type_properties); public: @@ -125,7 +125,7 @@ namespace TAO CORBA::ORB_ptr orb, CORBA::Object_ptr empty_group, // empty group as created by ObjectManager const char * type_id, - PortableGroup::Criteria the_criteria, + const PortableGroup::Criteria & the_criteria, TAO_PG::Properties_Decoder * type_properties ACE_ENV_ARG_DECL); @@ -264,8 +264,6 @@ namespace TAO /** * Protect internal state. - * Implementation methods should assume the mutex is - * locked if necessary. */ TAO_SYNCH_MUTEX internals_; typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp index eec57ae0bdd..28e58370698 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.cpp @@ -8,6 +8,9 @@ * This file implements classes to help manage the Properties * defined in the Portable Object Group. * + * 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. + * * @author Dale Wilson <wilson_d@ociweb.com> */ //============================================================================= @@ -22,20 +25,23 @@ TAO_PG::Properties_Decoder::Properties_Decoder() } -TAO_PG::Properties_Decoder::Properties_Decoder (const PortableGroup::Properties & property_set) +TAO_PG::Properties_Decoder::Properties_Decoder ( + const PortableGroup::Properties & property_set + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) : defaults_ (0) { - this->decode (property_set); - // @@ do something about the no-memory exception + this->decode (property_set ACE_ENV_ARG_PARAMETER); } TAO_PG::Properties_Decoder::Properties_Decoder ( const PortableGroup::Properties & property_set, - Properties_Decoder * defaults) + Properties_Decoder * defaults + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) : defaults_ (defaults) { - this->decode (property_set); - // @@ do something about the no-memory exception + this->decode (property_set ACE_ENV_ARG_PARAMETER); } @@ -45,8 +51,6 @@ TAO_PG::Properties_Decoder::Properties_Decoder ( { } - - TAO_PG::Properties_Decoder::~Properties_Decoder () { this->clear (); @@ -54,8 +58,9 @@ TAO_PG::Properties_Decoder::~Properties_Decoder () void TAO_PG::Properties_Decoder::decode (const PortableGroup::Properties & property_set ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) - { + InternalGuard guard(this->internals_); + size_t count = property_set.length (); for (size_t nItem = 0; nItem < count; ++nItem) { @@ -68,7 +73,7 @@ void TAO_PG::Properties_Decoder::decode (const PortableGroup::Properties & prope const PortableGroup::Value * value_copy; ACE_NEW_THROW_EX (value_copy, PortableGroup::Value (property.val), CORBA::NO_MEMORY ()); - const PortableGroup::Value * replaced_value; + const PortableGroup::Value * replaced_value = 0; if (0 == this->values_.rebind (name, value_copy, replaced_value)) { if (0 != replaced_value) @@ -92,6 +97,7 @@ void TAO_PG::Properties_Decoder::decode (const PortableGroup::Properties & prope void TAO_PG::Properties_Decoder::clear () { + InternalGuard guard(this->internals_); for (ValueMapIterator it = this->values_.begin (); it != this->values_.end (); ++it) @@ -112,6 +118,7 @@ void TAO_PG::Properties_Decoder::clear () void TAO_PG::Properties_Decoder::remove (const PortableGroup::Properties & property_set) ACE_THROW_SPEC ((CORBA::SystemException)) { + InternalGuard guard(this->internals_); size_t count = property_set.length (); for (size_t nItem = 0; nItem < count; ++nItem) { @@ -168,6 +175,7 @@ void TAO_PG::Properties_Decoder::export_properties(PortableGroup::Properties & p void TAO_PG::Properties_Decoder::merge_properties (ValueMap & merged_values) const { + InternalGuard guard(ACE_const_cast (TAO_PG::Properties_Decoder *, this)->internals_); if (0 != this->defaults_) { this->defaults_->merge_properties (merged_values); @@ -188,6 +196,7 @@ int TAO_PG::Properties_Decoder::find ( const ACE_CString & key, const PortableGroup::Value *& pValue) const { + InternalGuard guard(ACE_const_cast (TAO_PG::Properties_Decoder *, this)->internals_); int found = (0 == this->values_.find (key, pValue)); if (! found) { diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h index 9730edcb7db..165f3cfacaf 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Decoder.h @@ -8,6 +8,9 @@ * This file declares classes to help manage the Properties * defined in the Portable Object Group. * + * 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. + * * @author Dale Wilson <wilson_d@ociweb.com> */ //============================================================================= @@ -113,6 +116,8 @@ namespace TAO_PG */ void export_properties(PortableGroup::Properties & property_set) const; + ///////////////////////// + // Implementation Methods private: /** * populate a ValueMap with the properties known to this decoder @@ -120,11 +125,21 @@ namespace TAO_PG */ void merge_properties (ValueMap & merged_values) const; + //////////////////// + // Forbidden methods private: Properties_Decoder(const Properties_Decoder & rhs); Properties_Decoder & operator = (const Properties_Decoder & rhs); + /////////////// + // Data Members private: + /** + * Protect internal state. + */ + TAO_SYNCH_MUTEX internals_; + typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; + ValueMap values_; /** * a parent to another property decoder that provides default values diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp new file mode 100644 index 00000000000..1ca445a5066 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp @@ -0,0 +1,167 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file PG_Properties_Support.cpp + * + * $Id$ + * + * This file implements classes to help manage PortableGroup::Properties + * + * @author Dale Wilson <wilson_d@ociweb.com> + */ +//============================================================================= + +#include "PG_Properties_Support.h" + + +TAO::PG_Properties_Support::PG_Properties_Support () +{ +} + +TAO::PG_Properties_Support::~PG_Properties_Support () +{ + +} + +void TAO::PG_Properties_Support::set_default_properties (const PortableGroup::Properties & props) +{ + this->default_properties_.decode(props); +} + +PortableGroup::Properties * +TAO::PG_Properties_Support::get_default_properties ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)) +{ + PortableGroup::Properties_var result; + ACE_NEW_THROW_EX ( result, PortableGroup::Properties(), CORBA::NO_MEMORY()); + this->default_properties_.export_properties (*result ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (PortableGroup::Properties::_nil()); + return result._retn (); +} + +void TAO::PG_Properties_Support::remove_default_properties ( + const PortableGroup::Properties & props + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->default_properties_.remove (props ACE_ENV_ARG_PARAMETER); +} + +void +TAO::PG_Properties_Support::set_type_properties ( + const char *type_id, + const PortableGroup::Properties & overrides + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)) +{ + InternalGuard guard(this->internals_); + + TAO_PG::Properties_Decoder * typeid_properties; + if ( 0 != this->properties_map_.find (type_id, typeid_properties)) + { + ACE_NEW_THROW_EX ( + typeid_properties, + TAO_PG::Properties_Decoder (overrides, & this->default_properties_), + CORBA::NO_MEMORY()); + this->properties_map_.bind (type_id, typeid_properties); + } + typeid_properties->clear (); + typeid_properties->decode (overrides ACE_ENV_ARG_PARAMETER); + +} + +PortableGroup::Properties * +TAO::PG_Properties_Support::get_type_properties ( + const char *type_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException)) +{ + PortableGroup::Properties_var result; + ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ()); + + InternalGuard guard(this->internals_); + + TAO_PG::Properties_Decoder * typeid_properties; + if ( 0 != this->properties_map_.find (type_id, typeid_properties)) + { + typeid_properties->export_properties (*result ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + return result._retn (); +} + +void +TAO::PG_Properties_Support::remove_type_properties ( + const char *type_id, + const PortableGroup::Properties & props + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException)) +{ + // NOTE: do not actually delete the properties for this type. + // There may be object groups depending on these. + // Reference counted pointers could be used to allow property sets + // for unused typeids to be deleted. + + InternalGuard guard(this->internals_); + + TAO_PG::Properties_Decoder * typeid_properties; + if ( 0 != this->properties_map_.find (type_id, typeid_properties)) + { + typeid_properties->remove (props ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + + +TAO_PG::Properties_Decoder * +TAO::PG_Properties_Support::find_typeid_properties ( + const char *type_id + ACE_ENV_ARG_PARAMETER) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + InternalGuard guard(this->internals_); + + TAO_PG::Properties_Decoder * typeid_properties = 0; + if ( 0 != this->properties_map_.find (type_id, typeid_properties)) + { + ACE_NEW_THROW_EX ( + typeid_properties, + TAO_PG::Properties_Decoder (& this->default_properties_), + CORBA::NO_MEMORY()); + this->properties_map_.bind (type_id, typeid_properties); + } + return typeid_properties; +} + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + + template class ACE_Hash_Map_Manager< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX>; + + template class ACE_Hash_Map_Iterator< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate ACE_Hash_Map_Manager< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX> + +# pragma instantiate ACE_Hash_Map_Iterator< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h new file mode 100644 index 00000000000..a35a6717749 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h @@ -0,0 +1,86 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file PG_Properties_Support.h + * + * $Id$ + * + * This file declares classes to help manage the PortableGroup::Properties + * + * @author Dale Wilson <wilson_d@ociweb.com> + */ +//============================================================================= +#ifndef TAO_PG_PROPERTIES_SUPPORT_H +#define TAO_PG_PROPERTIES_SUPPORT_H + +#include "PG_Properties_Decoder.h" + +namespace TAO +{ + class TAO_PortableGroup_Export PG_Properties_Support + { + typedef ACE_Hash_Map_Manager< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX> Properties_Map; + typedef ACE_Hash_Map_Iterator< + ACE_CString, + ::TAO_PG::Properties_Decoder *, + TAO_SYNCH_MUTEX> Properties_Map_Iterator; + + public: + PG_Properties_Support (); + ~PG_Properties_Support (); + + void set_default_properties (const PortableGroup::Properties & props); + + PortableGroup::Properties * get_default_properties (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)); + + void remove_default_properties ( + const PortableGroup::Properties & props + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void set_type_properties ( + const char *type_id, + const PortableGroup::Properties & overrides + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + PortableGroup::InvalidProperty, + PortableGroup::UnsupportedProperty)); + + PortableGroup::Properties * get_type_properties ( + const char *type_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException)); + + TAO_PG::Properties_Decoder * TAO::PG_Properties_Support::find_typeid_properties ( + const char *type_id + ACE_ENV_ARG_PARAMETER) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void remove_type_properties ( + const char *type_id, + const PortableGroup::Properties & props + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException)); + + /////////////// + // Data Members + private: + /** + * Protect internal state. + */ + TAO_SYNCH_MUTEX internals_; + typedef ACE_Guard<TAO_SYNCH_MUTEX> InternalGuard; + + TAO_PG::Properties_Decoder default_properties_; + Properties_Map properties_map_; + }; +} //namespace TAO_PG + +#endif // TAO_PG_PROPERTIES_SUPPORT_H diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.cpp deleted file mode 100644 index f0797660b6f..00000000000 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- C++ -*- */ -//============================================================================= -/** - * @file PG_Typeid_Properties_Map.cpp - * - * $Id$ - * - * This file implements classes to help manage PortableGroup::Properties - * - * @author Dale Wilson <wilson_d@ociweb.com> - */ -//============================================================================= - -#include "PG_Typeid_Properties_Map.h" - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - - template class ACE_Hash_Map_Manager< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX>; - - template class ACE_Hash_Map_Iterator< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -# pragma instantiate ACE_Hash_Map_Manager< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX> - -# pragma instantiate ACE_Hash_Map_Iterator< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h deleted file mode 100644 index acd30853e04..00000000000 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Typeid_Properties_Map.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- C++ -*- */ -//============================================================================= -/** - * @file PG_Typeid_Properties_Map.h - * - * $Id$ - * - * This file declares classes to help manage the PortableGroup::Properties - * - * @author Dale Wilson <wilson_d@ociweb.com> - */ -//============================================================================= -#ifndef TAO_PG_TYPEID_PROPERTIES_MAP_H -#define TAO_PG_TYPEID_PROPERTIES_MAP_H - -#include "PG_Properties_Decoder.h" - -namespace TAO -{ - typedef ACE_Hash_Map_Manager< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX> PG_Typeid_Properties_Map; - typedef ACE_Hash_Map_Iterator< - ACE_CString, - ::TAO_PG::Properties_Decoder *, - TAO_SYNCH_MUTEX> PG_Typeid_Properties_Map_Iterator; -} //namespace TAO_PG - -#endif // TAO_PG_TYPEID_PROPERTIES_MAP_H diff --git a/TAO/orbsvcs/tests/FT_App/demo.pl b/TAO/orbsvcs/tests/FT_App/run_test_demo.pl index ddff9b8259e..ddff9b8259e 100644..100755 --- a/TAO/orbsvcs/tests/FT_App/demo.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_demo.pl |