#include <PG_Properties_Support.h>
Collaboration diagram for TAO::PG_Properties_Support:
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.
Definition at line 53 of file PG_Properties_Support.h.
typedef ACE_Hash_Map_Manager< ACE_CString, ::TAO::PG_Property_Set *, TAO_SYNCH_MUTEX> TAO::PG_Properties_Support::Properties_Map [private] |
Definition at line 58 of file PG_Properties_Support.h.
typedef ACE_Hash_Map_Iterator< ACE_CString, ::TAO::PG_Property_Set *, TAO_SYNCH_MUTEX> TAO::PG_Properties_Support::Properties_Map_Iterator [private] |
Definition at line 62 of file PG_Properties_Support.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PG_Properties_Support::PG_Properties_Support | ( | ) |
Definition at line 19 of file PG_Properties_Support.cpp.
References PG_Properties_Support().
Referenced by PG_Properties_Support().
TAO::PG_Properties_Support::~PG_Properties_Support | ( | ) |
Definition at line 23 of file PG_Properties_Support.cpp.
References ~PG_Properties_Support().
Referenced by ~PG_Properties_Support().
TAO::PG_Property_Set * TAO::PG_Properties_Support::find_typeid_properties | ( | const char * | type_id | ) |
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.
type_id | identifies the set of properties to be found. |
Definition at line 112 of file PG_Properties_Support.cpp.
References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), find_typeid_properties(), properties_map_, and TAO_SYNCH_MUTEX.
Referenced by find_typeid_properties().
00114 { 00115 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); 00116 00117 TAO::PG_Property_Set * typeid_properties = 0; 00118 if ( 0 != this->properties_map_.find (type_id, typeid_properties)) 00119 { 00120 ACE_NEW_THROW_EX ( 00121 typeid_properties, 00122 TAO::PG_Property_Set (& this->default_properties_), 00123 CORBA::NO_MEMORY()); 00124 this->properties_map_.bind (type_id, typeid_properties); 00125 } 00126 return typeid_properties; 00127 }
PortableGroup::Properties * TAO::PG_Properties_Support::get_default_properties | ( | void | ) |
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.
Definition at line 40 of file PG_Properties_Support.cpp.
References ACE_NEW_THROW_EX, default_properties_, and get_default_properties().
Referenced by get_default_properties().
00041 { 00042 PortableGroup::Properties_var result; 00043 ACE_NEW_THROW_EX ( result, PortableGroup::Properties(), CORBA::NO_MEMORY()); 00044 this->default_properties_.export_properties (*result); 00045 return result._retn (); 00046 }
PortableGroup::Properties * TAO::PG_Properties_Support::get_type_properties | ( | const char * | type_id | ) |
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_Property_Set format. This is more efficient, but suitable only for internal use.
type_id | identifies the set of properties to be exported. |
Definition at line 75 of file PG_Properties_Support.cpp.
References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, get_type_properties(), and TAO_SYNCH_MUTEX.
Referenced by get_type_properties().
00077 { 00078 PortableGroup::Properties_var result; 00079 ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ()); 00080 00081 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); 00082 00083 TAO::PG_Property_Set * typeid_properties = 0; 00084 if ( 0 != this->properties_map_.find (type_id, typeid_properties)) 00085 { 00086 typeid_properties->export_properties (*result); 00087 } 00088 return result._retn (); 00089 }
void TAO::PG_Properties_Support::remove_default_properties | ( | const PortableGroup::Properties & | props | ) |
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.
props | a set of propertys to be removed by name. |
Definition at line 48 of file PG_Properties_Support.cpp.
References default_properties_, and remove_default_properties().
Referenced by remove_default_properties().
00050 { 00051 this->default_properties_.remove (props); 00052 }
void TAO::PG_Properties_Support::remove_type_properties | ( | const char * | type_id, | |
const PortableGroup::Properties & | props | |||
) |
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.
props | a set of propertys to be removed by name from the type_id set. |
Definition at line 92 of file PG_Properties_Support.cpp.
References ACE_GUARD, remove_type_properties(), and TAO_SYNCH_MUTEX.
Referenced by remove_type_properties().
00095 { 00096 // NOTE: do not actually delete the properties for this type. 00097 // There may be object groups depending on these. 00098 // Reference counted pointers could be used to allow property sets 00099 // for unused typeids to be deleted. 00100 00101 ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); 00102 00103 TAO::PG_Property_Set * typeid_properties = 0; 00104 if ( 0 != this->properties_map_.find (type_id, typeid_properties)) 00105 { 00106 typeid_properties->remove (props); 00107 } 00108 }
void TAO::PG_Properties_Support::set_default_properties | ( | const PortableGroup::Properties & | props | ) |
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.
props | the set of properties to update the defaults. |
Definition at line 34 of file PG_Properties_Support.cpp.
References default_properties_, and set_default_properties().
Referenced by set_default_properties().
00035 { 00036 this->default_properties_.decode (props); 00037 }
void TAO::PG_Properties_Support::set_default_property | ( | const char * | name, | |
const PortableGroup::Value & | value | |||
) |
Set a single default property. Overwriting any value previously set for that property. Leaving all other properties untouched.
name | the name of the property to set an Any containing the value. |
Definition at line 28 of file PG_Properties_Support.cpp.
References default_properties_, and set_default_property().
Referenced by set_default_property().
00030 { 00031 this->default_properties_.set_property(name, value); 00032 }
void TAO::PG_Properties_Support::set_type_properties | ( | const char * | type_id, | |
const PortableGroup::Properties & | overrides | |||
) |
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.)
Definition at line 55 of file PG_Properties_Support.cpp.
References ACE_GUARD, ACE_NEW_THROW_EX, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), properties_map_, set_type_properties(), and TAO_SYNCH_MUTEX.
Referenced by set_type_properties().
00058 { 00059 ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); 00060 00061 TAO::PG_Property_Set * typeid_properties; 00062 if ( 0 != this->properties_map_.find (type_id, typeid_properties)) 00063 { 00064 ACE_NEW_THROW_EX ( 00065 typeid_properties, 00066 TAO::PG_Property_Set (overrides, & this->default_properties_), 00067 CORBA::NO_MEMORY()); 00068 this->properties_map_.bind (type_id, typeid_properties); 00069 } 00070 typeid_properties->clear (); 00071 typeid_properties->decode (overrides); 00072 }
TAO::PG_Property_Set TAO::PG_Properties_Support::default_properties_ [private] |
The default property set.
Definition at line 185 of file PG_Properties_Support.h.
Referenced by get_default_properties(), remove_default_properties(), set_default_properties(), and set_default_property().
TAO_SYNCH_MUTEX TAO::PG_Properties_Support::internals_ [private] |
Protect internal state.
Definition at line 182 of file PG_Properties_Support.h.
Properties_Map TAO::PG_Properties_Support::properties_map_ [private] |
A collection of property sets indexed by type_id.
Definition at line 188 of file PG_Properties_Support.h.
Referenced by find_typeid_properties(), and set_type_properties().