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 ()
 = ServantBase Methods

virtual void _remove_ref ()
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.

void load_topology ()
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 ()
 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 ()
virtual void reconnect ()
bool handle_change ()
 handle change notifications

void load_event_persistence ()
virtual void save_topology () throw (CORBA::SystemException)
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.


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 () throw ( CORBA::SystemException )
 = NotifyExt methods

virtual int shutdown ()
 shutdown

virtual NotifyExt::ReconnectionRegistry::ReconnectionID register_callback (NotifyExt::ReconnectionCallback_ptr reconnection) throw (CORBA::SystemException)
virtual void unregister_callback (NotifyExt::ReconnectionRegistry::ReconnectionID id) throw (CORBA::SystemException)
virtual CORBA::Boolean is_alive () throw (CORBA::SystemException)
virtual::CosNotifyChannelAdmin::EventChannel_ptr create_channel (const CosNotification::QoSProperties &initial_qos, const CosNotification::AdminProperties &initial_admin, CosNotifyChannelAdmin::ChannelID_out id) throw (CORBA::SystemException, CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin)
 = CosNotifyChannelAdmin Methods

virtual::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels () throw (CORBA::SystemException)
virtual::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel (CosNotifyChannelAdmin::ChannelID id) throw (CORBA::SystemException, CosNotifyChannelAdmin::ChannelNotFound)
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 175 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  )  [virtual]
 

= ServantBase Methods

Definition at line 130 of file EventChannelFactory.cpp.

References TAO_Notify_Refcountable::_incr_refcnt().

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

void TAO_Notify_EventChannelFactory::_remove_ref  )  [virtual]
 

Definition at line 136 of file EventChannelFactory.cpp.

References TAO_Notify_Refcountable::_decr_refcnt().

00137 {
00138   this->_decr_refcnt ();
00139 }

CosNotifyChannelAdmin::EventChannelFactory_ptr TAO_Notify_EventChannelFactory::activate_self  ) 
 

Definition at line 523 of file EventChannelFactory.cpp.

References ACE_CATCHANY, ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TEXT(), ACE_TRY_CHECK, ACE_TRY_NEW_ENV, TAO_Notify_Object::activate(), channel_factory_, DEBUG_LEVEL, LM_DEBUG, and reconnect().

Referenced by TAO_Notify_Builder::build_event_channel_factory().

00524 {
00525   CORBA::Object_var obj = this->activate (this ACE_ENV_ARG_PARAMETER);
00526   ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ());
00527   this->channel_factory_
00528     = CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in() ACE_ENV_ARG_PARAMETER);
00529   ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ());
00530   CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in() ACE_ENV_ARG_PARAMETER);
00531   ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ());
00532 
00533   ACE_TRY_NEW_ENV
00534   {
00535     if (DEBUG_LEVEL > 9)
00536     {
00537       ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) TAO_Notify_EventChannelFactory::activate_self") ));
00538     }
00539     this->reconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
00540     ACE_TRY_CHECK;
00541   }
00542   ACE_CATCHANY
00543   {
00544     // ignore for now
00545   }
00546   ACE_ENDTRY;
00547   return this->channel_factory_._retn();
00548 }

bool TAO_Notify_EventChannelFactory::change_to_parent  )  [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 336 of file EventChannelFactory.cpp.

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

00337 {
00338   bool saving = false;
00339   if (! this->loading_topology_)
00340   {
00341     // A null pointer means that saving of topology is disabled.
00342     if (this->topology_factory_ != 0)
00343     {
00344       saving = true;
00345       // seq is used to check save-in-progress
00346       // if it changes while we're waiting for the lock
00347       // then our change may have already been saved, so
00348       // just return.  Caller will signal change again if necessary.
00349       short seq = this->topology_save_seq_;
00350       ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->topology_save_lock_, CORBA::INTERNAL ());
00351       ACE_CHECK_RETURN(false);
00352       if (seq == this->topology_save_seq_)
00353       {
00354         auto_ptr<TAO_Notify::Topology_Saver> saver(this->topology_factory_->create_saver());
00355         if (saver.get() != 0)
00356         {
00357           this->save_persistent(*saver ACE_ENV_ARG_PARAMETER);
00358           ACE_CHECK_RETURN(false);
00359           saver->close (ACE_ENV_SINGLE_ARG_PARAMETER);
00360           ACE_CHECK_RETURN (false);
00361         }
00362         this->topology_save_seq_ += 1;
00363       }
00364     }
00365   }
00366   return saving;
00367 }

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_channel const CosNotification::QoSProperties initial_qos,
const CosNotification::AdminProperties initial_admin,
CosNotifyChannelAdmin::ChannelID_out  id
throw (CORBA::SystemException, CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin) [private]
 

