summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h
blob: c8757fcb99af2572b72948ad137e35f4667d63f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// $Id$
// ==========================================================================
//
// = LIBRARY
//   orbsvcs
//
// = FILENAME
//   Notify_EventChannel_i.h
//
// = DESCRIPTION
//   Implements the CosNotifyChannelAdmin::EventChannel interface.
//
// = AUTHOR
//    Pradeep Gore <pradeep@cs.wustl.edu>
//
// ==========================================================================

#ifndef TAO_NOTIFY_EVENTCHANNEL_I_H_
#define TAO_NOTIFY_EVENTCHANNEL_I_H_
#include "ace/pre.h"
#include "ace/Hash_Map_Manager.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/CosNotifyChannelAdminS.h"
#include "Notify_ID_Pool_T.h"
#include "Notify_QoSAdmin_i.h"
#include "Notify_Collection.h"

class TAO_Notify_EventChannelFactory_i;
class TAO_Notify_Resource_Manager;
class TAO_Notify_Event_Manager;
class TAO_Notify_CO_Factory;
class TAO_Notify_POA_Factory;
class TAO_Notify_EMO_Factory;
class TAO_Notify_EventListener;

#if defined (_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning (push)
#endif /* _MSC_VER >= 1200 */
#pragma warning (disable:4250)
#endif /* _MSC_VER */

class TAO_Notify_Export TAO_Notify_EventChannel_i : public virtual POA_CosNotifyChannelAdmin::EventChannel, public PortableServer::RefCountServantBase
{
  // = TITLE
  //
  //   TAO_Notify_EventChannel_i
  //
  // = DESCRIPTION
  //   This class handles all the object factory functionality.All the event
  //   routing is handled by its contained Event Manager class.
  //
  // = MISC. NOTES
  //   This class creates and owns 2 child POA's. one to contain CA's and the other for SA's.
  //   Now, a Channel object can be destoyed in 2 ways - as a side effect of its parent POA being
  //   destroyed or if this class's <destroy> method is invoked. If the object is being destroyed
  //   as a result of its Parent POA being destroyed, it is illegal to destroy  a childPOA
  //   because, the root poa destruction will destroy all child poa's.
  //   So in the destructor we conditionally check if the child POAs should be destroyed explicitly
  //   or not.
  //
 public:
  TAO_Notify_EventChannel_i (TAO_Notify_EventChannelFactory_i* channel_factory);
  // Constructor.
  // <channel_factory> is the parent.

  virtual ~TAO_Notify_EventChannel_i (void);
  // Destructor

  void init (CosNotifyChannelAdmin::ChannelID channel_id,
             const CosNotification::QoSProperties& initial_qos,
             const CosNotification::AdminProperties& initial_admin,
             PortableServer::POA_ptr default_POA,
             PortableServer::POA_ptr my_POA
             ACE_ENV_ARG_DECL);
  // Initialize this object.
  // checks if the <initial_qos> and <initial admin> are valid.
  // creates default filter, consumer admin and supplier admin.

  // = Accessors
  PortableServer::POA_ptr get_default_POA (void);
  // Get the default POA.

  CosNotifyChannelAdmin::EventChannel_ptr get_ref (ACE_ENV_SINGLE_ARG_DECL);
  // Get the CORBA object for this servant

  TAO_Notify_Event_Manager* get_event_manager (void);
  // Get the event manager.

  // = Child destroyed notification.
  void consumer_admin_destroyed (CosNotifyChannelAdmin::AdminID CA_ID);
  // This id is no longer in use.It can be reused by <consumer_admin_ids_>.

  void supplier_admin_destroyed (CosNotifyChannelAdmin::AdminID SA_ID);
  // This id is no longer in use.It can be reused by <supplier_admin_ids_>.

  void unregister_listener (TAO_Notify_EventListener* group_listener ACE_ENV_ARG_DECL);
  // Consumer Admin's are Group Listeners that are registered automatically with the EC when a ConsumerAdmin
  // is created. When a consumer is destroyed, it asks the EC to unregister itself.

