TAO_Notify_Admin Class Reference

Base class for the ConsumerAdmin and SupplierAdmin. More...

#include <Admin.h>

Inheritance diagram for TAO_Notify_Admin:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_Admin:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CosNotifyChannelAdmin::AdminIDSeq SEQ
typedef CosNotifyChannelAdmin::AdminIDSeq_var SEQ_VAR

Public Member Functions

 TAO_Notify_Admin ()
 Constuctor.

virtual ~TAO_Notify_Admin ()
 Destructor.

void init (TAO_Notify::Topology_Parent *parent)
 Init.

void insert (TAO_Notify_Proxy *proxy)
 Insert the proxy in the .

void remove (TAO_Notify_Proxy *proxy)
 Remove type from container_.

TAO_Notify_FilterAdminfilter_admin (void)
 Access Admin FilterAdmin.

void filter_operator (CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator)
 Set Filter operator.

CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator (void)
 Access Filter operator.

void subscribed_types (TAO_Notify_EventTypeSeq &subscribed_types)
 Obtain the Admin's subscribed types.

TAO_Notify_EventChannelevent_channel () const
virtual int shutdown ()
 Shutdown.

virtual void save_persistent (TAO_Notify::Topology_Saver &saver)
virtual TAO_Notify::Topology_Objectload_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs)
virtual void reconnect ()
void set_default (bool is_default)
bool is_default () const
virtual void load_attrs (const TAO_Notify::NVPList &attrs)

Protected Types

typedef TAO_Notify_Container_T<
TAO_Notify_Proxy
TAO_Notify_Proxy_Container

Protected Member Functions

void save_attrs (TAO_Notify::NVPList &attrs)
virtual const char * get_admin_type_name (void) const=0
TAO_Notify_Proxy_Containerproxy_container ()

Protected Attributes

TAO_Notify_EventChannel::Ptr ec_
 = Data Members The EventChannel.

TAO_Notify_EventTypeSeq subscribed_types_
 The types that we've subscribed our proxy objects with the event manager.

TAO_Notify_FilterAdmin filter_admin_
 Filter Administration.

CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator_
 Filter operator.

bool is_default_

Private Attributes

ACE_Auto_Ptr< TAO_Notify_Proxy_Containerproxy_container_
 The Proxy Container.


Friends

class TAO_Notify_Builder

Detailed Description

Base class for the ConsumerAdmin and SupplierAdmin.

Definition at line 40 of file Admin.h.


Member Typedef Documentation

typedef CosNotifyChannelAdmin::AdminIDSeq TAO_Notify_Admin::SEQ
 

Definition at line 44 of file Admin.h.

typedef CosNotifyChannelAdmin::AdminIDSeq_var TAO_Notify_Admin::SEQ_VAR
 

Definition at line 45 of file Admin.h.

typedef TAO_Notify_Container_T<TAO_Notify_Proxy> TAO_Notify_Admin::TAO_Notify_Proxy_Container [protected]
 

Definition at line 94 of file Admin.h.

Referenced by init().


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_Admin::TAO_Notify_Admin  ) 
 

Constuctor.

Definition at line 34 of file Admin.cpp.

References ACE_Unbounded_Set< TAO_Notify_EventType >::insert(), and subscribed_types_.

00035   : ec_ (0)
00036   , filter_operator_ (CosNotifyChannelAdmin::OR_OP)
00037   , is_default_ (false)
00038 {
00039   // Initialize all Admin objects to initially be subscribed for all
00040   // events.  This is a reasonable default and is required to allow
00041   // Cos Event consumers/suppliers to send/receive events,
00042   this->subscribed_types_.insert (TAO_Notify_EventType::special ());
00043 }

TAO_Notify_Admin::~TAO_Notify_Admin  )  [virtual]
 

Destructor.

Definition at line 45 of file Admin.cpp.

00046 {
00047 }


Member Function Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Notify_EventChannel * TAO_Notify_Admin::event_channel  )  const
 

Definition at line 9 of file Admin.inl.

References ec_.

00010 {
00011   return this->ec_.get();
00012 }

ACE_INLINE TAO_Notify_FilterAdmin & TAO_Notify_Admin::filter_admin void   ) 
 

Access Admin FilterAdmin.

Definition at line 16 of file Admin.inl.

References filter_admin_.

Referenced by TAO_Notify_Method_Request_Lookup::execute_i(), and TAO_Notify_Method_Request_Dispatch::execute_i().

00017 {
00018   return this->filter_admin_;
00019 }

ACE_INLINE CosNotifyChannelAdmin::InterFilterGroupOperator TAO_Notify_Admin::filter_operator void   ) 
 

Access Filter operator.

Definition at line 28 of file Admin.inl.

References filter_operator_.

00029 {
00030   return this->filter_operator_;
00031 }