= CosNotifyChannelAdmin Methods

Definition at line 177 of file EventChannelFactory.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, CosNotification::AdminProperties, TAO_Singleton< TYPE, ACE_LOCK >::instance(), and CosNotification::QoSProperties.

00187 {
00188   CosNotifyChannelAdmin::EventChannel_var ec =
00189     TAO_Notify_PROPERTIES::instance()->builder()->build_event_channel (this
00190                                                                         , initial_qos
00191                                                                         , initial_admin
00192                                                                         , id
00193                                                                         ACE_ENV_ARG_PARAMETER);
00194   ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil());
00195   this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00196   ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil());
00197   return ec._retn ();
00198 }

void TAO_Notify_EventChannelFactory::destroy  )  throw ( CORBA::SystemException ) [private, virtual]
 

= NotifyExt methods

Definition at line 63 of file EventChannelFactory.cpp.

References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, TAO_Notify_Properties::default_poa(), TAO_Singleton< TYPE, ACE_LOCK >::instance(), and TAO_Notify_Properties::orb().

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

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

Definition at line 558 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().

00559 {
00560   ACE_ASSERT( this->ec_container_.get() != 0 );
00561   return *ec_container_;
00562 }

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

Definition at line 466 of file EventChannelFactory.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, 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().

00467 {
00468   TAO_Notify_ProxyConsumer * result = 0;
00469   size_t path_size = id_path.size ();
00470 
00471   // EventChannelFactory only:  The first id is proably for the ECF itself
00472   // if so, silently consume it.
00473   if (position < path_size && id_path[position] == this->id())
00474   {
00475     ++position;
00476   }
00477   if (position < path_size)
00478   {
00479     TAO_Notify_EventChannel_Find_Worker find_worker;
00480 
00481     TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container() ACE_ENV_ARG_PARAMETER);
00482     ACE_CHECK_RETURN (0);
00483     ++position;
00484     if (ec != 0)
00485     {
00486       result = ec->find_proxy_consumer (id_path, position
00487         ACE_ENV_ARG_PARAMETER);
00488       ACE_CHECK_RETURN(0);
00489     }
00490   }
00491   return result;
00492 }

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

Definition at line 495 of file EventChannelFactory.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, 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().

00496 {
00497   TAO_Notify_ProxySupplier * result = 0;
00498   size_t path_size = id_path.size ();
00499 
00500   // EventChannelFactory only:  The first id is proably for the ECF itself
00501   // if so, silently consume it.
00502   if (position < path_size && id_path[position] == this->id())
00503   {
00504     ++position;
00505   }
00506   if (position < path_size)
00507   {
00508     TAO_Notify_EventChannel_Find_Worker find_worker;
00509     TAO_Notify_EventChannel * ec = find_worker.find (id_path[position], this->ec_container() ACE_ENV_ARG_PARAMETER);
00510     ACE_CHECK_RETURN (0);
00511     ++position;
00512     if (ec != 0)
00513     {
00514       result = ec->find_proxy_supplier (id_path, position
00515         ACE_ENV_ARG_PARAMETER);
00516       ACE_CHECK_RETURN(0);
00517     }
00518   }
00519   return result;
00520 }

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  )  throw (CORBA::SystemException) [private]
 

Definition at line 201 of file EventChannelFactory.cpp.

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

