TAO::PG_Properties_Support Class Reference

#include <PG_Properties_Support.h>

Collaboration diagram for TAO::PG_Properties_Support:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PG_Properties_Support ()
 ~PG_Properties_Support ()
void set_default_property (const char *name, const PortableGroup::Value &value ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
void set_default_properties (const PortableGroup::Properties &props ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
PortableGroup::Propertiesget_default_properties (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
void remove_default_properties (const PortableGroup::Properties &props ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
void set_type_properties (const char *type_id, const PortableGroup::Properties &overrides ACE_ENV_ARG_DECL) throw ( CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
PortableGroup::Propertiesget_type_properties (const char *type_id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
TAO::PG_Property_Setfind_typeid_properties (const char *type_id ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
void remove_type_properties (const char *type_id, const PortableGroup::Properties &props ACE_ENV_ARG_DECL) throw (CORBA::SystemException)

Private Types

typedef ACE_Hash_Map_Manager<
ACE_CString,::TAO::PG_Property_Set *,
TAO_SYNCH_MUTEX
Properties_Map
typedef ACE_Hash_Map_Iterator<
ACE_CString,::TAO::PG_Property_Set *,
TAO_SYNCH_MUTEX
Properties_Map_Iterator

Private Attributes

TAO_SYNCH_MUTEX internals_
TAO::PG_Property_Set default_properties_
 The default property set.

Properties_Map properties_map_
 A collection of property sets indexed by type_id.


Detailed Description

This Properties Support object manages Property Sets (TAO::PG_Property_Set).

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PG_Properties_Support::PG_Properties_Support  ) 
 

Definition at line 19 of file PG_Properties_Support.cpp.

00020 {
00021 }

TAO::PG_Properties_Support::~PG_Properties_Support  ) 
 

Definition at line 23 of file PG_Properties_Support.cpp.

00024 {
00025 
00026 }


Member Function Documentation

TAO::PG_Property_Set * TAO::PG_Properties_Support::find_typeid_properties const char *type_id  ACE_ENV_ARG_DECL  )  throw (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.

Parameters:
type_id identifies the set of properties to be found.
Returns:
a pointer to a Property_Set owned by this Properties_Support object.

Definition at line 132 of file PG_Properties_Support.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, and TAO_SYNCH_MUTEX.

00136 {
00137   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0);
00138 
00139   TAO::PG_Property_Set * typeid_properties = 0;
00140   if ( 0 != this->properties_map_.find (type_id, typeid_properties))
00141   {
00142     ACE_NEW_THROW_EX (
00143       typeid_properties,
00144       TAO::PG_Property_Set (& this->default_properties_),
00145       CORBA::NO_MEMORY());
00146     this->properties_map_.bind (type_id, typeid_properties);
00147   }
00148   return typeid_properties;
00149 }

PortableGroup::Properties * TAO::PG_Properties_Support::get_default_properties ACE_ENV_SINGLE_ARG_DECL   )  throw (CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
 

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.

Definition at line 44 of file PG_Properties_Support.cpp.

References ACE_CHECK_RETURN, ACE_NEW_THROW_EX, and PortableGroup::Properties.

00050 {
00051   PortableGroup::Properties_var result;
00052   ACE_NEW_THROW_EX ( result, PortableGroup::Properties(), CORBA::NO_MEMORY());
00053   ACE_CHECK_RETURN (0);
00054   this->default_properties_.export_properties (*result);
00055   return result._retn ();
00056 }

PortableGroup::Properties * TAO::PG_Properties_Support::get_type_properties const char *type_id  ACE_ENV_ARG_DECL  )  throw (CORBA::SystemException)
 

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.

Parameters:
type_id identifies the set of properties to be exported.
Returns:
a newly allocated PortableGroup::Properties that must be released by the caller.

Definition at line 91 of file PG_Properties_Support.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, TAO::PG_Property_Set::export_properties(), PortableGroup::Properties, and TAO_SYNCH_MUTEX.

00095 {
00096   PortableGroup::Properties_var result;
00097   ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ());
00098 
00099   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0);
00100 
00101   TAO::PG_Property_Set * typeid_properties = 0;
00102   if ( 0 != this->properties_map_.find (type_id, typeid_properties))
00103   {
00104     typeid_properties->export_properties (*result);
00105   }
00106   return result._retn ();
00107 }

void TAO::PG_Properties_Support::remove_default_properties const PortableGroup::Properties &props  ACE_ENV_ARG_DECL  )  throw (CORBA::SystemException)
 

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.

