TAO_PG_PropertyManager Class Reference

Class that implements the PortableGroup::PropertyManager interface. More...

#include <PG_PropertyManager.h>

Collaboration diagram for TAO_PG_PropertyManager:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Hash_Map_Manager_Ex<
ACE_CString, PortableGroup::Properties,
ACE_Hash< ACE_CString >,
ACE_Equal_To< ACE_CString >,
ACE_Null_Mutex
Type_Prop_Table
 Type-specific property hash map.


Public Member Functions

 TAO_PG_PropertyManager (TAO_PG_ObjectGroupManager &object_group_manager)
 Constructor.

PortableGroup::PropertyManager methods
Methods required by the PortableGroup::PropertyManager interface.

virtual void set_default_properties (const PortableGroup::Properties &props ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
 Set the default properties to be used by all object groups.

virtual PortableGroup::Propertiesget_default_properties (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException)
 Get the default properties used by all object groups.

virtual void remove_default_properties (const PortableGroup::Properties &props ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
 Remove default properties.

virtual void set_type_properties (const char *type_id, const PortableGroup::Properties &overrides ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
virtual PortableGroup::Propertiesget_type_properties (const char *type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException)
virtual void remove_type_properties (const char *type_id, const PortableGroup::Properties &props ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
 Remove the given properties associated with the Replica type ID.

virtual void set_properties_dynamically (PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Properties &overrides ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::ObjectGroupNotFound, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
virtual PortableGroup::Propertiesget_properties (PortableGroup::ObjectGroup_ptr object_group ACE_ENV_ARG_DECL_WITH_DEFAULTS) throw (CORBA::SystemException, PortableGroup::ObjectGroupNotFound)

Private Member Functions

void remove_properties (const PortableGroup::Properties &to_be_removed, PortableGroup::Properties &properties ACE_ENV_ARG_DECL) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)

Private Attributes

TAO_PG_ObjectGroupManagerobject_group_manager_
 Table that maps ObjectId to Object Group related information.

PortableGroup::Properties default_properties_
 Default properties.

Type_Prop_Table type_properties_
 Table of type-specific object group properties.

TAO_SYNCH_MUTEX lock_
TAO_PG_Default_Property_Validator property_validator_
 The property validator.


Detailed Description

Class that implements the PortableGroup::PropertyManager interface.

Only the default and type-specific properties are housed in this class. The properties used at creation time of an object group and those set dynamically after object group creation are stored in the TAO_PG_ObjectGroup_Map_Entry structure. However, the PropertyManager is still used to manage those properties.

Definition at line 50 of file PG_PropertyManager.h.


Member Typedef Documentation

typedef ACE_Hash_Map_Manager_Ex< ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> TAO_PG_PropertyManager::Type_Prop_Table
 

Type-specific property hash map.

Definition at line 152 of file PG_PropertyManager.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_PG_PropertyManager::TAO_PG_PropertyManager TAO_PG_ObjectGroupManager object_group_manager  ) 
 

Constructor.

Definition at line 17 of file PG_PropertyManager.cpp.

00019   : object_group_manager_ (object_group_manager),
00020     default_properties_ (),
00021     type_properties_ (),
00022     lock_ (),
00023     property_validator_ ()
00024 {
00025 }


Member Function Documentation

virtual PortableGroup::Properties* TAO_PG_PropertyManager::get_default_properties ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   )  throw (CORBA::SystemException) [virtual]
 

Get the default properties used by all object groups.

PortableGroup::Properties * TAO_PG_PropertyManager::get_properties PortableGroup::ObjectGroup_ptr object_group  ACE_ENV_ARG_DECL_WITH_DEFAULTS  )  throw (CORBA::SystemException, PortableGroup::ObjectGroupNotFound) [virtual]
 

Return the properties currently in use by the given object group. These properties include those that were set dynamically, type-specific properties that weren't overridden, properties that were used when the replica was created, and default properties that weren't overridden.

Definition at line 249 of file PG_PropertyManager.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_GUARD_RETURN, ACE_NEW_THROW_EX, TAO_PG::override_properties(), PortableGroup::Properties, and TAO_SYNCH_MUTEX.

Referenced by TAO_PG_GenericFactory::check_minimum_number_members().

00254 {
00255   CORBA::ULong properties_len = 0;
00256 
00257   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, property_map_guard, this->lock_, 0);
00258 
00259   // @@ Race condition here!
00260   PortableGroup::Properties_var dynamic_properties =
00261     this->object_group_manager_.get_properties (object_group
00262                                                 ACE_ENV_ARG_PARAMETER);
00263   ACE_CHECK_RETURN (0);
00264 
00265   CORBA::ULong dyn_props_len = dynamic_properties->length ();
00266   if (dyn_props_len > properties_len)
00267     properties_len = dyn_props_len;
00268 
00269   CORBA::String_var type_id =
00270     this->object_group_manager_.type_id (object_group
00271                                          ACE_ENV_ARG_PARAMETER);
00272   ACE_CHECK_RETURN (0);
00273 
00274   CORBA::ULong type_props_len = 0;
00275   PortableGroup::Properties * type_properties = 0;
00276   Type_Prop_Table::ENTRY * type_entry = 0;
00277   if (this->type_properties_.find (type_id.in (), type_entry) == 0)
00278     {
00279       type_properties = &type_entry->int_id_;
00280       type_props_len = type_properties->length ();
00281 
00282       if (type_props_len > properties_len)
00283         properties_len = type_props_len;
00284     }
00285 
00286   CORBA::ULong def_props_len = this->default_properties_.length ();
00287   if (def_props_len > properties_len)
00288     properties_len = def_props_len;
00289 
00290   PortableGroup::Properties * tmp_properties = 0;
00291   ACE_NEW_THROW_EX (tmp_properties,
00292                     PortableGroup::Properties (properties_len),
00293                     CORBA::NO_MEMORY (
00294                       CORBA::SystemException::_tao_minor_code (
00295                         TAO::VMCID,
00296                         ENOMEM),
00297                       CORBA::COMPLETED_NO));
00298   ACE_CHECK_RETURN (0);
00299 
00300   PortableGroup::Properties_var properties = tmp_properties;
00301 
00302   // Set the length to the length of the largest of the three property
00303   // sequences.  The idea is to keep the cost of the incremental
00304   // growth that may occur in TAO_PG::override_properties() to a
00305   // minimum.
00306   properties->length (properties_len);
00307 
00308   // Start out with a copy of the default properties.
00309   *tmp_properties = this->default_properties_;
00310 
00311   // Override default properties with type-specific properties.
00312   if (type_properties != 0)
00313     TAO_PG::override_properties (*type_properties, *tmp_properties);
00314 
00315   // Now override with the dynamic (object group) properties.
00316   TAO_PG::override_properties (dynamic_properties.in (), *tmp_properties);
00317 
00318   return properties._retn ();
00319 }

