Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends

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 ()
 Constructor.
virtual ~TAO_Notify_Admin ()
 Destructor.
void init (TAO_Notify::Topology_Parent *parent)
 Init.
void insert (TAO_Notify_Proxy *proxy)
 Insert the proxy in the <proxy_container_>.
void cleanup_proxy (TAO_Notify_Proxy *proxy, bool is_supplier, bool experienced_timeout)
 Remove type from container_ and cleanup any EC resources.
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 (void)
 Shutdown.
virtual void save_persistent (TAO_Notify::Topology_Saver &saver)
virtual
TAO_Notify::Topology_Object
load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs)
 Create a child of the appropriate type and return it.
virtual void reconnect (void)
virtual void validate ()
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
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 Member Functions

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

Private Attributes

ACE_Auto_Ptr
< TAO_Notify_Proxy_Container
proxy_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

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.

Definition at line 97 of file Admin.h.


Constructor & Destructor Documentation

TAO_Notify_Admin::TAO_Notify_Admin (  ) 

Constructor.

Definition at line 35 of file Admin.cpp.

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

TAO_Notify_Admin::~TAO_Notify_Admin (  )  [virtual]

Destructor.

Definition at line 46 of file Admin.cpp.

{
}


Member Function Documentation

void TAO_Notify_Admin::cleanup_proxy ( TAO_Notify_Proxy proxy,
bool  is_supplier,
bool  experienced_timeout 
)

Remove type from container_ and cleanup any EC resources.

Definition at line 74 of file Admin.cpp.

{
  // We must clean up the proxy before calling remove.  Doing it in the
  // opposite order causes us to use invalid memory (through the call of
  // id() into the proxy).
  ec_->cleanup_proxy (proxy->id(), is_supplier, experienced_timeout);

  this->remove (proxy);
}

TAO_Notify_EventChannel * TAO_Notify_Admin::event_channel (  )  const

Definition at line 9 of file Admin.inl.

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

TAO_Notify_FilterAdmin & TAO_Notify_Admin::filter_admin ( void   ) 

Access Admin FilterAdmin.

Definition at line 16 of file Admin.inl.

{
  return this->filter_admin_;
}

void TAO_Notify_Admin::filter_operator ( CosNotifyChannelAdmin::InterFilterGroupOperator  filter_operator  ) 

Set Filter operator.

Definition at line 22 of file Admin.inl.

{
  this->filter_operator_ = filter_operator;
}

CosNotifyChannelAdmin::InterFilterGroupOperator TAO_Notify_Admin::filter_operator ( void   ) 

Access Filter operator.

Definition at line 28 of file Admin.inl.

{
  return this->filter_operator_;
}

virtual const char* TAO_Notify_Admin::get_admin_type_name ( void   )  const [protected, pure virtual]
void TAO_Notify_Admin::init ( TAO_Notify::Topology_Parent parent  ) 

Init.

Definition at line 51 of file Admin.cpp.

{
  ACE_ASSERT (this->ec_.get() == 0);

  this->ec_.reset (dynamic_cast<TAO_Notify_EventChannel *>(parent));
  ACE_ASSERT (this->ec_.get() != 0);

  filter_admin_.event_channel (this->ec_.get ());

  // this-> on the following line confuses VC6
  initialize (parent);

  TAO_Notify_Proxy_Container* proxy_container = 0;
  ACE_NEW_THROW_EX (proxy_container,
                    TAO_Notify_Proxy_Container (),
                    CORBA::INTERNAL ());
  this->proxy_container_.reset (proxy_container);

  this->proxy_container().init ();

}

void TAO_Notify_Admin::insert ( TAO_Notify_Proxy proxy  ) 

Insert the proxy in the <proxy_container_>.

Definition at line 118 of file Admin.cpp.

{
  this->proxy_container().insert (proxy);
}

bool TAO_Notify_Admin::is_default ( void   )  const

Definition at line 42 of file Admin.inl.

{
  return this->is_default_;
}

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

Definition at line 170 of file Admin.cpp.

{
  TAO_Notify_Object::load_attrs (attrs);
  const char* value = 0;
  if (attrs.find ("InterFilterGroupOperator", value))
    {
      this->filter_operator_ = static_cast <CosNotifyChannelAdmin::InterFilterGroupOperator> (ACE_OS::atoi (value));
    }

  if (attrs.find ("default", value))
    {
      this->is_default_ = (ACE_OS::strcmp (value, "yes") == 0);
    }
}

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

Create a child of the appropriate type and return it.