Parameters:
props a set of propertys to be removed by name.

Definition at line 58 of file PG_Properties_Support.cpp.

References PortableGroup::Properties.

00062 {
00063   this->default_properties_.remove (props);
00064 }

void TAO::PG_Properties_Support::remove_type_properties const char *  type_id,
const PortableGroup::Properties &props  ACE_ENV_ARG_DECL
throw (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.

Parameters:
props a set of propertys to be removed by name from the type_id set.

Definition at line 110 of file PG_Properties_Support.cpp.

References ACE_GUARD, PortableGroup::Properties, TAO::PG_Property_Set::remove(), and TAO_SYNCH_MUTEX.

00115 {
00116   // NOTE: do not actually delete the properties for this type.
00117   // There may be object groups depending on these.
00118   // Reference counted pointers could be used to allow property sets
00119   // for unused typeids to be deleted.
00120 
00121   ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);
00122 
00123   TAO::PG_Property_Set * typeid_properties = 0;
00124   if ( 0 != this->properties_map_.find (type_id, typeid_properties))
00125   {
00126     typeid_properties->remove (props);
00127   }
00128 }

void TAO::PG_Properties_Support::set_default_properties const PortableGroup::Properties &props  ACE_ENV_ARG_DECL  )  throw (CORBA::SystemException)
 

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.

Parameters:
props the set of properties to update the defaults.

Definition at line 36 of file PG_Properties_Support.cpp.

References ACE_ENV_ARG_PARAMETER, and PortableGroup::Properties.

00039 {
00040   this->default_properties_.decode (props ACE_ENV_ARG_PARAMETER);
00041 }

void TAO::PG_Properties_Support::set_default_property const char *  name,
const PortableGroup::Value &value  ACE_ENV_ARG_DECL
throw (CORBA::SystemException)
 

Set a single default property. Overwriting any value previously set for that property. Leaving all other properties untouched.

Parameters:
name the name of the property to set an Any containing the value.

Definition at line 28 of file PG_Properties_Support.cpp.

References ACE_ENV_ARG_PARAMETER, and PortableGroup::Value.

00032 {
00033   this->default_properties_.set_property(name, value ACE_ENV_ARG_PARAMETER);
00034 }

void TAO::PG_Properties_Support::set_type_properties const char *  type_id,
const PortableGroup::Properties &overrides  ACE_ENV_ARG_DECL
throw ( CORBA::SystemException, PortableGroup::InvalidProperty, PortableGroup::UnsupportedProperty)
 

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 67 of file PG_Properties_Support.cpp.

References ACE_ENV_ARG_PARAMETER, ACE_GUARD, ACE_NEW_THROW_EX, TAO::PG_Property_Set::clear(), TAO::PG_Property_Set::decode(), PortableGroup::Properties, and TAO_SYNCH_MUTEX.

00074 {
00075   ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);
00076 
00077   TAO::PG_Property_Set * typeid_properties;
00078   if ( 0 != this->properties_map_.find (type_id, typeid_properties))
00079   {
00080     ACE_NEW_THROW_EX (
00081       typeid_properties,
00082       TAO::PG_Property_Set (overrides, & this->default_properties_),
00083       CORBA::NO_MEMORY());
00084     this->properties_map_.bind (type_id, typeid_properties);
00085   }
00086   typeid_properties->clear ();
00087   typeid_properties->decode (overrides ACE_ENV_ARG_PARAMETER);
00088 }


Member Data Documentation

TAO::PG_Property_Set TAO::PG_Properties_Support::default_properties_ [private]
 

The default property set.

Definition at line 205 of file PG_Properties_Support.h.

TAO_SYNCH_MUTEX TAO::PG_Properties_Support::internals_ [private]
 

Protect internal state.

Definition at line 202 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 208 of file PG_Properties_Support.h.


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