00205 {
00206   TAO_Notify_EventChannel_Seq_Worker seq_worker;
00207 
00208   return seq_worker.create (this->ec_container() ACE_ENV_ARG_PARAMETER);
00209 }

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 172 of file EventChannelFactory.cpp.

00173 {
00174   return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ());
00175 }

CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::get_event_channel CosNotifyChannelAdmin::ChannelID  id  )  throw (CORBA::SystemException, CosNotifyChannelAdmin::ChannelNotFound) [private]
 

Definition at line 212 of file EventChannelFactory.cpp.

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

00217 {
00218   TAO_Notify_EventChannel_Find_Worker find_worker;
00219 
00220   return find_worker.resolve (id, this->ec_container() ACE_ENV_ARG_PARAMETER);
00221 }

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 552 of file EventChannelFactory.cpp.

References TAO_Notify_Object::id().

00553 {
00554   return id();
00555 }

bool TAO_Notify_EventChannelFactory::handle_change  ) 
 

handle change notifications

void TAO_Notify_EventChannelFactory::init PortableServer::POA_ptr  poa  ) 
 

Init the factory.

Definition at line 83 of file EventChannelFactory.cpp.

References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_NEW_THROW_EX, TAO_Notify_Object::adopt_poa(), default_filter_factory_, ec_container(), ec_container_, TAO_Notify_POA_Helper::init(), TAO_Notify_Container_T< TYPE >::init(), TAO_Singleton< TYPE, ACE_LOCK >::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().

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

CORBA::Boolean TAO_Notify_EventChannelFactory::is_alive  )  throw (CORBA::SystemException) [private, virtual]
 

Definition at line 451 of file EventChannelFactory.cpp.

References CORBA::Boolean.

00453 {
00454   return CORBA::Boolean (1);
00455 }

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 257 of file EventChannelFactory.cpp.

00258 {
00259   return true;
00260 }

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 370 of file EventChannelFactory.cpp.

References ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENV_ARG_PARAMETER, ACE_TEXT(), TAO_Notify_Builder::build_event_channel(), DEBUG_LEVEL, TAO_Singleton< TYPE, ACE_LOCK >::instance(), LM_DEBUG, TAO_Notify_EventChannel::load_attrs(), reconnect_registry_, and TAO_Notify_EventChannel.

00375 {
00376   // ignore anything but our valid children (ie channel)
00377   TAO_Notify::Topology_Object * result = this;
00378   if (type == "channel")
00379   {
00380     if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG,
00381       ACE_TEXT ("(%P|%t) EventChannelFactory reload channel %d\n")
00382       , static_cast<int> (id)
00383       ));
00384 
00385     TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder();
00386     TAO_Notify_EventChannel * ec = bld->build_event_channel(
00387         this ,
00388         id
00389         ACE_ENV_ARG_PARAMETER);
00390     ACE_CHECK_RETURN(0);
00391 
00392     ec->load_attrs (attrs);
00393 
00394     result = ec;
00395   }
00396   else if (type == TAO_Notify::REGISTRY_TYPE)
00397   {
00398     result = & this->reconnect_registry_;
00399   }
00400   return result;
00401 }

void TAO_Notify_EventChannelFactory::load_event_persistence  ) 
 

Definition at line 292 of file EventChannelFactory.cpp.

References ACE_CHECK, ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_THROW, 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().

