summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp117
1 files changed, 34 insertions, 83 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp
index 2fb9e4fddba..a857fc7d60d 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp
@@ -1,12 +1,10 @@
// $Id$
+#include "tao/Servant_Base.h"
+#include "tao/POAC.h"
#include "Notify_EventChannelFactory_i.h"
#include "Notify_EventChannel_i.h"
-#include "Notify_Channel_Objects_Factory.h"
-#include "Notify_POA_Factory.h"
-#include "Notify_Factory.h"
-#include "Notify_FilterFactory_i.h"
-#include "Notify_Event.h"
+#include "Notify_Resource_Manager.h"
ACE_RCSID(Notify, Notify_EventChannelFactory_i, "$Id$")
@@ -16,7 +14,7 @@ TAO_Notify_EventChannelFactory_i::TAO_Notify_EventChannelFactory_i (void)
TAO_Notify_EventChannelFactory_i::~TAO_Notify_EventChannelFactory_i (void)
{
- TAO_Notify_Factory::shutdown ();
+ this->cleanup_i ();
}
CosNotifyChannelAdmin::EventChannelFactory_ptr
@@ -33,7 +31,7 @@ TAO_Notify_EventChannelFactory_i::create (PortableServer::POA_ptr default_POA, C
channelfactory->init_i (default_POA, ACE_TRY_ENV);
ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ());
- CORBA::Object_var obj = channelfactory->poa_factory_->
+ CORBA::Object_var obj = channelfactory->resource_manager_->
activate_object (channelfactory->my_POA_.in (),
channelfactory, ACE_TRY_ENV);
ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ());
@@ -45,57 +43,43 @@ TAO_Notify_EventChannelFactory_i::create (PortableServer::POA_ptr default_POA, C
void
TAO_Notify_EventChannelFactory_i::init_i (PortableServer::POA_ptr default_POA, CORBA::Environment &ACE_TRY_ENV)
{
- TAO_Notify_Factory::init (ACE_TRY_ENV);
- ACE_CHECK;
-
this->my_POA_ = PortableServer::POA::_duplicate (default_POA);
- this->channel_objects_factory_ =
- TAO_Notify_Factory::get_channel_objects_factory ();
-
- this->poa_factory_ = TAO_Notify_Factory::get_poa_factory ();
-
- // The POA that we should activate the Event Channels in.
- this->ec_POA_ = this->poa_factory_->
- create_event_channel_POA (this->my_POA_.in (), ACE_TRY_ENV);
- ACE_CHECK;
-
- this->lock_ =
- this->channel_objects_factory_->create_channel_factory_lock (ACE_TRY_ENV);
+ this->resource_manager_ =
+ TAO_Notify_Resource_Manager::create (default_POA,
+ ACE_TRY_ENV);
ACE_CHECK;
- this->default_filter_factory_ =
- this->create_default_filter_factory_i (ACE_TRY_ENV);
+ // Which POA should we activate the Event Channels in?
+ this->ec_POA_ = this->resource_manager_->
+ create_event_channel_POA (this->my_POA_.in (), ACE_TRY_ENV);
}
CosNotifyChannelAdmin::EventChannelFactory_ptr
TAO_Notify_EventChannelFactory_i::get_ref (CORBA::Environment &ACE_TRY_ENV)
{
return CosNotifyChannelAdmin::EventChannelFactory
- ::_narrow (this->poa_factory_->
+ ::_narrow (this->resource_manager_->
servant_to_reference (this->my_POA_.in (), this, ACE_TRY_ENV));
}
void
TAO_Notify_EventChannelFactory_i::event_channel_destroyed (CosNotifyChannelAdmin::ChannelID channel_id)
{
- ACE_DEBUG ((LM_DEBUG, "event_channel_destroyed %d\n", channel_id));
+ this->ec_ids_.put (channel_id);
}
-void TAO_Notify_EventChannelFactory_i::shutdown (CORBA::Environment &ACE_TRY_ENV, CORBA::Boolean destroy_children)
+void
+TAO_Notify_EventChannelFactory_i::cleanup_i (void)
{
- if (destroy_children == 1)
- {
- this->poa_factory_->destroy_POA (this->ec_POA_.in (), ACE_TRY_ENV);
+ if (this->resource_manager_ != 0)
+ this->resource_manager_->destroy_POA (this->ec_POA_.in ());
- this->poa_factory_->deactivate_object(this->default_filter_factory_.in (),
- this->my_POA_.in (),
- ACE_TRY_ENV);
- }
- // Deactivate ourselves.
- this->poa_factory_->deactivate_object (this,
- this->my_POA_.in (),
- ACE_TRY_ENV);
+ delete this->resource_manager_;
+
+ my_POA_ = PortableServer::POA::_nil ();
+ ec_POA_ = PortableServer::POA::_nil ();
+ this->resource_manager_ = 0;
}
CosNotifyChannelAdmin::EventChannel_ptr
@@ -111,31 +95,27 @@ TAO_Notify_EventChannelFactory_i::create_channel(const CosNotification::QoSPrope
))
{
TAO_Notify_EventChannel_i* channel =
- this->channel_objects_factory_->create_event_channel (this,
- ACE_TRY_ENV);
+ this->resource_manager_->create_event_channel (this,
+ ACE_TRY_ENV);
ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ());
PortableServer::ServantBase_var channel_var (channel);
- {
- ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_,
- CORBA::INTERNAL ());
- ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ());
+ ec_id = this->ec_ids_.get ();
- ec_id = this->ec_ids_.get ();
-
- ACE_DEBUG ((LM_DEBUG, "event_channel created %d\n", ec_id));
- }
-
- channel->init (ec_id, initial_qos, initial_admin, this->my_POA_.in (), this->ec_POA_.in (),
+ channel->init (ec_id, initial_qos, initial_admin, this->ec_POA_.in (),
ACE_TRY_ENV);
ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ());
- CORBA::Object_var obj = this->poa_factory_->
- activate_object_with_id (ec_id, this->ec_POA_.in (), channel,
+ CORBA::Object_var obj = this->resource_manager_->
+ activate_object_with_id (ec_id,
+ this->ec_POA_.in (),
+ channel,
ACE_TRY_ENV);
ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ());
+ this->ec_ids_.next ();
+
return CosNotifyChannelAdmin::EventChannel::_narrow (obj.in ());
}
@@ -145,8 +125,6 @@ TAO_Notify_EventChannelFactory_i::get_all_channels (CORBA::Environment & ACE_TRY
CORBA::SystemException
))
{
- ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
-
return this->ec_ids_.get_sequence (ACE_TRY_ENV);
}
@@ -161,8 +139,8 @@ TAO_Notify_EventChannelFactory_i::get_event_channel (CosNotifyChannelAdmin::Chan
ACE_TRY
{
- obj = this->poa_factory_->id_to_reference (id, this->ec_POA_.in (),
- ACE_TRY_ENV);
+ obj = this->resource_manager_->id_to_reference (id, this->ec_POA_.in (),
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
}
ACE_CATCHANY // Translate any exception to "not found"
@@ -175,33 +153,6 @@ TAO_Notify_EventChannelFactory_i::get_event_channel (CosNotifyChannelAdmin::Chan
return CosNotifyChannelAdmin::EventChannel::_narrow (obj.in (), ACE_TRY_ENV);
}
-CosNotifyFilter::FilterFactory_ptr
-TAO_Notify_EventChannelFactory_i::create_default_filter_factory_i (CORBA::Environment& ACE_TRY_ENV)
-{
- TAO_Notify_FilterFactory_i* filterfactory =
- this->channel_objects_factory_->create_filter_factory (ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ());
-
- PortableServer::ServantBase_var filterfactory_var (filterfactory);
-
- // Init goes here.
- // ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ());
-
- CORBA::Object_var obj =
- this->poa_factory_->activate_object (this->my_POA_.in (),
- filterfactory, ACE_TRY_ENV);
- ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ());
-
- return CosNotifyFilter::FilterFactory::_narrow (obj.in ());
-}
-
-CosNotifyFilter::FilterFactory_ptr
-TAO_Notify_EventChannelFactory_i::get_default_filter_factory (void)
-{
- return CosNotifyFilter::FilterFactory::
- _duplicate (this->default_filter_factory_.in ());
-}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class TAO_Notify_ID_Pool_Ex<CosNotifyChannelAdmin::ChannelID, CosNotifyChannelAdmin::ChannelIDSeq>;