TAO_Notify_EventChannelFactory Class Reference

Implementation of CosNotifyChannelAdmin::EventChannelFactory. More...

#include <EventChannelFactory.h>

Inheritance diagram for TAO_Notify_EventChannelFactory:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_EventChannelFactory:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_EventChannelFactory
Ptr

Public Member Functions

 TAO_Notify_EventChannelFactory (void)
 Constuctor.

void init (PortableServer::POA_ptr poa)
 Init the factory.

virtual ~TAO_Notify_EventChannelFactory ()
 Destructor.

virtual void _add_ref (void)
 = ServantBase Methods

virtual void _remove_ref (void)
virtual void remove (TAO_Notify_EventChannel *channel)
 Remove from the .

virtual CosNotifyFilter::FilterFactory_ptr get_default_filter_factory ()
 Accesor for the default filter factory shared by all EC's.

virtual CosNotifyChannelAdmin::EventChannel_ptr create_named_channel (const CosNotification::QoSProperties &initial_qos, const CosNotification::AdminProperties &initial_admin, CosNotifyChannelAdmin::ChannelID_out id, const char *name)
void load_topology (void)
void set_topology_factory (TAO_Notify::Topology_Factory *sf)
virtual bool is_persistent () const
 Should this object be saved?

virtual void save_persistent (TAO_Notify::Topology_Saver &saver)
virtual bool change_to_parent (void)
 Send change to parent.

virtual TAO_Notify::Topology_Objectload_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs)
CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void)
virtual void reconnect (void)
bool handle_change (void)
 handle change notifications

void load_event_persistence (void)
virtual void save_topology (void)
TAO_Notify_ProxyConsumerfind_proxy_consumer (TAO_Notify::IdVec &id_path, size_t position)
TAO_Notify_ProxySupplierfind_proxy_supplier (TAO_Notify::IdVec &id_path, size_t position)
TAO_Notify_Objectfollow_id_path (TAO_Notify::IdVec &id_path, size_t position)
virtual TAO_Notify_Object::ID get_id () const
 Find the id associated with topology object.


Protected Member Functions

virtual::CosNotifyChannelAdmin::EventChannel_ptr create_channel (const CosNotification::QoSProperties &initial_qos, const CosNotification::AdminProperties &initial_admin, CosNotifyChannelAdmin::ChannelID_out id)
 = CosNotifyChannelAdmin Methods

virtual::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels ()
virtual::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel (CosNotifyChannelAdmin::ChannelID id)

Private Types

typedef ACE_Unbounded_Set<
TAO_Notify::Routing_Slip_Ptr
Routing_Slip_Set
typedef TAO_Notify_Container_T<
TAO_Notify_EventChannel
TAO_Notify_EventChannel_Container

Private Member Functions

virtual void destroy (void)
 = NotifyExt methods

virtual int shutdown (void)
 shutdown

virtual NotifyExt::ReconnectionRegistry::ReconnectionID register_callback (NotifyExt::ReconnectionCallback_ptr reconnection)
virtual void unregister_callback (NotifyExt::ReconnectionRegistry::ReconnectionID id)
virtual CORBA::Boolean is_alive (void)
TAO_Notify_EventChannel_Containerec_container ()
virtual void release (void)
 Release this object.


Private Attributes

CosNotifyFilter::FilterFactory_var default_filter_factory_
 = Data Members The default filter factory.

ACE_Auto_Ptr< TAO_Notify_EventChannel_Containerec_container_
 Container for Event Channels.

TAO_SYNCH_MUTEX topology_save_lock_
CosNotifyChannelAdmin::EventChannelFactory_var channel_factory_
short topology_save_seq_
 change-in-progress detector to avoid duplicates

TAO_Notify::Topology_Factorytopology_factory_
TAO_Notify::Reconnection_Registry reconnect_registry_
bool loading_topology_
Routing_Slip_Set routing_slip_restart_set_

Friends

class TAO_Notify_Builder

Detailed Description

Implementation of CosNotifyChannelAdmin::EventChannelFactory.