00293 {
00294   TAO_Notify::Event_Persistence_Strategy * strategy =
00295     ACE_Dynamic_Service <TAO_Notify::Event_Persistence_Strategy>::instance ("Event_Persistence");
00296   if (strategy != 0)
00297   {
00298     if (this->topology_factory_ != 0)
00299     {
00300       TAO_Notify::Event_Persistence_Factory * factory = strategy->get_factory ();
00301       if (factory != 0)
00302       {
00303         for (
00304           TAO_Notify::Routing_Slip_Persistence_Manager * rspm = factory->first_reload_manager();
00305           rspm != 0;
00306           rspm = rspm->load_next ())
00307         {
00308           TAO_Notify::Routing_Slip_Ptr routing_slip = TAO_Notify::Routing_Slip::create (*this, rspm);
00309           if (!routing_slip.null ())
00310           {
00311             this->routing_slip_restart_set_.insert (routing_slip);
00312           }
00313           else
00314           {
00315             //@@todo: tell the rspm it's an orphan, but we can't during reload
00316             // we need collect these and come back later to remove them
00317             ACE_DEBUG ((LM_DEBUG,
00318               ACE_TEXT ("(%P|%t) Reload persistent event failed.\n")
00319               ));
00320           }
00321         }
00322       }
00323     }
00324     else
00325     {
00326       ACE_ERROR ((LM_ERROR,
00327         ACE_TEXT ("(%P|%t) Notify Service: Configuration error.  Event Persistence requires Topology Persistence.\n")
00328         ));
00329       ACE_THROW (CORBA::PERSIST_STORE());
00330       ACE_CHECK;
00331     }
00332   }
00333 }

void TAO_Notify_EventChannelFactory::load_topology  ) 
 

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 236 of file EventChannelFactory.cpp.

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

Referenced by init().

00237 {
00238   this->loading_topology_ = true;
00239   if (this->topology_factory_ != 0)
00240   {
00241     // create_loader will open and load the persistence file for validation
00242     auto_ptr<TAO_Notify::Topology_Loader> tl(this->topology_factory_->create_loader());
00243     if (tl.get () != 0)
00244     {
00245       tl->load (this ACE_ENV_ARG_PARAMETER);
00246       ACE_CHECK;
00247     }
00248   }
00249   else
00250   {
00251     if (TAO_debug_level > 0)
00252       ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Topology persistence disabled.\n")));
00253   }
00254   this->loading_topology_ = false;
00255 }

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

References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, 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().

00405 {
00406   // Reconnect all children first
00407   TAO_Notify::Reconnect_Worker<TAO_Notify_EventChannel> wrk;
00408 
00409   this->ec_container().collection()->for_each(&wrk ACE_ENV_ARG_PARAMETER);
00410   ACE_CHECK;
00411 
00412   // Then send reconnection announcement to registered clients
00413   ACE_ASSERT (!CORBA::is_nil (this->channel_factory_.in ()));
00414   this->reconnect_registry_.send_reconnect (this->channel_factory_.in () ACE_ENV_ARG_PARAMETER);
00415   ACE_CHECK;
00416 
00417   // reactivate events in-progress
00418   Routing_Slip_Set::CONST_ITERATOR iter (this->routing_slip_restart_set_);
00419   TAO_Notify::Routing_Slip_Ptr * routing_slip;
00420   for (iter.first(); iter.next(routing_slip); iter.advance())
00421   {
00422     (*routing_slip)->reconnect(ACE_ENV_SINGLE_ARG_PARAMETER);
00423     ACE_CHECK;
00424   }
00425   this->routing_slip_restart_set_.reset ();
00426 }

NotifyExt::ReconnectionRegistry::ReconnectionID TAO_Notify_EventChannelFactory::register_callback NotifyExt::ReconnectionCallback_ptr  reconnection  )  throw (CORBA::SystemException) [private, virtual]
 

Definition at line 429 of file EventChannelFactory.cpp.

References ACE_ENV_ARG_PARAMETER.

00433 {
00434   return this->reconnect_registry_.register_callback (
00435     reconnection
00436     ACE_ENV_ARG_PARAMETER);
00437 }

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

Release this object.

Implements TAO_Notify_Refcountable.

Definition at line 142 of file EventChannelFactory.cpp.

00143 {
00144   delete this;
00145   //@@ inform factory
00146 }

void TAO_Notify_EventChannelFactory::remove TAO_Notify_EventChannel channel  ) 
 

Remove from the .

Definition at line 149 of file EventChannelFactory.cpp.

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

