1
// CEC_EventChannel.cpp,v 1.6 2003/06/26 17:34:25 jwillemsen Exp
3
#include "CEC_EventChannel.h"
4
#include "CEC_Dispatching.h"
5
#include "CEC_Pulling_Strategy.h"
6
#include "CEC_ConsumerAdmin.h"
7
#include "CEC_SupplierAdmin.h"
8
#include "CEC_ConsumerControl.h"
9
#include "CEC_SupplierControl.h"
10
#include "ace/Dynamic_Service.h"
12
#if ! defined (__ACE_INLINE__)
13
#include "CEC_EventChannel.i"
14
#endif /* __ACE_INLINE__ */
16
ACE_RCSID(CosEvent, CEC_EventChannel, "CEC_EventChannel.cpp,v 1.6 2003/06/26 17:34:25 jwillemsen Exp")
18
TAO_CEC_EventChannel::
19
TAO_CEC_EventChannel (const TAO_CEC_EventChannel_Attributes& attr,
20
TAO_CEC_Factory* factory,
22
: supplier_poa_ (PortableServer::POA::_duplicate (attr.supplier_poa)),
23
consumer_poa_ (PortableServer::POA::_duplicate (attr.consumer_poa)),
25
own_factory_ (own_factory),
26
consumer_reconnect_ (attr.consumer_reconnect),
27
supplier_reconnect_ (attr.supplier_reconnect),
28
disconnect_callbacks_ (attr.disconnect_callbacks)
30
if (this->factory_ == 0)
33
ACE_Dynamic_Service<TAO_CEC_Factory>::instance ("CEC_Factory");
34
this->own_factory_ = 0;
35
ACE_ASSERT (this->factory_ != 0);
39
this->factory_->create_dispatching (this);
40
this->pulling_strategy_ =
41
this->factory_->create_pulling_strategy (this);
42
this->consumer_admin_ =
43
this->factory_->create_consumer_admin (this);
44
this->supplier_admin_ =
45
this->factory_->create_supplier_admin (this);
46
this->consumer_control_ =
47
this->factory_->create_consumer_control (this);
48
this->supplier_control_ =
49
this->factory_->create_supplier_control (this);
52
TAO_CEC_EventChannel::~TAO_CEC_EventChannel (void)
54
this->factory_->destroy_dispatching (this->dispatching_);
55
this->dispatching_ = 0;
57
this->factory_->destroy_pulling_strategy (this->pulling_strategy_);
58
this->pulling_strategy_ = 0;
60
this->factory_->destroy_consumer_admin (this->consumer_admin_);
61
this->consumer_admin_ = 0;
62
this->factory_->destroy_supplier_admin (this->supplier_admin_);
63
this->supplier_admin_ = 0;
65
this->factory_->destroy_consumer_control (this->consumer_control_);
66
this->consumer_control_ = 0;
67
this->factory_->destroy_supplier_control (this->supplier_control_);
68
this->supplier_control_ = 0;
70
if (this->own_factory_)
71
delete this->factory_;
75
TAO_CEC_EventChannel::activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
77
this->dispatching_->activate ();
78
this->pulling_strategy_->activate ();
79
this->consumer_control_->activate ();
80
this->supplier_control_->activate ();
84
TAO_CEC_EventChannel::shutdown (ACE_ENV_SINGLE_ARG_DECL)
86
this->dispatching_->shutdown ();
87
this->pulling_strategy_->shutdown ();
88
this->supplier_control_->shutdown ();
89
this->consumer_control_->shutdown ();
91
PortableServer::POA_var consumer_poa =
92
this->consumer_admin_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
94
PortableServer::ObjectId_var consumer_id =
95
consumer_poa->servant_to_id (this->consumer_admin_ ACE_ENV_ARG_PARAMETER);
97
consumer_poa->deactivate_object (consumer_id.in () ACE_ENV_ARG_PARAMETER);
100
PortableServer::POA_var supplier_poa =
101
this->supplier_admin_->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
103
PortableServer::ObjectId_var supplier_id =
104
supplier_poa->servant_to_id (this->supplier_admin_ ACE_ENV_ARG_PARAMETER);
106
supplier_poa->deactivate_object (supplier_id.in () ACE_ENV_ARG_PARAMETER);
109
this->supplier_admin_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
111
this->consumer_admin_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
115
TAO_CEC_EventChannel::connected (TAO_CEC_ProxyPushConsumer* consumer
118
this->supplier_admin_->connected (consumer ACE_ENV_ARG_PARAMETER);
123
TAO_CEC_EventChannel::reconnected (TAO_CEC_ProxyPushConsumer* consumer
126
this->supplier_admin_->reconnected (consumer ACE_ENV_ARG_PARAMETER);
131
TAO_CEC_EventChannel::disconnected (TAO_CEC_ProxyPushConsumer* consumer
134
this->supplier_admin_->disconnected (consumer ACE_ENV_ARG_PARAMETER);
139
TAO_CEC_EventChannel::connected (TAO_CEC_ProxyPullConsumer* consumer
142
this->supplier_admin_->connected (consumer ACE_ENV_ARG_PARAMETER);
147
TAO_CEC_EventChannel::reconnected (TAO_CEC_ProxyPullConsumer* consumer
150
this->supplier_admin_->reconnected (consumer ACE_ENV_ARG_PARAMETER);
155
TAO_CEC_EventChannel::disconnected (TAO_CEC_ProxyPullConsumer* consumer
158
this->supplier_admin_->disconnected (consumer ACE_ENV_ARG_PARAMETER);
163
TAO_CEC_EventChannel::connected (TAO_CEC_ProxyPushSupplier* supplier
166
this->consumer_admin_->connected (supplier ACE_ENV_ARG_PARAMETER);
171
TAO_CEC_EventChannel::reconnected (TAO_CEC_ProxyPushSupplier* supplier
174
this->consumer_admin_->reconnected (supplier ACE_ENV_ARG_PARAMETER);
179
TAO_CEC_EventChannel::disconnected (TAO_CEC_ProxyPushSupplier* supplier
182
this->consumer_admin_->disconnected (supplier ACE_ENV_ARG_PARAMETER);
187
TAO_CEC_EventChannel::connected (TAO_CEC_ProxyPullSupplier* supplier
190
this->consumer_admin_->connected (supplier ACE_ENV_ARG_PARAMETER);
195
TAO_CEC_EventChannel::reconnected (TAO_CEC_ProxyPullSupplier* supplier
198
this->consumer_admin_->reconnected (supplier ACE_ENV_ARG_PARAMETER);
203
TAO_CEC_EventChannel::disconnected (TAO_CEC_ProxyPullSupplier* supplier
206
this->consumer_admin_->disconnected (supplier ACE_ENV_ARG_PARAMETER);
210
CosEventChannelAdmin::ConsumerAdmin_ptr
211
TAO_CEC_EventChannel::for_consumers (ACE_ENV_SINGLE_ARG_DECL)
212
ACE_THROW_SPEC ((CORBA::SystemException))
214
return this->consumer_admin_->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
217
CosEventChannelAdmin::SupplierAdmin_ptr
218
TAO_CEC_EventChannel::for_suppliers (ACE_ENV_SINGLE_ARG_DECL)
219
ACE_THROW_SPEC ((CORBA::SystemException))
221
return this->supplier_admin_->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
225
TAO_CEC_EventChannel::destroy (ACE_ENV_SINGLE_ARG_DECL)
226
ACE_THROW_SPEC ((CORBA::SystemException))
228
this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);