Definition at line 47 of file EventChannelFactory.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_EventChannelFactory > TAO_Notify_EventChannelFactory::Ptr
 

Reimplemented from TAO_Notify_Refcountable.

Definition at line 56 of file EventChannelFactory.h.

typedef ACE_Unbounded_Set<TAO_Notify::Routing_Slip_Ptr> TAO_Notify_EventChannelFactory::Routing_Slip_Set [private]
 

Definition at line 53 of file EventChannelFactory.h.

typedef TAO_Notify_Container_T<TAO_Notify_EventChannel> TAO_Notify_EventChannelFactory::TAO_Notify_EventChannel_Container [private]
 

Definition at line 162 of file EventChannelFactory.h.

Referenced by init().


Constructor & Destructor Documentation

TAO_Notify_EventChannelFactory::TAO_Notify_EventChannelFactory void   ) 
 

Constuctor.

Definition at line 50 of file EventChannelFactory.cpp.

00051   : topology_save_seq_ (0)
00052   , topology_factory_(0)
00053   , reconnect_registry_(*this)
00054   , loading_topology_ (false)
00055 {
00056 }

TAO_Notify_EventChannelFactory::~TAO_Notify_EventChannelFactory  )  [virtual]
 

Destructor.

Definition at line 58 of file EventChannelFactory.cpp.

00059 {
00060 }


Member Function Documentation

void TAO_Notify_EventChannelFactory::_add_ref void   )  [virtual]
 

= ServantBase Methods

Definition at line 124 of file EventChannelFactory.cpp.

References TAO_Notify_Refcountable::_incr_refcnt().

00125 {
00126   this->_incr_refcnt ();
00127 }

void TAO_Notify_EventChannelFactory::_remove_ref void   )  [virtual]
 

Definition at line 130 of file EventChannelFactory.cpp.

References TAO_Notify_Refcountable::_decr_refcnt().

00131 {
00132   this->_decr_refcnt ();
00133 }

CosNotifyChannelAdmin::EventChannelFactory_ptr TAO_Notify_EventChannelFactory::activate_self void   ) 
 

Definition at line 480 of file EventChannelFactory.cpp.

References ACE_DEBUG, ACE_TEXT(), TAO_Notify_Object::activate(), channel_factory_, DEBUG_LEVEL, LM_DEBUG, and reconnect().

Referenced by TAO_Notify_Builder::build_event_channel_factory().

00481 {
00482   CORBA::Object_var obj = this->activate (this);
00483   this->channel_factory_
00484     = CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in());
00485 
00486   try
00487   {
00488     if (DEBUG_LEVEL > 9)
00489     {
00490       ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) TAO_Notify_EventChannelFactory::activate_self") ));
00491     }
00492     this->reconnect ();
00493   }
00494   catch (const CORBA::Exception&)
00495   {
00496     // ignore for now
00497   }
00498   return this->channel_factory_._retn();
00499 }

bool TAO_Notify_EventChannelFactory::change_to_parent void   )  [virtual]
 

Send change to parent.

Override this if you don't expect to have a parent (top level of tree) private virtual because this should only be called from send_change()

Returns:
false if save will never happen

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 317 of file EventChannelFactory.cpp.

References ACE_GUARD_THROW_EX, ACE_Auto_Basic_Ptr< X >::get(), loading_topology_, save_persistent(), TAO_SYNCH_MUTEX, topology_factory_, and topology_save_seq_.