Use "type" as passed in to determine what kind of child (supporting the Topology_Object interface) to create and return. Inform it of its new ID.

Reimplemented from TAO_Notify::Topology_Object.

Reimplemented in TAO_Notify_ConsumerAdmin, and TAO_Notify_SupplierAdmin.

Definition at line 186 of file Admin.cpp.

{
  ACE_UNUSED_ARG (attrs);
  TAO_Notify::Topology_Object* result = this;
  if (type == "subscriptions")
    {
      if (DEBUG_LEVEL)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("(%P|%t) Admin reload subscription %d\n"),
                    static_cast<int> (id)
                    ));
      // since we initialized our subscribed types to everything
      // in the constructor. we have to clear it out first.
      this->subscribed_types_.reset();
      result = &this->subscribed_types_;
    }
  else if (type == "filter_admin")
    {
      if (DEBUG_LEVEL)
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("(%P|%t) Admin reload filter_admin %d\n"),
                    static_cast<int> (id)
                    ));
      result = & this->filter_admin_;
    }
  return result;
}

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

Definition at line 48 of file Admin.inl.

void TAO_Notify_Admin::reconnect ( void   )  [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 217 of file Admin.cpp.

void TAO_Notify_Admin::remove ( TAO_Notify_Proxy proxy  )  [private]

Remove type from container_.

Definition at line 87 of file Admin.cpp.

{
  this->proxy_container().remove (proxy);
}

void TAO_Notify_Admin::save_attrs ( TAO_Notify::NVPList attrs  )  [protected]

Definition at line 158 of file Admin.cpp.

{
  TAO_Notify_Object::save_attrs(attrs);
  attrs.push_back(TAO_Notify::NVP("InterFilterGroupOperator",
                                  this->filter_operator_));
  if (this->is_default_)
    {
      attrs.push_back (TAO_Notify::NVP ("default", "yes"));
    }
}

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); for all children { if (want_all_children || child.is_changed()) { child.save_persistent(saver); } } for all deleted children { saver.delete_child(child_type, child_id); } saver.end_object(this->id(), type); )

Implements TAO_Notify::Topology_Savable.

Definition at line 124 of file Admin.cpp.

{
  bool changed = this->children_changed_;
  this->children_changed_ = false;
  this->self_changed_ = false;

  if (is_persistent ())
    {
      TAO_Notify::NVPList attrs;
      this->save_attrs(attrs);

      const char* type = this->get_admin_type_name();

      bool want_all_children =
        saver.begin_object(this->id(), type, attrs, changed);

      if (want_all_children || this->filter_admin_.is_changed ())
        {
          this->filter_admin_.save_persistent(saver);
        }
      if (want_all_children || this->subscribed_types_.is_changed ())
        {
          this->subscribed_types_.save_persistent(saver);
        }

      TAO_Notify::Save_Persist_Worker<TAO_Notify_Proxy>
        wrk(saver, want_all_children);
      this->proxy_container().collection()->for_each(&wrk);

      saver.end_object(this->id(), type);
    }
}

void TAO_Notify_Admin::set_default ( bool  is_default  ) 

Definition at line 35 of file Admin.inl.

{
  this->is_default_ = is_default;
}

int TAO_Notify_Admin::shutdown ( void   )  [virtual]

Shutdown.

Definition at line 107 of file Admin.cpp.

{
  if (TAO_Notify_Object::shutdown () == 1)
    return 1;

  this->proxy_container().shutdown ();

  return 0;
}

void TAO_Notify_Admin::subscribed_types ( TAO_Notify_EventTypeSeq subscribed_types  ) 

Obtain the Admin's subscribed types.

Definition at line 93 of file Admin.cpp.

{
  ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
                      CORBA::INTERNAL ());

  // Adopt the Admin's subscription.
  TAO_Notify_EventTypeSeq added (this->subscribed_types_), removed;

  added.add_and_remove (subscribed_types, removed);

  subscribed_types = added;
}

void TAO_Notify_Admin::validate (  )  [virtual]

Definition at line 224 of file Admin.cpp.


Friends And Related Function Documentation

friend class TAO_Notify_Builder [friend]

Definition at line 42 of file Admin.h.


Member Data Documentation

= Data Members

The EventChannel.

Definition at line 103 of file Admin.h.

Filter Administration.

Definition at line 109 of file Admin.h.

Filter operator.

Definition at line 112 of file Admin.h.

Definition at line 114 of file Admin.h.

The Proxy Container.

Definition at line 120 of file Admin.h.

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

Definition at line 106 of file Admin.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines