00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TAO_CEC_TYPEDEVENTCHANNEL_H_
00018 #define TAO_CEC_TYPEDEVENTCHANNEL_H_
00019 #include "ace/pre.h"
00020
00021 #include "orbsvcs/CosEvent/event_serv_export.h"
00022
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 #pragma once
00025 #endif
00026
00027 #include "orbsvcs/CosEvent/CEC_Defaults.h"
00028
00029 #include "orbsvcs/CosTypedEventChannelAdminS.h"
00030
00031 #include "orbsvcs/CosEvent/CEC_Factory.h"
00032
00033 #include "tao/IFR_Client/IFR_BasicC.h"
00034 #include "tao/AnyTypeCode/NVList.h"
00035
00036 #include "ace/Hash_Map_Manager.h"
00037 #include "ace/Null_Mutex.h"
00038 #include "ace/SString.h"
00039
00040 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class TAO_Event_Serv_Export TAO_CEC_TypedEventChannel_Attributes
00059 {
00060 public:
00061
00062
00063
00064
00065
00066 TAO_CEC_TypedEventChannel_Attributes (PortableServer::POA_ptr typed_supplier_poa,
00067 PortableServer::POA_ptr typed_consumer_poa,
00068 CORBA::ORB_ptr orb,
00069 CORBA::Repository_ptr interface_repository);
00070
00071
00072
00073
00074
00075 int consumer_reconnect;
00076 int supplier_reconnect;
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 int disconnect_callbacks;
00088
00089
00090
00091
00092
00093 int destroy_on_shutdown;
00094
00095 private:
00096
00097 friend class TAO_CEC_TypedEventChannel;
00098
00099
00100 PortableServer::POA_ptr typed_supplier_poa;
00101 PortableServer::POA_ptr typed_consumer_poa;
00102
00103
00104 CORBA::ORB_ptr orb;
00105
00106
00107 CORBA::Repository_ptr interface_repository;
00108 };
00109
00110 class TAO_CEC_Operation_Params;
00111
00112
00113 class TAO_Event_Serv_Export TAO_CEC_TypedEventChannel : public virtual POA_CosTypedEventChannelAdmin::TypedEventChannel
00114 {
00115 public:
00116 class ServantBaseHash
00117 {
00118 public:
00119 u_long operator() (PortableServer::ServantBase* const & ptr) const {
00120 return reinterpret_cast<u_long> (ptr);
00121 }
00122 };
00123
00124 typedef ACE_Hash_Map_Manager_Ex<PortableServer::ServantBase*,
00125 unsigned int,
00126 ServantBaseHash,
00127 ACE_Equal_To<PortableServer::ServantBase*>,
00128 TAO_SYNCH_MUTEX> ServantRetryMap;
00129
00130
00131
00132
00133
00134
00135
00136 TAO_CEC_TypedEventChannel (const TAO_CEC_TypedEventChannel_Attributes& attributes,
00137 TAO_CEC_Factory* factory = 0,
00138 int own_factory = 0);
00139
00140
00141 virtual ~TAO_CEC_TypedEventChannel (void);
00142
00143
00144
00145 virtual void activate (void);
00146
00147
00148
00149 virtual void shutdown (void);
00150
00151
00152 TAO_CEC_Dispatching* dispatching (void) const;
00153
00154
00155 TAO_CEC_TypedConsumerAdmin* typed_consumer_admin (void) const;
00156
00157
00158 TAO_CEC_TypedSupplierAdmin* typed_supplier_admin (void) const;
00159
00160
00161 TAO_CEC_ConsumerControl* consumer_control (void) const;
00162
00163
00164 TAO_CEC_SupplierControl* supplier_control (void) const;
00165
00166
00167
00168 void create_proxy (TAO_CEC_ProxyPushSupplier*&);
00169 void destroy_proxy (TAO_CEC_ProxyPushSupplier*);
00170
00171
00172 void create_proxy (TAO_CEC_TypedProxyPushConsumer*&);
00173 void destroy_proxy (TAO_CEC_TypedProxyPushConsumer*);
00174
00175
00176
00177 void create_proxy_collection (TAO_CEC_ProxyPushSupplier_Collection*&);
00178 void destroy_proxy_collection (TAO_CEC_ProxyPushSupplier_Collection*);
00179
00180
00181
00182 void create_proxy_collection (TAO_CEC_TypedProxyPushConsumer_Collection*&);
00183 void destroy_proxy_collection (TAO_CEC_TypedProxyPushConsumer_Collection*);
00184
00185
00186 PortableServer::POA_ptr typed_supplier_poa (void);
00187 PortableServer::POA_ptr typed_consumer_poa (void);
00188
00189
00190
00191 ACE_Lock* create_consumer_lock (void);
00192 void destroy_consumer_lock (ACE_Lock*);
00193 ACE_Lock* create_supplier_lock (void);
00194 void destroy_supplier_lock (ACE_Lock*);
00195
00196
00197
00198 virtual void connected (TAO_CEC_TypedProxyPushConsumer*);
00199 virtual void reconnected (TAO_CEC_TypedProxyPushConsumer*);
00200 virtual void disconnected (TAO_CEC_TypedProxyPushConsumer*);
00201
00202
00203
00204 virtual void connected (TAO_CEC_ProxyPushSupplier*);
00205 virtual void reconnected (TAO_CEC_ProxyPushSupplier*);
00206 virtual void disconnected (TAO_CEC_ProxyPushSupplier*);
00207
00208
00209 int consumer_reconnect (void) const;
00210
00211
00212 int supplier_reconnect (void) const;
00213
00214
00215
00216 int disconnect_callbacks (void) const;
00217
00218
00219 typedef ACE_Hash_Map_Manager_Ex<const char *, TAO_CEC_Operation_Params *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> InterfaceDescription;
00220 typedef InterfaceDescription::iterator Iterator;
00221
00222
00223 TAO_CEC_Operation_Params * find_from_ifr_cache (const char *operation);
00224
00225
00226 int consumer_register_uses_interace (const char *uses_interface);
00227
00228
00229 int supplier_register_supported_interface (const char *supported_interface);
00230
00231
00232 const char * supported_interface (void) const;
00233
00234
00235 CORBA::RepositoryId base_interfaces (CORBA::ULong index) const;
00236
00237
00238 CORBA::ULong number_of_base_interfaces (void) const;
00239
00240
00241 virtual void create_operation_list (TAO_CEC_Operation_Params *oper_params,
00242 CORBA::NVList_out new_list);
00243
00244
00245 virtual void create_list (CORBA::Long count,
00246 CORBA::NVList_out new_list);
00247
00248
00249 virtual ::CosTypedEventChannelAdmin::TypedConsumerAdmin_ptr
00250 for_consumers (void);
00251
00252 virtual ::CosTypedEventChannelAdmin::TypedSupplierAdmin_ptr
00253 for_suppliers (void);
00254
00255 virtual void destroy (void);
00256
00257 ServantRetryMap& get_servant_retry_map (void);
00258
00259
00260 CORBA::Policy_ptr
00261 create_roundtrip_timeout_policy (const ACE_Time_Value &timeout);
00262
00263 protected:
00264
00265 int cache_interface_description (const char *interface_);
00266
00267
00268 int insert_into_ifr_cache (const char *operation, TAO_CEC_Operation_Params *parameters);
00269
00270
00271 int clear_ifr_cache (void);
00272
00273 private:
00274
00275
00276 PortableServer::POA_var typed_supplier_poa_;
00277 PortableServer::POA_var typed_consumer_poa_;
00278
00279
00280 CORBA::ORB_var orb_;
00281
00282
00283 CORBA::Repository_var interface_repository_;
00284
00285
00286
00287
00288
00289
00290 TAO_CEC_Factory *factory_;
00291
00292
00293 int own_factory_;
00294
00295
00296 TAO_CEC_Dispatching *dispatching_;
00297
00298
00299 TAO_CEC_TypedConsumerAdmin *typed_consumer_admin_;
00300
00301
00302 TAO_CEC_TypedSupplierAdmin *typed_supplier_admin_;
00303
00304
00305 int consumer_reconnect_;
00306
00307
00308 int supplier_reconnect_;
00309
00310
00311 int disconnect_callbacks_;
00312
00313
00314 int destroy_on_shutdown_;
00315
00316
00317 int destroyed_;
00318
00319
00320
00321 TAO_CEC_ConsumerControl *consumer_control_;
00322 ServantRetryMap retry_map_;
00323
00324 TAO_CEC_SupplierControl *supplier_control_;
00325
00326
00327 ACE_CString uses_interface_;
00328
00329
00330 ACE_CString supported_interface_;
00331
00332
00333 InterfaceDescription interface_description_;
00334
00335
00336 CORBA::RepositoryIdSeq base_interfaces_;
00337 };
00338
00339
00340 class TAO_Event_Serv_Export TAO_CEC_Param
00341 {
00342 public:
00343
00344 TAO_CEC_Param (void);
00345
00346
00347 ~TAO_CEC_Param (void);
00348
00349 private:
00350
00351 friend class TAO_CEC_TypedEventChannel;
00352
00353 CORBA::String_var name_;
00354 CORBA::TypeCode_var type_;
00355 CORBA::Flags direction_;
00356 };
00357
00358
00359 class TAO_Event_Serv_Export TAO_CEC_Operation_Params
00360 {
00361
00362 TAO_CEC_Operation_Params (CORBA::ULong num_params);
00363
00364 ~TAO_CEC_Operation_Params (void);
00365
00366 private:
00367
00368 friend class TAO_CEC_TypedEventChannel;
00369
00370 CORBA::ULong num_params_;
00371 TAO_CEC_Param * parameters_;
00372 };
00373
00374 TAO_END_VERSIONED_NAMESPACE_DECL
00375
00376 #if defined (__ACE_INLINE__)
00377 #include "orbsvcs/CosEvent/CEC_TypedEventChannel.inl"
00378 #endif
00379
00380 #include "ace/post.h"
00381
00382 #endif