00318 {
00319   bool saving = false;
00320   if (! this->loading_topology_)
00321   {
00322     // A null pointer means that saving of topology is disabled.
00323     if (this->topology_factory_ != 0)
00324     {
00325       saving = true;
00326       // seq is used to check save-in-progress
00327       // if it changes while we're waiting for the lock
00328       // then our change may have already been saved, so
00329       // just return.  Caller will signal change again if necessary.
00330       short seq = this->topology_save_seq_;
00331       ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->topology_save_lock_, CORBA::INTERNAL ());
00332       if (seq == this->topology_save_seq_)
00333       {
00334         auto_ptr<TAO_Notify::Topology_Saver> saver(this->topology_factory_->create_saver());
00335         if (saver.get() != 0)
00336         {
00337           this->save_persistent(*saver);
00338           saver->close ();
00339         }
00340         this->topology_save_seq_ += 1;
00341       }
00342     }
00343   }
00344   return saving;
00345 }

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_channel const CosNotification::QoSProperties initial_qos,
const CosNotification::AdminProperties initial_admin,
CosNotifyChannelAdmin::ChannelID_out  id
[protected, virtual]
 

= CosNotifyChannelAdmin Methods

Definition at line 178 of file EventChannelFactory.cpp.

References CosNotification::AdminProperties, TAO_Notify_Builder::build_event_channel(), TAO_Notify_Properties::builder(), TAO_Notify_Properties::instance(), CosNotification::QoSProperties, and TAO_Notify::Topology_Object::self_change().

Referenced by create_named_channel().

00183 {
00184   CosNotifyChannelAdmin::EventChannel_var ec =
00185     TAO_Notify_PROPERTIES::instance()->builder()->build_event_channel (this
00186                                                                         , initial_qos
00187                                                                         , initial_admin
00188                                                                         , id);
00189   this->self_change ();
00190   return ec._retn ();
00191 }

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_named_channel const CosNotification::QoSProperties initial_qos,
const CosNotification::AdminProperties initial_admin,
CosNotifyChannelAdmin::ChannelID_out  id,
const char *  name
[virtual]
 

This method is called by the Notify_Service when the event channel is automatically created and bound in the name service.

Definition at line 169 of file EventChannelFactory.cpp.

References CosNotification::AdminProperties, create_channel(), and CosNotification::QoSProperties.

00174 {
00175   return this->create_channel (initial_qos, initial_admin, id);
00176 }

void TAO_Notify_EventChannelFactory::destroy void   )  [private, virtual]
 

= NotifyExt methods

Definition at line 63 of file EventChannelFactory.cpp.

References TAO_Notify_Properties::default_poa(), ec_container_, TAO_Notify_Properties::instance(), TAO_Notify_Properties::orb(), ACE_Auto_Basic_Ptr< X >::reset(), and shutdown().

00064 {
00065   int result = this->shutdown ();
00066   if ( result == 1)
00067     return;
00068 
00069   TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance();
00070 
00071   // Reset references to CORBA objects.
00072   properties->orb (CORBA::ORB::_nil ());
00073   properties->default_poa (PortableServer::POA::_nil ());
00074 
00075   ec_container_.reset( 0 );
00076 }

TAO_Notify_EventChannelFactory::TAO_Notify_EventChannel_Container & TAO_Notify_EventChannelFactory::ec_container  )  [private]
 

Definition at line 509 of file EventChannelFactory.cpp.

References ACE_ASSERT, and ec_container_.

Referenced by TAO_Notify_Builder::build_event_channel(), init(), reconnect(), remove(), save_persistent(), and shutdown().

00510 {
00511   ACE_ASSERT( this->ec_container_.get() != 0 );
00512   return *ec_container_;
00513 }

TAO_Notify_ProxyConsumer * TAO_Notify_EventChannelFactory::find_proxy_consumer TAO_Notify::IdVec id_path,
size_t  position
 

Definition at line 429 of file EventChannelFactory.cpp.

References TAO_Notify_Find_Worker_T< TYPE, INTERFACE, INTERFACE_PTR, EXCEPTION >::find(), TAO_Notify_EventChannel::find_proxy_consumer(), TAO_Notify_Object::id(), TAO_Notify::IdVec, ACE_Vector< T, DEFAULT_SIZE >::size(), TAO_Notify_EventChannel, and TAO_Notify_EventChannel_Find_Worker.

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