virtual PortableGroup::Properties* TAO_PG_PropertyManager::get_type_properties const char *type_id  ACE_ENV_ARG_DECL_WITH_DEFAULTS  )  throw (CORBA::SystemException) [virtual]
 

Return the properties associated with a give Replica type. These properties include the type-specific properties in use, in addition to the default properties that were not overridden.

Referenced by TAO_PG_GenericFactory::process_criteria().

virtual void TAO_PG_PropertyManager::remove_default_properties const PortableGroup::Properties &props  ACE_ENV_ARG_DECL_WITH_DEFAULTS  )  throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [virtual]
 

Remove default properties.

void TAO_PG_PropertyManager::remove_properties const PortableGroup::Properties to_be_removed,
PortableGroup::Properties &properties  ACE_ENV_ARG_DECL
throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [private]
 

Remove properties "to_be_removed" from the given list of properties.

virtual void TAO_PG_PropertyManager::remove_type_properties const char *  type_id,
const PortableGroup::Properties &props  ACE_ENV_ARG_DECL_WITH_DEFAULTS
throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [virtual]
 

Remove the given properties associated with the Replica type ID.

virtual void TAO_PG_PropertyManager::set_default_properties const PortableGroup::Properties &props  ACE_ENV_ARG_DECL_WITH_DEFAULTS  )  throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [virtual]
 

Set the default properties to be used by all object groups.

virtual void TAO_PG_PropertyManager::set_properties_dynamically PortableGroup::ObjectGroup_ptr  object_group,
const PortableGroup::Properties &overrides  ACE_ENV_ARG_DECL_WITH_DEFAULTS
throw (CORBA::SystemException, PortableGroup::ObjectGroupNotFound, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [virtual]
 

Dynamically set the properties associated with a given object group as the load balancer and replicas are being executed. These properties override the type-specific and default properties.

virtual void TAO_PG_PropertyManager::set_type_properties const char *  type_id,
const PortableGroup::Properties &overrides  ACE_ENV_ARG_DECL_WITH_DEFAULTS
throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty) [virtual]
 

Set properties associated with a given Member type. These properties override the default properties.


Member Data Documentation

PortableGroup::Properties TAO_PG_PropertyManager::default_properties_ [private]
 

Default properties.

Definition at line 171 of file PG_PropertyManager.h.

TAO_SYNCH_MUTEX TAO_PG_PropertyManager::lock_ [private]
 

Lock used to synchronize access to the default properties and the type-specific properties.

Definition at line 178 of file PG_PropertyManager.h.

TAO_PG_ObjectGroupManager& TAO_PG_PropertyManager::object_group_manager_ [private]
 

Table that maps ObjectId to Object Group related information.

Definition at line 168 of file PG_PropertyManager.h.

TAO_PG_Default_Property_Validator TAO_PG_PropertyManager::property_validator_ [private]
 

The property validator.

Todo:
Strategize the validator, or use template policies.

Definition at line 184 of file PG_PropertyManager.h.

Type_Prop_Table TAO_PG_PropertyManager::type_properties_ [private]
 

Table of type-specific object group properties.

Definition at line 174 of file PG_PropertyManager.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:05:01 2006 for TAO_PortableGroup by doxygen 1.3.6