00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TAO_CEC_REACTIVE_SUPPLIERCONTROL_H
00018 #define TAO_CEC_REACTIVE_SUPPLIERCONTROL_H
00019
00020 #include "ace/pre.h"
00021
00022 #include "orbsvcs/CosEvent/CEC_SupplierControl.h"
00023
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif
00027
00028 #include "orbsvcs/ESF/ESF_Worker.h"
00029
00030 #include "tao/ORB.h"
00031
00032 #include "ace/Event_Handler.h"
00033
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035
00036 class TAO_CEC_EventChannel;
00037 class TAO_CEC_Reactive_SupplierControl;
00038
00039 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00040 class TAO_CEC_TypedEventChannel;
00041 #endif
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class TAO_Event_Serv_Export TAO_CEC_SupplierControl_Adapter
00053 : public ACE_Event_Handler
00054 {
00055 public:
00056
00057 TAO_CEC_SupplierControl_Adapter (TAO_CEC_Reactive_SupplierControl *adaptee);
00058
00059
00060 virtual int handle_timeout (const ACE_Time_Value &tv,
00061 const void *arg = 0);
00062
00063 private:
00064
00065 TAO_CEC_Reactive_SupplierControl *adaptee_;
00066 };
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 class TAO_Event_Serv_Export TAO_CEC_Reactive_SupplierControl
00080 : public TAO_CEC_SupplierControl
00081 {
00082 public:
00083
00084
00085 TAO_CEC_Reactive_SupplierControl (const ACE_Time_Value &rate,
00086 const ACE_Time_Value &timeout,
00087 unsigned int retries,
00088 TAO_CEC_EventChannel *event_channel,
00089 CORBA::ORB_ptr orb);
00090
00091
00092 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00093 TAO_CEC_Reactive_SupplierControl (
00094 const ACE_Time_Value &rate,
00095 const ACE_Time_Value &timeout,
00096 unsigned int retries,
00097 TAO_CEC_TypedEventChannel *typed_event_channel,
00098 CORBA::ORB_ptr orb
00099 );
00100 #endif
00101
00102
00103 virtual ~TAO_CEC_Reactive_SupplierControl (void);
00104
00105
00106 void handle_timeout (const ACE_Time_Value &tv,
00107 const void* arg);
00108
00109
00110 virtual int activate (void);
00111 virtual int shutdown (void);
00112 virtual void supplier_not_exist (TAO_CEC_ProxyPushConsumer *proxy
00113 ACE_ENV_ARG_DECL_NOT_USED);
00114 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00115 virtual void supplier_not_exist (TAO_CEC_TypedProxyPushConsumer *proxy
00116 ACE_ENV_ARG_DECL_NOT_USED);
00117 #endif
00118 virtual void supplier_not_exist (TAO_CEC_ProxyPullConsumer *proxy
00119 ACE_ENV_ARG_DECL_NOT_USED);
00120 virtual void system_exception (TAO_CEC_ProxyPullConsumer *proxy,
00121 CORBA::SystemException &
00122 ACE_ENV_ARG_DECL_NOT_USED);
00123
00124
00125
00126
00127
00128 virtual bool need_to_disconnect (PortableServer::ServantBase* proxy);
00129
00130
00131 virtual void successful_transmission (PortableServer::ServantBase* proxy);
00132
00133 private:
00134
00135
00136 void query_suppliers (ACE_ENV_SINGLE_ARG_DECL);
00137
00138 private:
00139
00140 ACE_Time_Value rate_;
00141
00142
00143 ACE_Time_Value timeout_;
00144
00145
00146 unsigned int retries_;
00147
00148
00149 TAO_CEC_SupplierControl_Adapter adapter_;
00150
00151
00152 TAO_CEC_EventChannel *event_channel_;
00153
00154
00155 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00156 TAO_CEC_TypedEventChannel *typed_event_channel_;
00157 #endif
00158
00159
00160 CORBA::ORB_var orb_;
00161
00162
00163 CORBA::PolicyCurrent_var policy_current_;
00164
00165
00166 CORBA::PolicyList policy_list_;
00167
00168
00169 ACE_Reactor *reactor_;
00170
00171 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00172
00173 long timer_id_;
00174 #endif
00175 };
00176
00177
00178
00179 class TAO_CEC_Ping_Push_Supplier : public TAO_ESF_Worker<TAO_CEC_ProxyPushConsumer>
00180 {
00181 public:
00182 TAO_CEC_Ping_Push_Supplier (TAO_CEC_SupplierControl *control);
00183
00184 virtual void work (TAO_CEC_ProxyPushConsumer *consumer
00185 ACE_ENV_ARG_DECL);
00186
00187 private:
00188 TAO_CEC_SupplierControl *control_;
00189 };
00190
00191
00192
00193 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00194 class TAO_CEC_Ping_Typed_Push_Supplier : public TAO_ESF_Worker<TAO_CEC_TypedProxyPushConsumer>
00195 {
00196 public:
00197 TAO_CEC_Ping_Typed_Push_Supplier (TAO_CEC_SupplierControl *control);
00198
00199 virtual void work (TAO_CEC_TypedProxyPushConsumer *consumer
00200 ACE_ENV_ARG_DECL);
00201
00202 private:
00203 TAO_CEC_SupplierControl *control_;
00204 };
00205 #endif
00206
00207
00208
00209 class TAO_CEC_Ping_Pull_Supplier : public TAO_ESF_Worker<TAO_CEC_ProxyPullConsumer>
00210 {
00211 public:
00212 TAO_CEC_Ping_Pull_Supplier (TAO_CEC_SupplierControl *control);
00213
00214 virtual void work (TAO_CEC_ProxyPullConsumer *consumer
00215 ACE_ENV_ARG_DECL);
00216
00217 private:
00218 TAO_CEC_SupplierControl *control_;
00219 };
00220
00221 TAO_END_VERSIONED_NAMESPACE_DECL
00222
00223 #if defined (__ACE_INLINE__)
00224 #include "orbsvcs/CosEvent/CEC_Reactive_SupplierControl.i"
00225 #endif
00226
00227 #include "ace/post.h"
00228
00229 #endif