00430 {
00431   TAO_Notify_ProxyConsumer * result = 0;
00432   size_t path_size = id_path.size ();
00433 
00434   // EventChannelFactory only:  The first id is proably for the ECF itself
00435   // if so, silently consume it.
00436   if (position < path_size && id_path[position] == this->id())
00437   {
00438     ++position;
00439   }
00440   if (position < path_size)
00441   {
00442     TAO_Notify_EventChannel_Find_Worker find_worker;
00443 
00444     TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container());
00445     ++position;
00446     if (ec != 0)
00447     {
00448       result = ec->find_proxy_consumer (id_path, position);
00449     }
00450   }
00451   return result;
00452 }

TAO_Notify_ProxySupplier * TAO_Notify_EventChannelFactory::find_proxy_supplier TAO_Notify::IdVec id_path,
size_t  position
 

Definition at line 455 of file EventChannelFactory.cpp.

References TAO_Notify_Find_Worker_T< TYPE, INTERFACE, INTERFACE_PTR, EXCEPTION >::find(), TAO_Notify_EventChannel::find_proxy_supplier(), TAO_Notify_Object::id(), TAO_Notify::IdVec, ACE_Vector< T, DEFAULT_SIZE >::size(), TAO_Notify_EventChannel, and TAO_Notify_EventChannel_Find_Worker.

Referenced by TAO_Notify_Method_Request_Dispatch::unmarshal().

00456 {
00457   TAO_Notify_ProxySupplier * result = 0;
00458   size_t path_size = id_path.size ();
00459 
00460   // EventChannelFactory only:  The first id is proably for the ECF itself
00461   // if so, silently consume it.
00462   if (position < path_size && id_path[position] == this->id())
00463   {
00464     ++position;
00465   }
00466   if (position < path_size)
00467   {
00468     TAO_Notify_EventChannel_Find_Worker find_worker;
00469     TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container());
00470     ++position;
00471     if (ec != 0)
00472     {
00473       result = ec->find_proxy_supplier (id_path, position);
00474     }
00475   }
00476   return result;
00477 }

TAO_Notify_Object* TAO_Notify_EventChannelFactory::follow_id_path TAO_Notify::IdVec id_path,
size_t  position
 

CosNotifyChannelAdmin::ChannelIDSeq * TAO_Notify_EventChannelFactory::get_all_channels  )  [protected]
 

Definition at line 194 of file EventChannelFactory.cpp.

References TAO_Notify_Seq_Worker_T< TYPE >::create(), and TAO_Notify_EventChannel_Seq_Worker.

00195 {
00196   TAO_Notify_EventChannel_Seq_Worker seq_worker;
00197 
00198   return seq_worker.create (this->ec_container());
00199 }

CosNotifyFilter::FilterFactory_ptr TAO_Notify_EventChannelFactory::get_default_filter_factory  )  [virtual]
 

Accesor for the default filter factory shared by all EC's.

Definition at line 163 of file EventChannelFactory.cpp.

00164 {
00165   return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ());
00166 }

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::get_event_channel CosNotifyChannelAdmin::ChannelID  id  )  [protected]
 

Definition at line 202 of file EventChannelFactory.cpp.

References CosNotifyChannelAdmin::ChannelID, TAO_Notify_Find_Worker_T< TYPE, INTERFACE, INTERFACE_PTR, EXCEPTION >::resolve(), and TAO_Notify_EventChannel_Find_Worker.

00203 {
00204   TAO_Notify_EventChannel_Find_Worker find_worker;
00205 
00206   return find_worker.resolve (id, this->ec_container());
00207 }

TAO_Notify_Object::ID TAO_Notify_EventChannelFactory::get_id  )  const [virtual]
 

Find the id associated with topology object.

A bit of a hack because id is unknown to Topology_Object the get_id returns the same thing as id -- we just need someone to find it for us.

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 503 of file EventChannelFactory.cpp.

References TAO_Notify_Object::id().

00504 {
00505   return id();
00506 }

bool TAO_Notify_EventChannelFactory::handle_change void   ) 
 

handle change notifications

void TAO_Notify_EventChannelFactory::init PortableServer::POA_ptr  poa  ) 
 

Init the factory.

