PG_PropertyManager.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file PG_PropertyManager.h
00006  *
00007  * PG_PropertyManager.h,v 1.17 2006/03/14 06:14:34 jtc Exp
00008  *
00009  * @author Ossama Othman <ossama@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_PG_PROPERTY_MANAGER_H
00014 #define TAO_PG_PROPERTY_MANAGER_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/PortableGroup/PG_Default_Property_Validator.h"
00025 #include "orbsvcs/PortableGroup/portablegroup_export.h"
00026 #include "orbsvcs/PortableGroupS.h"
00027 
00028 #include "ace/SString.h"
00029 #include "ace/Null_Mutex.h"
00030 #include "ace/Functor.h"
00031 #include "ace/Hash_Map_Manager_T.h"
00032 
00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00034 
00035 /// Forward declarations.
00036 class TAO_PG_ObjectGroupManager;
00037 
00038 /**
00039  * @class TAO_PG_PropertyManager
00040  *
00041  * @brief Class that implements the PortableGroup::PropertyManager
00042  *        interface.
00043  *
00044  * Only the default and type-specific properties are housed in this
00045  * class.  The properties used at creation time of an object group and
00046  * those set dynamically after object group creation are stored in the
00047  * TAO_PG_ObjectGroup_Map_Entry structure.  However, the
00048  * PropertyManager is still used to manage those properties.
00049  */
00050 class TAO_PortableGroup_Export TAO_PG_PropertyManager
00051   : public virtual POA_PortableGroup::PropertyManager
00052 {
00053 public:
00054 
00055   /// Constructor.
00056   TAO_PG_PropertyManager (TAO_PG_ObjectGroupManager & object_group_manager);
00057 
00058   /**
00059    * @name PortableGroup::PropertyManager methods
00060    *
00061    * Methods required by the PortableGroup::PropertyManager
00062    * interface.
00063    */
00064   //@{
00065 
00066   /// Set the default properties to be used by all object groups.
00067   virtual void set_default_properties (
00068       const PortableGroup::Properties & props
00069       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00070     ACE_THROW_SPEC ((CORBA::SystemException,
00071                      PortableGroup::InvalidProperty,
00072                      PortableGroup::UnsupportedProperty));
00073 
00074   /// Get the default properties used by all object groups.
00075   virtual PortableGroup::Properties * get_default_properties (
00076       ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
00077     ACE_THROW_SPEC ((CORBA::SystemException));
00078 
00079   /// Remove default properties.
00080   virtual void remove_default_properties (
00081       const PortableGroup::Properties & props
00082       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00083     ACE_THROW_SPEC ((CORBA::SystemException,
00084                      PortableGroup::InvalidProperty,
00085                      PortableGroup::UnsupportedProperty));
00086 
00087   /// Set properties associated with a given Member type.  These
00088   /// properties override the default properties.
00089   virtual void set_type_properties (
00090       const char * type_id,
00091       const PortableGroup::Properties & overrides
00092       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00093     ACE_THROW_SPEC ((CORBA::SystemException,
00094                      PortableGroup::InvalidProperty,
00095                      PortableGroup::UnsupportedProperty));
00096 
00097   /**
00098    * Return the properties associated with a give Replica type.  These
00099    * properties include the type-specific properties in use, in
00100    * addition to the default properties that were not overridden.
00101    */
00102   virtual PortableGroup::Properties * get_type_properties (
00103       const char * type_id
00104       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00105     ACE_THROW_SPEC ((CORBA::SystemException));
00106 
00107   /// Remove the given properties associated with the Replica type ID.
00108   virtual void remove_type_properties (
00109       const char * type_id,
00110       const PortableGroup::Properties & props
00111       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00112     ACE_THROW_SPEC ((CORBA::SystemException,
00113                      PortableGroup::InvalidProperty,
00114                      PortableGroup::UnsupportedProperty));
00115 
00116   /**
00117    * Dynamically set the properties associated with a given object
00118    * group as the load balancer and replicas are being executed.
00119    * These properties override the type-specific and default
00120    * properties.
00121    */
00122   virtual void set_properties_dynamically (
00123       PortableGroup::ObjectGroup_ptr object_group,
00124       const PortableGroup::Properties & overrides
00125       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00126     ACE_THROW_SPEC ((CORBA::SystemException,
00127                      PortableGroup::ObjectGroupNotFound,
00128                      PortableGroup::InvalidProperty,
00129                      PortableGroup::UnsupportedProperty));
00130 
00131   /**
00132    * Return the properties currently in use by the given object
00133    * group.  These properties include those that were set dynamically,
00134    * type-specific properties that weren't overridden, properties that
00135    * were used when the replica was created, and default properties
00136    * that weren't overridden.
00137    */
00138   virtual PortableGroup::Properties * get_properties (
00139       PortableGroup::ObjectGroup_ptr object_group
00140       ACE_ENV_ARG_DECL_WITH_DEFAULTS)
00141     ACE_THROW_SPEC ((CORBA::SystemException,
00142                      PortableGroup::ObjectGroupNotFound));
00143 
00144   //@}
00145 
00146   /// Type-specific property hash map.
00147   typedef ACE_Hash_Map_Manager_Ex<
00148     ACE_CString,
00149     PortableGroup::Properties,
00150     ACE_Hash<ACE_CString>,
00151     ACE_Equal_To<ACE_CString>,
00152     ACE_Null_Mutex> Type_Prop_Table;
00153 
00154 private:
00155 
00156   /// Remove properties "to_be_removed" from the given list of
00157   /// properties.
00158   void remove_properties (const PortableGroup::Properties & to_be_removed,
00159                           PortableGroup::Properties &properties
00160                           ACE_ENV_ARG_DECL)
00161     ACE_THROW_SPEC ((CORBA::SystemException,
00162                      PortableGroup::InvalidProperty,
00163                      PortableGroup::UnsupportedProperty));
00164 
00165 private:
00166 
00167   /// Table that maps ObjectId to Object Group related information.
00168   TAO_PG_ObjectGroupManager & object_group_manager_;
00169 
00170   /// Default properties.
00171   PortableGroup::Properties default_properties_;
00172 
00173   /// Table of type-specific object group properties.
00174   Type_Prop_Table type_properties_;
00175 
00176   /// Lock used to synchronize access to the default properties and
00177   /// the type-specific properties.
00178   TAO_SYNCH_MUTEX lock_;
00179 
00180   /// The property validator.
00181   /**
00182    * @todo Strategize the validator, or use template policies.
00183    */
00184   TAO_PG_Default_Property_Validator property_validator_;
00185 
00186 };
00187 
00188 TAO_END_VERSIONED_NAMESPACE_DECL
00189 
00190 #include /**/ "ace/post.h"
00191 
00192 #endif /* TAO_PG_PROPERTY_MANAGER_H */

Generated on Thu Nov 9 14:03:34 2006 for TAO_PortableGroup by doxygen 1.3.6