ACE_INLINE void TAO_Notify_Admin::filter_operator CosNotifyChannelAdmin::InterFilterGroupOperator  filter_operator  ) 
 

Set Filter operator.

Definition at line 22 of file Admin.inl.

References filter_operator_.

Referenced by TAO_Notify_Builder::build_consumer_admin(), TAO_Notify_Builder::build_supplier_admin(), TAO_Notify_Method_Request_Lookup::execute_i(), and TAO_Notify_Method_Request_Dispatch::execute_i().

00023 {
00024   this->filter_operator_ = filter_operator;
00025 }

virtual const char* TAO_Notify_Admin::get_admin_type_name void   )  const [protected, pure virtual]
 

Implemented in TAO_Notify_ConsumerAdmin, and TAO_Notify_SupplierAdmin.

Referenced by save_persistent().

void TAO_Notify_Admin::init TAO_Notify::Topology_Parent parent  ) 
 

Init.

Definition at line 50 of file Admin.cpp.

References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_NEW_THROW_EX, ec_, TAO_Notify_Container_T< TYPE >::init(), TAO_Notify::Topology_Object::initialize(), proxy_container(), proxy_container_, ACE_Auto_Basic_Ptr< X >::reset(), and TAO_Notify_Proxy_Container.

Referenced by TAO_Notify_SupplierAdmin::init(), and TAO_Notify_ConsumerAdmin::init().

00051 {
00052   ACE_ASSERT (this->ec_.get() == 0);
00053 
00054   this->ec_.reset (dynamic_cast<TAO_Notify_EventChannel *>(parent));
00055   ACE_ASSERT (this->ec_.get() != 0);
00056 
00057   // this-> on the following line confuses VC6
00058   initialize (parent ACE_ENV_ARG_PARAMETER);
00059 
00060   TAO_Notify_Proxy_Container* proxy_container = 0;
00061   ACE_NEW_THROW_EX (proxy_container,
00062                     TAO_Notify_Proxy_Container (),
00063                     CORBA::INTERNAL ());
00064   ACE_CHECK;
00065   this->proxy_container_.reset (proxy_container);
00066 
00067   this->proxy_container().init (ACE_ENV_SINGLE_ARG_PARAMETER);
00068   ACE_CHECK;
00069 
00070 }

void TAO_Notify_Admin::insert TAO_Notify_Proxy proxy  ) 
 

Insert the proxy in the .

Definition at line 109 of file Admin.cpp.

References ACE_ENV_ARG_PARAMETER, TAO_Notify_Container_T< TYPE >::insert(), and proxy_container().

00110 {
00111   this->proxy_container().insert (proxy ACE_ENV_ARG_PARAMETER);
00112 }

ACE_INLINE bool TAO_Notify_Admin::is_default  )  const
 

Definition at line 42 of file Admin.inl.

References is_default_.

Referenced by TAO_Notify_EventChannel::load_child().

00043 {
00044   return this->is_default_;
00045 }

void TAO_Notify_Admin::load_attrs const TAO_Notify::NVPList attrs  )  [virtual]
 

Load our attributes. Each derived type should call the superclass load first before loading its own attributes.

Reimplemented from TAO_Notify_Object.

Definition at line 167 of file Admin.cpp.

References ACE_OS::atoi(), filter_operator_, TAO_Notify::NVPList::find(), is_default_, TAO_Notify_Object::load_attrs(), and ACE_OS::strcmp().

Referenced by TAO_Notify_EventChannel::load_child().

00168 {
00169   TAO_Notify_Object::load_attrs (attrs);
00170   const char* value = 0;
00171   if (attrs.find ("InterFilterGroupOperator", value))
00172     {
00173       this->filter_operator_ = static_cast <CosNotifyChannelAdmin::InterFilterGroupOperator> (ACE_OS::atoi (value));
00174     }
00175 
00176   if (attrs.find ("default", value))
00177     {
00178       this->is_default_ = (ACE_OS::strcmp (value, "yes") == 0);
00179     }
00180 }

TAO_Notify::Topology_Object * TAO_Notify_Admin::load_child const ACE_CString type,
CORBA::Long  id,
const TAO_Notify::NVPList attrs
[virtual]
 

Reimplemented in TAO_Notify_ConsumerAdmin, and TAO_Notify_SupplierAdmin.

Definition at line 183 of file Admin.cpp.

References ACE_DEBUG, ACE_TEXT(), DEBUG_LEVEL, filter_admin_, LM_DEBUG, ACE_Unbounded_Set< TAO_Notify_EventType >::reset(), and subscribed_types_.

Referenced by TAO_Notify_SupplierAdmin::load_child(), and TAO_Notify_ConsumerAdmin::load_child().