Definition at line 79 of file EventChannelFactory.cpp.

References ACE_ASSERT, ACE_CString, ACE_NEW_THROW_EX, TAO_Notify_Object::adopt_poa(), TAO_Notify_Builder::build_filter_factory(), TAO_Notify_Properties::builder(), default_filter_factory_, ec_container(), ec_container_, TAO_Notify_POA_Helper::get_unique_id(), TAO_Notify_POA_Helper::init(), TAO_Notify_Container_T< TYPE >::init(), TAO_Notify_POA_Helper::init_persistent(), TAO_Notify_Properties::instance(), load_event_persistence(), load_topology(), ACE_Auto_Basic_Ptr< X >::release(), ACE_Auto_Basic_Ptr< X >::reset(), TAO_Notify_EventChannel_Container, and topology_factory_.

Referenced by TAO_Notify_Builder::build_event_channel_factory().

00080 {
00081   ACE_ASSERT (this->ec_container_.get() == 0);
00082 
00083   this->default_filter_factory_ =
00084     TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory ();
00085 
00086   // Init ec_container_
00087   TAO_Notify_EventChannel_Container* ecc = 0;
00088   ACE_NEW_THROW_EX (ecc,
00089                     TAO_Notify_EventChannel_Container (),
00090                     CORBA::INTERNAL ());
00091   this->ec_container_.reset( ecc );
00092 
00093   this->ec_container().init ();
00094 
00095   TAO_Notify_POA_Helper* object_poa = 0;
00096 
00097   // Bootstrap initial Object POA
00098   ACE_NEW_THROW_EX (object_poa,
00099                     TAO_Notify_POA_Helper (),
00100                     CORBA::NO_MEMORY ());
00101 
00102   ACE_Auto_Ptr<TAO_Notify_POA_Helper> auto_object_poa (object_poa);
00103 
00104   ACE_CString poa_name = object_poa->get_unique_id ();
00105 #if defined (CORBA_E_MICRO)
00106   object_poa->init (poa, poa_name.c_str ());
00107 #else
00108   object_poa->init_persistent (poa, poa_name.c_str ());
00109 #endif /* CORBA_E_MICRO */
00110 
00111   this->adopt_poa (auto_object_poa.release ());
00112 
00113   // Note topology factory is configured separately from the "builder" mediated
00114   // objects since it is independant of the "style" of Notification Service.
00115   this->topology_factory_ =
00116     ACE_Dynamic_Service <TAO_Notify::Topology_Factory>::instance ("Topology_Factory");
00117 
00118   this->load_topology ();
00119 
00120   this->load_event_persistence ();
00121 }

CORBA::Boolean TAO_Notify_EventChannelFactory::is_alive void   )  [private, virtual]
 

Definition at line 417 of file EventChannelFactory.cpp.

References CORBA::Boolean.

00418 {
00419   return CORBA::Boolean (1);
00420 }

bool TAO_Notify_EventChannelFactory::is_persistent  )  const [virtual]
 

Should this object be saved?

This is a way for send_change() and save_persistent() to find out if this object has a persistent QoS connection property.

Returns:
true (default) if object should be saved.

Reimplemented from TAO_Notify::Topology_Object.

Definition at line 242 of file EventChannelFactory.cpp.

00243 {
00244   return true;
00245 }

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

Definition at line 348 of file EventChannelFactory.cpp.

References ACE_DEBUG, ACE_TEXT(), TAO_Notify_Builder::build_event_channel(), TAO_Notify_Properties::builder(), DEBUG_LEVEL, TAO_Notify_Properties::instance(), LM_DEBUG, TAO_Notify_EventChannel::load_attrs(), reconnect_registry_, and TAO_Notify_EventChannel.