00150 {
00151   this->ec_container().remove (event_channel ACE_ENV_ARG_PARAMETER);
00152   ACE_CHECK;
00153   this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00154 }

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 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 263 of file EventChannelFactory.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Container_T< TYPE >::collection(), ec_container(), TAO_Notify::Topology_Object::is_changed(), reconnect_registry_, and TAO_Notify::Reconnection_Registry::save_persistent().

Referenced by change_to_parent().

00264 {
00265   bool changed = this->self_changed_;
00266   this->self_changed_ = false;
00267   this->children_changed_ = false;
00268 
00269   TAO_Notify::NVPList attrs; // ECF has no attributes
00270 
00271   bool want_all_children =
00272     saver.begin_object(0, "channel_factory", attrs, changed ACE_ENV_ARG_PARAMETER);
00273   ACE_CHECK;
00274 
00275   // for each deleted child
00276   //  delete_child  // if the child has persistence.
00277 
00278   TAO_Notify::Save_Persist_Worker<TAO_Notify_EventChannel> wrk(saver, want_all_children);
00279 
00280   this->ec_container().collection()->for_each(&wrk ACE_ENV_ARG_PARAMETER);
00281   ACE_CHECK;
00282 
00283   if (want_all_children || this->reconnect_registry_.is_changed ())
00284   {
00285     this->reconnect_registry_.save_persistent(saver ACE_ENV_ARG_PARAMETER);
00286     ACE_CHECK;
00287   }
00288   saver.end_object(0, "channel_factory" ACE_ENV_ARG_PARAMETER);
00289 }

void TAO_Notify_EventChannelFactory::save_topology  )  throw (CORBA::SystemException) [virtual]
 

Definition at line 458 of file EventChannelFactory.cpp.

References ACE_CHECK, and ACE_ENV_SINGLE_ARG_PARAMETER.

00460 {
00461   this->self_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00462   ACE_CHECK;
00463 }

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 224 of file EventChannelFactory.cpp.

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

00225 {
00226   ACE_DEBUG ((LM_DEBUG,
00227     ACE_TEXT ("(%P,%t) Debug Topology_Factory installed in EventChannelFactory.\n")
00228     ));
00229   // If the above meessage appears when you don't expect it
00230   // use svc.conf to install the topology factory rather
00231   // than calling this method.
00232   this->topology_factory_ = f;
00233 }

int TAO_Notify_EventChannelFactory::shutdown  )  [private, virtual]
 

shutdown

Reimplemented from TAO_Notify_Object.

Definition at line 157 of file EventChannelFactory.cpp.

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

00158 {
00159   int sd_ret = TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00160   ACE_CHECK_RETURN (1);
00161 
00162   if (sd_ret == 1)
00163     return 1;
00164 
00165   this->ec_container().shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00166   ACE_CHECK_RETURN (1);
00167 
00168   return 0;
00169 }

void TAO_Notify_EventChannelFactory::unregister_callback NotifyExt::ReconnectionRegistry::ReconnectionID  id  )  throw (CORBA::SystemException) [private, virtual]
 

Definition at line 440 of file EventChannelFactory.cpp.

References ACE_ENV_ARG_PARAMETER.

00444 {
00445   this->reconnect_registry_.unregister_callback (
00446     id
00447     ACE_ENV_ARG_PARAMETER);
00448 }


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 184 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 125 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 180 of file EventChannelFactory.h.

Referenced by ec_container(), and init().

bool TAO_Notify_EventChannelFactory::loading_topology_ [private]
 

Definition at line 190 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 189 of file EventChannelFactory.h.

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

Routing_Slip_Set TAO_Notify_EventChannelFactory::routing_slip_restart_set_ [private]
 

Definition at line 192 of file EventChannelFactory.h.

Referenced by load_event_persistence(), and reconnect().

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

Definition at line 188 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 182 of file EventChannelFactory.h.

short TAO_Notify_EventChannelFactory::topology_save_seq_ [private]
 

change-in-progress detector to avoid duplicates

Definition at line 187 of file EventChannelFactory.h.

Referenced by change_to_parent().


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