  // = Interface methods
  virtual CosNotifyChannelAdmin::EventChannelFactory_ptr MyFactory (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr default_consumer_admin (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::SupplierAdmin_ptr default_supplier_admin (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyFilter::FilterFactory_ptr default_filter_factory (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr new_for_consumers (
    CosNotifyChannelAdmin::InterFilterGroupOperator op,
    CosNotifyChannelAdmin::AdminID_out id
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::SupplierAdmin_ptr new_for_suppliers (
    CosNotifyChannelAdmin::InterFilterGroupOperator op,
    CosNotifyChannelAdmin::AdminID_out id
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr get_consumeradmin (
    CosNotifyChannelAdmin::AdminID id
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    CosNotifyChannelAdmin::AdminNotFound
  ));

virtual CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin (
    CosNotifyChannelAdmin::AdminID id
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    CosNotifyChannelAdmin::AdminNotFound
  ));

virtual CosNotifyChannelAdmin::AdminIDSeq * get_all_consumeradmins (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotifyChannelAdmin::AdminIDSeq * get_all_supplieradmins (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

virtual CosNotification::QoSProperties * get_qos (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

  virtual void set_qos (
    const CosNotification::QoSProperties & qos
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    CosNotification::UnsupportedQoS
  ));

  virtual void validate_qos (
    const CosNotification::QoSProperties & required_qos,
    CosNotification::NamedPropertyRangeSeq_out available_qos
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    CosNotification::UnsupportedQoS
  ));

  virtual CosNotification::AdminProperties * get_admin (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

  virtual void set_admin (
    const CosNotification::AdminProperties & admin
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    CosNotification::UnsupportedAdmin
  ));

  virtual CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

  virtual CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ));

  virtual void destroy (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
                   CORBA::SystemException
  ));

  const TAO_Notify_QoSAdmin_i& qos_admin (void) const;

protected:
  // = Data Members
  ACE_Lock* lock_;
  // The locking strategy.

  CORBA::Boolean destory_child_POAs_;
  // Flag to tell our destructor if we should destroy the CA and SA POA's.
  // default is false, the parent poa destruction will remove these.
  // set to true if the <destroy> method is invoked.

  TAO_Notify_EventChannelFactory_i* channel_factory_;
  // The factory that created us.

  PortableServer::POA_var default_POA_;
  // The default POA in which we activate objects that don't have ids' pre-assigned.

  PortableServer::POA_var my_POA_;
  // The POA in which i live.

  PortableServer::POA_var CA_POA_;
  // The POA in which we should activate ConsumerAdmins in.
  // We create and own this.

  PortableServer::POA_var SA_POA_;
  // The POA in which we should activate SupplierAdmins in.
  // We create and own this.

  CosNotifyChannelAdmin::ChannelID channel_id_;
  // The ID assigned to this channel.

  TAO_Notify_CO_Factory* channel_objects_factory_;
  // The factory for channel objects.

  TAO_Notify_POA_Factory* poa_factory_;
  // The factory for POA based containers.

  TAO_Notify_EMO_Factory* event_manager_objects_factory_;
  // Event manager objects factory,

  TAO_Notify_ID_Pool_Ex<CosNotifyChannelAdmin::AdminID,
    CosNotifyChannelAdmin::AdminIDSeq> consumer_admin_ids_;
  // Id generator for consumer admins.

  TAO_Notify_ID_Pool_Ex<CosNotifyChannelAdmin::AdminID,
    CosNotifyChannelAdmin::AdminIDSeq> supplier_admin_ids_;
  // Id generator for supplier admins.

  const CosNotifyChannelAdmin::InterFilterGroupOperator default_op_;
  // Default InterFilterGroupOperator operator used when creating
  // the default ConsumerAdmin and SupplierAdmin.

  const CosNotifyChannelAdmin::AdminID default_id_;
  // Default id's to CosEventChannelAdmin::ConsumerAdmin, SupplierAdmin.

  TAO_Notify_QoSAdmin_i qos_admin_;
  // Handle QoS admin methods.

  TAO_Notify_Event_Manager* event_manager_;
  // The event manager.

  TAO_Notify_EventListener_List* event_listener_list_;
  // The list of group event listeners that have registered with us.
};

#if defined (_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning (pop)
#endif /* _MSC_VER */

#include "ace/post.h"
#endif /* TAO_NOTIFY_EVENTCHANNEL_I_H_ */