00187 {
00188   ACE_UNUSED_ARG (attrs);
00189   TAO_Notify::Topology_Object* result = this;
00190   if (type == "subscriptions")
00191     {
00192       if (DEBUG_LEVEL)
00193         ACE_DEBUG ((LM_DEBUG,
00194                     ACE_TEXT ("(%P|%t) Admin reload subscription %d\n"),
00195                     static_cast<int> (id)
00196                     ));
00197       // since we initialized our subscribed types to everything
00198       // in the constructor. we have to clear it out first.
00199       this->subscribed_types_.reset();
00200       result = &this->subscribed_types_;
00201     }
00202   else if (type == "filter_admin")
00203     {
00204       if (DEBUG_LEVEL)
00205         ACE_DEBUG ((LM_DEBUG,
00206                     ACE_TEXT ("(%P|%t) Admin reload filter_admin %d\n"),
00207                     static_cast<int> (id)
00208                     ));
00209       result = & this->filter_admin_;
00210     }
00211   return result;
00212 }

ACE_INLINE TAO_Notify_Admin::TAO_Notify_Proxy_Container & TAO_Notify_Admin::proxy_container  )  [protected]
 

Definition at line 48 of file Admin.inl.

References ACE_ASSERT, ACE_Auto_Basic_Ptr< X >::get(), and proxy_container_.

Referenced by init(), insert(), reconnect(), remove(), save_persistent(), and shutdown().

00049 {
00050   ACE_ASSERT( proxy_container_.get() != 0 );
00051   return *proxy_container_;
00052 }

void TAO_Notify_Admin::reconnect  )  [virtual]
 

Re-establish connections that we had before a shutdown.

After a topology restore, this method is called so we can reconnect to any external objects with whom we were interacting. We should call the reconnect() method on all of our children to give them the chance to do the same.

Reimplemented from TAO_Notify::Topology_Savable.

Definition at line 215 of file Admin.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Container_T< TYPE >::collection(), and proxy_container().

00216 {
00217   TAO_Notify::Reconnect_Worker<TAO_Notify_Proxy> wrk;
00218   this->proxy_container().collection()->for_each(&wrk ACE_ENV_ARG_PARAMETER);
00219   ACE_CHECK;
00220 }

void TAO_Notify_Admin::remove TAO_Notify_Proxy proxy  ) 
 

Remove type from container_.

Definition at line 73 of file Admin.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, proxy_container(), and TAO_Notify_Container_T< TYPE >::remove().

00074 {
00075   this->proxy_container().remove (proxy ACE_ENV_ARG_PARAMETER);
00076   ACE_CHECK;
00077 }

void TAO_Notify_Admin::save_attrs TAO_Notify::NVPList attrs  )  [protected, virtual]
 

Called by derived types to save their attributes. Each derived type should call its superclass version before saving its own attrs.

Reimplemented from TAO_Notify_Object.

Definition at line 155 of file Admin.cpp.

References is_default_, TAO_Notify::NVPList::push_back(), and TAO_Notify_Object::save_attrs().

Referenced by save_persistent().

00156 {
00157   TAO_Notify_Object::save_attrs(attrs);
00158   attrs.push_back(TAO_Notify::NVP("InterFilterGroupOperator",
00159                                   this->filter_operator_));
00160   if (this->is_default_)
00161     {
00162       attrs.push_back (TAO_Notify::NVP ("default", "yes"));
00163     }
00164 }

void TAO_Notify_Admin::save_persistent TAO_Notify::Topology_Saver saver  )  [virtual]
 

Save our state to a Topology_Saver.

Use the methods of a Topology_Saver to store all information we want persisted. This function is called by our parent, which gives us a saver to use. In turn, we must call this function on all of our children. The implementation should look like: bool change = this->self_changed_; this->self_changed_ = false; this->children_changed_ = false; if (is_persistent ()) { bool want_all_children = saver.begin_object( this->id(), type, attrs, change ACE_ENV_ARG_PARAMETER); ACE_CHECK; for all children { if (want_all_children || child.is_changed()) { child.save_persistent(saver ACE_ENV_ARG_PARAMETER); ACE_CHECK; } } for all deleted children { saver.delete_child(child_type, child_id); } saver.end_object(this->id(), type ACE_ENV_ARG_PARAMETER); )

Implements TAO_Notify::Topology_Savable.

Definition at line 115 of file Admin.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Container_T< TYPE >::collection(), filter_admin_, get_admin_type_name(), TAO_Notify::Topology_Object::is_changed(), TAO_Notify::Topology_Object::is_persistent(), proxy_container(), save_attrs(), TAO_Notify_EventTypeSeq::save_persistent(), TAO_Notify_FilterAdmin::save_persistent(), and subscribed_types_.

