00001 /** 00002 * @file RtecEventChannelAdmin.idl 00003 * 00004 * @brief Define the RtecEventChannelAdmin module 00005 * 00006 * RtecEventChannelAdmin.idl,v 1.16 2004/01/07 19:48:04 boris Exp 00007 * 00008 * TAO's Real-time Event Service is described in: 00009 * 00010 * http://doc.ece.uci.edu/~coryan/EC/ 00011 * 00012 * @author Carlos O'Ryan <coryan@uci.edu> 00013 * @author Tim Harrison <harrison@cs.wustl.edu> 00014 */ 00015 00016 #ifndef TAO_RTEC_EVENTCHANNELADMIN_IDL 00017 #define TAO_RTEC_EVENTCHANNELADMIN_IDL 00018 00019 #include "RtecEventComm.idl" 00020 #include "RtecBase.idl" 00021 00022 /** 00023 * @namespace RtecEventChannelAdmin 00024 * 00025 * @brief Interfaces and data structures provided by TAO's Real-time 00026 * Event Service implementation 00027 */ 00028 module RtecEventChannelAdmin 00029 { 00030 /** 00031 * @exception AlreadyConnected 00032 * 00033 * @brief Exception raised if a consumer or supplier tries to 00034 * reconnect even though it is connected already. 00035 * 00036 * In some configurations the Event Channel implementation allows 00037 * reconnections, and treats them as changes in the QoS properties 00038 * of the client. This exception is not used in those cases. 00039 */ 00040 exception AlreadyConnected {}; 00041 00042 /** 00043 * @struct Dependency 00044 * 00045 * @brief Encapsulate the parameters of a consumer QoS property 00046 * 00047 * This structure is used to represent both filtering information 00048 * and the QoS requirements that the consumer has for events that 00049 * pass the filter. 00050 * 00051 * @todo It has become painfully obvious that we don't need a 00052 * complete RtecEventComm::Event to declare the dependency, simply 00053 * the EventHeader would do. 00054 */ 00055 struct Dependency 00056 { 00057 /// The filtering information, usually takes the form of an event 00058 /// type and/or source that the consumer is interested in. 00059 RtecEventComm::Event event; 00060 00061 /// The handle to the RT_Info structure that describes the 00062 /// behavior of the consumer upon receiving such an event 00063 /** 00064 * This handle is ignored for Event Channels configured without an 00065 * scheduling service. 00066 */ 00067 RtecBase::handle_t rt_info; 00068 }; 00069 00070 /// Define a list of consumer QoS properties 00071 typedef sequence<Dependency> DependencySet; 00072 00073 /** 00074 * @struct ConsumerQOS 00075 * 00076 * @brief Define the complete QoS properties of a consumer 00077 * 00078 * Consumers declared their QoS properties using a DependencySet and 00079 * a special flag to indicate if they are a gateway consumer. 00080 * Gateway consumers are ignored in the computation of changes to 00081 * the subscription list. 00082 */ 00083 struct ConsumerQOS 00084 { 00085 /// List of QoS, filtering, correlation and timeouts for this 00086 /// consumer. 00087 DependencySet dependencies; 00088 00089 /// If TRUE the consumer is a gateway, i.e., it forwards events 00090 /// from a remote peer. 00091 boolean is_gateway; 00092 }; 00093 00094 /** 00095 * @struct Publication 00096 * 00097 * @brief Encapsulate one supplier publication and the QoS 00098 * properties for that publication. 00099 * 00100 * Suppliers can publish multiple event types, each one with 00101 * different QoS properties. 00102 * 00103 * @todo It has become painfully obvious that we don't need a 00104 * complete RtecEventComm::Event to declare the publication, simply 00105 * the EventHeader would do. 00106 */ 00107 struct Publication 00108 { 00109 /// The event publication, normally only the event source and type 00110 /// (from the header) is considered. 00111 RtecEventComm::Event event; 00112 00113 /// The dependency information, this includes the RT_Info handle, 00114 /// the type of request and other details. 00115 /** 00116 * This field is ignored by event channels configured without an 00117 * scheduling service. 00118 */ 00119 RtecBase::Dependency_Info dependency_info; 00120 }; 00121 00122 /// A list of Publication structures 00123 typedef sequence<Publication> PublicationSet; 00124 00125 /** 00126 * @struct SupplierQOS 00127 * 00128 * @brief Describe the complete QoS and filtering properties for a 00129 * supplier 00130 * 00131 * Consumers declared their QoS properties and publications using a 00132 * PublicationSet and a special flag to indicate if they are a 00133 * gateway supplier. 00134 * Gateway suppliers are ignored in the computation of changes to 00135 * the publication list. 00136 */ 00137 struct SupplierQOS 00138 { 00139 /// The publications 00140 PublicationSet publications; 00141 00142 /// Set to TRUE if the supplier is a gateway. 00143 boolean is_gateway; 00144 }; 00145 00146 /** 00147 * @exception TypeError 00148 * 00149 * @brief Obsolete exception 00150 */ 00151 exception TypeError {}; 00152 00153 /** 00154 * @interface ProxyPushSupplier 00155 * 00156 * @brief Interface used to implement the Abstract Session pattern 00157 * for the consumers 00158 * 00159 * Each consumer converse with the Event Channel via a different 00160 * object that implements the ProxyPushSupplier interface. This is 00161 * a common idiom in CORBA, as it allows the identification of the 00162 * remove consumer efficiently. 00163 */ 00164 interface ProxyPushSupplier : RtecEventComm::PushSupplier 00165 { 00166 /// Connect a consumer with the Event Channel 00167 /** 00168 * The ConsumerQOS argument is used to setup the filtering and 00169 * QoS properties of the consumer. 00170 * 00171 * @param push_consumer The consumer that will receive the events. 00172 * @param qos The QoS properties for this consumer 00173 * @throws CORBA::BAD_PARAM if push_consumer is nil 00174 * @throws AlreadyConnected if this operation is invoked multiple 00175 * times 00176 * @todo The TypeError exception is not used and should be 00177 * removed. 00178 */ 00179 void connect_push_consumer(in RtecEventComm::PushConsumer push_consumer, 00180 in ConsumerQOS qos) 00181 raises(AlreadyConnected, TypeError); 00182 00183 /// Temporarily suspend reception of events from the Event 00184 /// Channel. 00185 /** 00186 * Calling this method is more efficient than dropping the 00187 * events when received by the consumer, and less expensive than 00188 * disconnecting and connecting again (but it is not free!!) 00189 */ 00190 void suspend_connection (); 00191 00192 /// Resume the reception of events. 00193 void resume_connection (); 00194 00195 /* 00196 //@{ 00197 void checkpoint (in RtecEventComm::SequenceNumber last_received) 00198 raises (Invalid_Checkpoint); 00199 void resend_by_sequence (in RtecEventComm::SequenceNumber last_received) 00200 raises (Invalid_Resend_Request); 00201 void resend_by_date (in RtecEventComm::Time last_timestamp) 00202 raises (Invalid_Resend_Request); 00203 //@} 00204 */ 00205 }; 00206 00207 /** 00208 * @interface ProxyPushConsumer 00209 * 00210 * @brief Interface used to implement the Abstract Session pattern 00211 * for the suppliers. 00212 * 00213 * Each supplier converse with the Event Channel via a different 00214 * object that implements the ProxyPushConsumer interface. This is 00215 * a common idiom in CORBA, as it allows identification of the 00216 * remote supplier efficiently. 00217 */ 00218 interface ProxyPushConsumer : RtecEventComm::PushConsumer 00219 { 00220 /// Connect a supplier with the Event Channel 00221 /** 00222 * @param push_supplier A callback interface, the 00223 * disconnect_push_supplier operation is called when the Event 00224 * Channel is destroyed. 00225 * @param qos This argument is used to pre-compute filtering and 00226 * QoS properties for the supplier. 00227 * 00228 * @throws CORBA::BAD_PARAM if the push_supplier argument is nil 00229 * @throws AlreadyConnected if this operation is invoked multiple 00230 * times. 00231 */ 00232 void connect_push_supplier (in RtecEventComm::PushSupplier push_supplier, 00233 in SupplierQOS qos) 00234 raises (AlreadyConnected); 00235 }; 00236 00237 /** 00238 * @interface ConsumerAdmin 00239 * 00240 * @brief Implement an Abstract Factory to create ProxyPushSupplier 00241 * objects. 00242 */ 00243 interface ConsumerAdmin 00244 { 00245 /// Create a new ProxyPushSupplier object 00246 /** 00247 * There is an inherent risk of leaking a ProxyPushSupplier 00248 * here, i.e. if the application does not call 00249 * connect_push_consumer() at all. The Event Service may choose 00250 * to reclaim ProxyPushSupplier objects that have been idle for 00251 * too long. 00252 */ 00253 ProxyPushSupplier obtain_push_supplier (); 00254 }; 00255 00256 /** 00257 * @class SupplierAdmin 00258 * 00259 * @brief Implement an Abstract Factory to create ProxyPushConsumer 00260 * objects. 00261 */ 00262 interface SupplierAdmin 00263 { 00264 /// Create a new ProxyPushConsumer object 00265 /** 00266 * There is an inherent risk of leaking a ProxyPushConsumer 00267 * here, i.e. if the application does not call 00268 * connect_push_supplier() at all. The Event Service may choose 00269 * to reclaim ProxyPushConsumer objects that have been idle for 00270 * too long. 00271 */ 00272 ProxyPushConsumer obtain_push_consumer (); 00273 }; 00274 00275 /** 00276 * @class Observer 00277 * 00278 * @brief Monitor changes in the consumer subscriptions and/or 00279 * supplier publciations. 00280 * 00281 * The event channel reports changes in its internal subscription 00282 * and/or publication list via this interface. 00283 */ 00284 interface Observer 00285 { 00286 /// A change in the list of consumers has ocurred. 00287 /** 00288 * The disjunction of the subscriptions is sent to the 00289 * observer. 00290 */ 00291 void update_consumer (in ConsumerQOS sub); 00292 00293 /// A change in the list of suppliers has ocurred. 00294 /** 00295 * The list of all the event publications is passed to the 00296 * observer. 00297 */ 00298 void update_supplier (in SupplierQOS pub); 00299 }; 00300 00301 /// Opaque identifier for a connected Observer. 00302 typedef unsigned long Observer_Handle; 00303 00304 /** 00305 * @class EventChannel 00306 * 00307 * @brief The main interface for the event service 00308 * 00309 * This class provides the main entry point for the Event Service. 00310 * The class follows a protocol similar to the COS Events Service as 00311 * described in the CORBAservices spec. 00312 */ 00313 interface EventChannel 00314 { 00315 /** 00316 * @exception SYNCHRONIZATION_ERROR 00317 * 00318 * @brief Exception raised if the Event Channel cannot acquire its 00319 * internal locks. 00320 */ 00321 exception SYNCHRONIZATION_ERROR {}; 00322 00323 /** 00324 * @exception CANT_APPEND_OBSERVER 00325 * 00326 * @brief Exception raised if the Event Channel is unable to add 00327 * an observer due to some internal limitation. 00328 */ 00329 exception CANT_APPEND_OBSERVER {}; 00330 00331 /** 00332 * @exception CANT_REMOVE_OBSERVER 00333 * 00334 * @brief Exception raised if the Event Channel is unable to remove 00335 * an observer due to some internal limitation or because the 00336 * observer cannot be found. 00337 */ 00338 exception CANT_REMOVE_OBSERVER {}; 00339 00340 //@{ 00341 /** 00342 * @name Unused exceptions 00343 * 00344 * @todo The following exceptions are not declared in any raises() 00345 * clause, therefore they cannot be raised! They should be 00346 * removed or added to the right places. 00347 */ 00348 00349 /// Exception raised if the QOS properties required are invalid or 00350 /// cannot be satisfied 00351 exception QOS_ERROR {}; 00352 00353 /// Exception raised if the subscriptions are invalid 00354 exception SUBSCRIPTION_ERROR {}; 00355 00356 /// Exception raised if the requested correlation (a form of 00357 /// filtering) is invalid 00358 exception CORRELATION_ERROR {}; 00359 00360 /// Exception raised if the event cannot be dispatched 00361 exception DISPATCH_ERROR {}; 00362 //@} 00363 00364 /// Consumers call this method to gain access to the 00365 /// ProxyPushSupplier factory. 00366 ConsumerAdmin for_consumers (); 00367 00368 /// Suppliers call this method to gain access to the 00369 /// ProxyPushConsumer factory. 00370 SupplierAdmin for_suppliers (); 00371 00372 /// Shuts down the Event Channel. 00373 /** 00374 * Calling this methods destroys the event service, all its 00375 * resource and results in a call to disconnect_push_XXX() on all 00376 * connected clients. 00377 */ 00378 void destroy (); 00379 00380 /// Add an observer to the event channel. 00381 /** 00382 * Return the handle used in the remove_observer() call. 00383 */ 00384 Observer_Handle append_observer (in Observer gw) 00385 raises (SYNCHRONIZATION_ERROR,CANT_APPEND_OBSERVER); 00386 00387 /// Remove the observer. 00388 void remove_observer (in Observer_Handle gw) 00389 raises (SYNCHRONIZATION_ERROR,CANT_REMOVE_OBSERVER); 00390 }; 00391 }; 00392 00393 #endif /* TAO_RTEC_EVENTCHANNELADMIN_IDL */