00352 {
00353   // ignore anything but our valid children (ie channel)
00354   TAO_Notify::Topology_Object * result = this;
00355   if (type == "channel")
00356   {
00357     if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG,
00358       ACE_TEXT ("(%P|%t) EventChannelFactory reload channel %d\n")
00359       , static_cast<int> (id)
00360       ));
00361 
00362     TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder();
00363     TAO_Notify_EventChannel * ec = bld->build_event_channel(
00364         this ,
00365         id);
00366 
00367     ec->load_attrs (attrs);
00368 
00369     result = ec;
00370   }
00371   else if (type == TAO_Notify::REGISTRY_TYPE)
00372   {
00373     result = & this->reconnect_registry_;
00374   }
00375   return result;
00376 }

void TAO_Notify_EventChannelFactory::load_event_persistence void   ) 
 

Definition at line 274 of file EventChannelFactory.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), TAO_Notify::Routing_Slip::create(), TAO_Notify::Event_Persistence_Factory::first_reload_manager(), TAO_Notify::Event_Persistence_Strategy::get_factory(), ACE_Unbounded_Set< T >::insert(), LM_DEBUG, LM_ERROR, TAO_Notify::Routing_Slip_Persistence_Manager::load_next(), ACE_Strong_Bound_Ptr< X, ACE_LOCK >::null(), TAO_Notify::Routing_Slip_Ptr, routing_slip_restart_set_, and topology_factory_.

Referenced by init().

00275 {
00276   TAO_Notify::Event_Persistence_Strategy * strategy =
00277     ACE_Dynamic_Service <TAO_Notify::Event_Persistence_Strategy>::instance ("Event_Persistence");
00278   if (strategy != 0)
00279   {
00280     if (this->topology_factory_ != 0)
00281     {
00282       TAO_Notify::Event_Persistence_Factory * factory = strategy->get_factory ();
00283       if (factory != 0)
00284       {
00285         for (
00286           TAO_Notify::Routing_Slip_Persistence_Manager * rspm = factory->first_reload_manager();
00287           rspm != 0;
00288           rspm = rspm->load_next ())
00289         {
00290           TAO_Notify::Routing_Slip_Ptr routing_slip = TAO_Notify::Routing_Slip::create (*this, rspm);
00291           if (!routing_slip.null ())
00292           {
00293             this->routing_slip_restart_set_.insert (routing_slip);
00294           }
00295           else
00296           {
00297             //@@todo: tell the rspm it's an orphan, but we can't during reload
00298             // we need collect these and come back later to remove them
00299             ACE_DEBUG ((LM_DEBUG,
00300               ACE_TEXT ("(%P|%t) Reload persistent event failed.\n")
00301               ));
00302           }
00303         }
00304       }
00305     }
00306     else
00307     {
00308       ACE_ERROR ((LM_ERROR,
00309         ACE_TEXT ("(%P|%t) Notify Service: Configuration error.  Event Persistence requires Topology Persistence.\n")
00310         ));
00311       throw CORBA::PERSIST_STORE();
00312     }
00313   }
00314 }

void TAO_Notify_EventChannelFactory::load_topology void   ) 
 

Use the registered Topology_Factory to create a loader, and load the topology. If no Topology_Factory is registered then nothing will be loaded.

Definition at line 222 of file EventChannelFactory.cpp.

References ACE_DEBUG, ACE_TEXT(), ACE_Auto_Basic_Ptr< X >::get(), LM_DEBUG, loading_topology_, TAO_debug_level, and topology_factory_.

Referenced by init().

00223 {
00224   this->loading_topology_ = true;
00225   if (this->topology_factory_ != 0)
00226   {
00227     // create_loader will open and load the persistence file for validation
00228     auto_ptr<TAO_Notify::Topology_Loader> tl(this->topology_factory_->create_loader());
00229     if (tl.get () != 0)
00230     {
00231       tl->load (this);
00232     }
00233   }
00234   else
00235   {
00236     if (TAO_debug_level > 0)
00237       ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Topology persistence disabled.\n")));
00238   }
00239   this->loading_topology_ = false;
00240 }

void TAO_Notify_EventChannelFactory::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 379 of file EventChannelFactory.cpp.