00116 {
00117   bool changed = this->children_changed_;
00118   this->children_changed_ = false;
00119   this->self_changed_ = false;
00120 
00121   if (is_persistent ())
00122     {
00123       TAO_Notify::NVPList attrs;
00124       this->save_attrs(attrs);
00125 
00126       const char* type = this->get_admin_type_name();
00127 
00128       bool want_all_children =
00129         saver.begin_object(this->id(), type, attrs, changed
00130                            ACE_ENV_ARG_PARAMETER);
00131       ACE_CHECK;
00132 
00133       if (want_all_children || this->filter_admin_.is_changed ())
00134         {
00135           this->filter_admin_.save_persistent(saver ACE_ENV_ARG_PARAMETER);
00136           ACE_CHECK;
00137         }
00138       if (want_all_children || this->subscribed_types_.is_changed ())
00139         {
00140           this->subscribed_types_.save_persistent(saver ACE_ENV_ARG_PARAMETER);
00141           ACE_CHECK;
00142         }
00143 
00144       TAO_Notify::Save_Persist_Worker<TAO_Notify_Proxy>
00145         wrk(saver, want_all_children);
00146       this->proxy_container().collection()->for_each(&wrk
00147                                                      ACE_ENV_ARG_PARAMETER);
00148       ACE_CHECK;
00149 
00150       saver.end_object(this->id(), type ACE_ENV_ARG_PARAMETER);
00151     }
00152 }

ACE_INLINE void TAO_Notify_Admin::set_default bool  is_default  ) 
 

Definition at line 35 of file Admin.inl.

References is_default_.

Referenced by TAO_Notify_EventChannel::default_consumer_admin(), and TAO_Notify_EventChannel::default_supplier_admin().

00036 {
00037   this->is_default_ = is_default;
00038 }

int TAO_Notify_Admin::shutdown  )  [virtual]
 

Shutdown.

Reimplemented from TAO_Notify_Object.

Definition at line 95 of file Admin.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, proxy_container(), TAO_Notify_Container_T< TYPE >::shutdown(), and TAO_Notify_Object::shutdown().

00096 {
00097   int sd_ret = TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00098   ACE_CHECK_RETURN (1);
00099   if (sd_ret == 1)
00100     return 1;
00101 
00102   this->proxy_container().shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00103   ACE_CHECK_RETURN (1);
00104 
00105   return 0;
00106 }

void TAO_Notify_Admin::subscribed_types TAO_Notify_EventTypeSeq subscribed_types  ) 
 

Obtain the Admin's subscribed types.

Definition at line 80 of file Admin.cpp.

References ACE_CHECK, ACE_GUARD_THROW_EX, TAO_Notify_EventTypeSeq::add_and_remove(), subscribed_types(), and TAO_SYNCH_MUTEX.

Referenced by subscribed_types().

00081 {
00082   ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00083                       CORBA::INTERNAL ());
00084   ACE_CHECK;
00085 
00086   // Adopt the Admin's subscription.
00087   TAO_Notify_EventTypeSeq added (this->subscribed_types_), removed;
00088 
00089   added.add_and_remove (subscribed_types, removed);
00090 
00091   subscribed_types = added;
00092 }


Friends And Related Function Documentation

friend class TAO_Notify_Builder [friend]
 

Reimplemented from TAO_Notify_Object.

Definition at line 42 of file Admin.h.


Member Data Documentation

TAO_Notify_EventChannel::Ptr TAO_Notify_Admin::ec_ [protected]
 

= Data Members The EventChannel.

Definition at line 100 of file Admin.h.

Referenced by event_channel(), and init().

TAO_Notify_FilterAdmin TAO_Notify_Admin::filter_admin_ [protected]
 

Filter Administration.

Definition at line 107 of file Admin.h.

Referenced by filter_admin(), load_child(), and save_persistent().

CosNotifyChannelAdmin::InterFilterGroupOperator TAO_Notify_Admin::filter_operator_ [protected]
 

Filter operator.

Definition at line 110 of file Admin.h.

Referenced by filter_operator(), and load_attrs().

bool TAO_Notify_Admin::is_default_ [protected]
 

Definition at line 112 of file Admin.h.

Referenced by is_default(), load_attrs(), save_attrs(), and set_default().

ACE_Auto_Ptr< TAO_Notify_Proxy_Container > TAO_Notify_Admin::proxy_container_ [private]
 

The Proxy Container.

Definition at line 115 of file Admin.h.

Referenced by init(), and proxy_container().

TAO_Notify_EventTypeSeq TAO_Notify_Admin::subscribed_types_ [protected]
 

The types that we've subscribed our proxy objects with the event manager.

Definition at line 104 of file Admin.h.

Referenced by load_child(), save_persistent(), and TAO_Notify_Admin().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:31:34 2006 for TAO_CosNotification by doxygen 1.3.6