References ACE_ASSERT, TAO_Notify_Container_T< TYPE >::collection(), ec_container(), reconnect_registry_, ACE_Unbounded_Set< T >::reset(), TAO_Notify::Routing_Slip_Ptr, routing_slip_restart_set_, and TAO_Notify::Reconnection_Registry::send_reconnect().

Referenced by activate_self().

00380 {
00381   // Reconnect all children first
00382   TAO_Notify::Reconnect_Worker<TAO_Notify_EventChannel> wrk;
00383 
00384   this->ec_container().collection()->for_each(&wrk);
00385 
00386   // Then send reconnection announcement to registered clients
00387   ACE_ASSERT (!CORBA::is_nil (this->channel_factory_.in ()));
00388   this->reconnect_registry_.send_reconnect (this->channel_factory_.in ());
00389 
00390   // reactivate events in-progress
00391   Routing_Slip_Set::CONST_ITERATOR iter (this->routing_slip_restart_set_);
00392   TAO_Notify::Routing_Slip_Ptr * routing_slip;
00393   for (iter.first(); iter.next(routing_slip); iter.advance())
00394   {
00395     (*routing_slip)->reconnect();
00396   }
00397   this->routing_slip_restart_set_.reset ();
00398 }

NotifyExt::ReconnectionRegistry::ReconnectionID TAO_Notify_EventChannelFactory::register_callback NotifyExt::ReconnectionCallback_ptr  reconnection  )  [private, virtual]
 

Definition at line 401 of file EventChannelFactory.cpp.

References reconnect_registry_, and TAO_Notify::Reconnection_Registry::register_callback().

00403 {
00404   return this->reconnect_registry_.register_callback (
00405     reconnection);
00406 }

void TAO_Notify_EventChannelFactory::release void   )  [private, virtual]
 

Release this object.

Implements TAO_Notify_Refcountable.

Definition at line 136 of file EventChannelFactory.cpp.

00137 {
00138   delete this;
00139   //@@ inform factory
00140 }

void TAO_Notify_EventChannelFactory::remove TAO_Notify_EventChannel channel  )  [virtual]
 

Remove from the .

Definition at line 143 of file EventChannelFactory.cpp.

References ec_container(), TAO_Notify_Container_T< TYPE >::remove(), and TAO_Notify::Topology_Object::self_change().

00144 {
00145   this->ec_container().remove (event_channel);
00146   this->self_change ();
00147 }

void TAO_Notify_EventChannelFactory::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 248 of file EventChannelFactory.cpp.

References TAO_Notify::Topology_Saver::begin_object(), TAO_Notify_Container_T< TYPE >::collection(), ec_container(), TAO_Notify::Topology_Saver::end_object(), TAO_Notify::Topology_Object::is_changed(), reconnect_registry_, and TAO_Notify::Reconnection_Registry::save_persistent().

Referenced by change_to_parent().

00249 {
00250   bool changed = this->self_changed_;
00251   this->self_changed_ = false;
00252   this->children_changed_ = false;
00253 
00254   TAO_Notify::NVPList attrs; // ECF has no attributes
00255 
00256   bool want_all_children =
00257     saver.begin_object(0, "channel_factory", attrs, changed);
00258 
00259   // for each deleted child
00260   //  delete_child  // if the child has persistence.
00261 
00262   TAO_Notify::Save_Persist_Worker<TAO_Notify_EventChannel> wrk(saver, want_all_children);
00263 
00264   this->ec_container().collection()->for_each(&wrk);
00265 
00266   if (want_all_children || this->reconnect_registry_.is_changed ())
00267   {
00268     this->reconnect_registry_.save_persistent(saver);
00269   }
00270   saver.end_object(0, "channel_factory");
00271 }

void TAO_Notify_EventChannelFactory::save_topology void   )  [virtual]
 

Definition at line 423 of file EventChannelFactory.cpp.

References TAO_Notify::Topology_Object::self_change().

00424 {
00425   this->self_change ();
00426 }

void TAO_Notify_EventChannelFactory::set_topology_factory TAO_Notify::Topology_Factory sf  ) 
 

Use the passed in saver factory to generate topology saver objects. Does not take ownership.

Definition at line 210 of file EventChannelFactory.cpp.

References ACE_DEBUG, ACE_TEXT(), LM_DEBUG, and topology_factory_.

00211 {
00212   ACE_DEBUG ((LM_DEBUG,
00213     ACE_TEXT ("(%P,%t) Debug Topology_Factory installed in EventChannelFactory.\n")
00214     ));
00215   // If the above meessage appears when you don't expect it
00216   // use svc.conf to install the topology factory rather
00217   // than calling this method.
00218   this->topology_factory_ = f;
00219 }

int TAO_Notify_EventChannelFactory::shutdown void   )  [private, virtual]
 

shutdown

Reimplemented from TAO_Notify_Object.

Definition at line 150 of file EventChannelFactory.cpp.

References ec_container(), TAO_Notify_Container_T< TYPE >::shutdown(), and TAO_Notify_Object::shutdown().

Referenced by destroy().

00151 {
00152   int sd_ret = TAO_Notify_Object::shutdown ();
00153 
00154   if (sd_ret == 1)
00155     return 1;
00156 
00157   this->ec_container().shutdown ();
00158 
00159   return 0;
00160 }

void TAO_Notify_EventChannelFactory::unregister_callback NotifyExt::ReconnectionRegistry::ReconnectionID  id  )  [private, virtual]
 

Definition at line 409 of file EventChannelFactory.cpp.

References reconnect_registry_, and TAO_Notify::Reconnection_Registry::unregister_callback().

00411 {
00412   this->reconnect_registry_.unregister_callback (
00413     id);
00414 }


Friends And Related Function Documentation

friend class TAO_Notify_Builder [friend]
 

Reimplemented from TAO_Notify_Object.

Definition at line 52 of file EventChannelFactory.h.


Member Data Documentation

CosNotifyChannelAdmin::EventChannelFactory_var TAO_Notify_EventChannelFactory::channel_factory_ [private]
 

Definition at line 171 of file EventChannelFactory.h.

Referenced by activate_self().

CosNotifyFilter::FilterFactory_var TAO_Notify_EventChannelFactory::default_filter_factory_ [private]
 

= Data Members The default filter factory.

Definition at line 129 of file EventChannelFactory.h.

Referenced by init().

ACE_Auto_Ptr< TAO_Notify_EventChannel_Container > TAO_Notify_EventChannelFactory::ec_container_ [private]
 

Container for Event Channels.

Definition at line 167 of file EventChannelFactory.h.

Referenced by destroy(), ec_container(), and init().

bool TAO_Notify_EventChannelFactory::loading_topology_ [private]
 

Definition at line 177 of file EventChannelFactory.h.

Referenced by change_to_parent(), and load_topology().

TAO_Notify::Reconnection_Registry TAO_Notify_EventChannelFactory::reconnect_registry_ [private]
 

Definition at line 176 of file EventChannelFactory.h.

Referenced by load_child(), reconnect(), register_callback(), save_persistent(), and unregister_callback().

Routing_Slip_Set TAO_Notify_EventChannelFactory::routing_slip_restart_set_ [private]
 

Definition at line 179 of file EventChannelFactory.h.

Referenced by load_event_persistence(), and reconnect().

TAO_Notify::Topology_Factory* TAO_Notify_EventChannelFactory::topology_factory_ [private]
 

Definition at line 175 of file EventChannelFactory.h.

Referenced by change_to_parent(), init(), load_event_persistence(), load_topology(), and set_topology_factory().

TAO_SYNCH_MUTEX TAO_Notify_EventChannelFactory::topology_save_lock_ [private]
 

Definition at line 169 of file EventChannelFactory.h.

short TAO_Notify_EventChannelFactory::topology_save_seq_ [private]
 

change-in-progress detector to avoid duplicates

Definition at line 174 of file EventChannelFactory.h.

Referenced by change_to_parent().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 15:49:11 2008 for TAO_CosNotification by doxygen 1.3.6