ctkEventConstants.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKEVENTCONSTANTS_H
  16. #define CTKEVENTCONSTANTS_H
  17. #include <QString>
  18. #include "ctkPluginFrameworkExport.h"
  19. /**
  20. * \ingroup EventAdmin
  21. *
  22. * Defines standard names for <code>ctkEventHandler</code> and Qt event slot properties.
  23. *
  24. * \see ctkEventHandler
  25. * \see ctkEventAdmin::subscribeSlot()
  26. */
  27. struct CTK_PLUGINFW_EXPORT ctkEventConstants {
  28. /**
  29. * Qt slot property (named <code>event.topics</code>)
  30. * specifying the <code>ctkEvent</code> topics of interest to a
  31. * subscribed slot.
  32. * <p>
  33. * Subscribed slots SHOULD be registered with this property. The value of the
  34. * property is a QString or a QStringList that describes the topics in
  35. * which the handler is interested. An asterisk ('*') may be used as a
  36. * trailing wildcard. Subscribed slots which do not have a value for this
  37. * property must not receive events. More precisely, the value of each
  38. * string must conform to the following grammar:
  39. *
  40. * <pre>
  41. * topic-description := '*' | topic ( '&#47*' )?
  42. * topic := token ( '/' token )*
  43. * </pre>
  44. *
  45. * @see ctkEvent
  46. */
  47. static const QString EVENT_TOPIC; // = "event.topics"
  48. /**
  49. * Qt slot property (named <code>event.filter</code>)
  50. * specifying a filter to further select <code>ctkEvent</code> s of interest to
  51. * a subscribed slot.
  52. * <p>
  53. * Subscribed slots MAY be registered with this property. The value of this
  54. * property is a QString containing an LDAP-style filter specification. Any
  55. * of the event's properties may be used in the filter expression. Each
  56. * subscribed slot is notified for any event which belongs to the topics in
  57. * which the slot has expressed an interest. If the slot is also
  58. * registered with this property, then the properties of the event
  59. * must also match the filter for the event to be delivered to the slot.
  60. * <p>
  61. * If the filter syntax is invalid, then the slot must be ignored
  62. * and a warning should be logged.
  63. *
  64. * @see ctkEvent
  65. * @see ctkLDAPSearchFilter
  66. */
  67. static const QString EVENT_FILTER; // = "event.filter"
  68. /**
  69. * Service Registration property specifying the delivery qualities requested
  70. * by an Event Handler service.
  71. * <p>
  72. * Event handlers MAY be registered with this property. Each value of this
  73. * property is a string specifying a delivery quality for the Event handler.
  74. *
  75. * <p>
  76. * The value of this property must be of type <code>QString</code> or
  77. * <code>QStringList</code>.
  78. *
  79. * @see #DELIVERY_ASYNC_ORDERED
  80. * @see #DELIVERY_ASYNC_UNORDERED
  81. */
  82. static const QString EVENT_DELIVERY; // = "event.delivery"
  83. /**
  84. * Event Handler delivery quality value specifying the Event Handler
  85. * requires asynchronously delivered events be delivered in order. Ordered
  86. * delivery is the default for asynchronously delivered events.
  87. *
  88. * <p>
  89. * This delivery quality value is mutually exclusive with
  90. * {@link #DELIVERY_ASYNC_UNORDERED}. However, if both this value and
  91. * {@link #DELIVERY_ASYNC_UNORDERED} are specified for an event handler,
  92. * this value takes precedence.
  93. *
  94. * @see #EVENT_DELIVERY
  95. */
  96. static const QString DELIVERY_ASYNC_ORDERED; // = "async.ordered"
  97. /**
  98. * Event Handler delivery quality value specifying the Event Handler does
  99. * not require asynchronously delivered events be delivered in order. This
  100. * may allow an Event Admin implementation to optimize asynchronous event
  101. * delivery by relaxing ordering requirements.
  102. *
  103. * <p>
  104. * This delivery quality value is mutually exclusive with
  105. * {@link #DELIVERY_ASYNC_ORDERED}. However, if both this value and
  106. * {@link #DELIVERY_ASYNC_ORDERED} are specified for an event handler,
  107. * {@link #DELIVERY_ASYNC_ORDERED} takes precedence.
  108. *
  109. * @see #EVENT_DELIVERY
  110. */
  111. static const QString DELIVERY_ASYNC_UNORDERED; // = "async.unordered"
  112. /**
  113. * The Plugin Symbolic Name of the plugin relevant to the event. The type of
  114. * the value for this event property is <code>QString</code>.
  115. */
  116. static const QString PLUGIN_SYMBOLICNAME; // = "plugin.symbolicName"
  117. /**
  118. * The Plugin id of the plugin relevant to the event. The type of the value
  119. * for this event property is <code>long</code>.
  120. */
  121. static const QString PLUGIN_ID; // = "plugin.id"
  122. /**
  123. * The ctkPlugin object of the plugin relevant to the event. The type of the
  124. * value for this event property is <code>QSharedPointer<ctkPlugin></code>.
  125. */
  126. static const QString PLUGIN; // = "plugin"
  127. /**
  128. * The version of the plugin relevant to the event. The type of the value
  129. * for this event property is {@link ctkVersion}.
  130. */
  131. static const QString PLUGIN_VERSION; // = "plugin.version"
  132. /**
  133. * The forwarded event object. Used when rebroadcasting an event that was
  134. * sent via some other event mechanism. The type of the value for this event
  135. * property depends on the event topic (for org/commontk/PluginEvent/&0x42; the
  136. * the type will be ctkPluginEvent).
  137. */
  138. static const QString EVENT; // = "event"
  139. /**
  140. * An exception or error. The type of the value for this event property is
  141. * <code>ctkRuntimeException</code>.
  142. */
  143. static const QString EXCEPTION; // = "exception"
  144. /**
  145. * The name of the exception type. Must be equal to the name of the class of
  146. * the exception in the event property {@link #EXCEPTION}. The type of the
  147. * value for this event property is <code>QString</code>.
  148. */
  149. static const QString EXCEPTION_CLASS; // = "exception.class"
  150. /**
  151. * The exception message. Must be equal to the result of calling
  152. * <code>what()</code> on the exception in the event property
  153. * {@link #EXCEPTION}. The type of the value for this event property is
  154. * <code>QString</code>.
  155. */
  156. static const QString EXCEPTION_MESSAGE; // = "exception.message"
  157. /**
  158. * A human-readable message that is usually not localized. The type of the
  159. * value for this event property is <code>QString</code>.
  160. */
  161. static const QString MESSAGE; // = "message"
  162. /**
  163. * A service reference. The type of the value for this event property is
  164. * {@link ctkServiceReference}.
  165. */
  166. static const QString SERVICE; // = "service"
  167. /**
  168. * A service's id. The type of the value for this event property is
  169. * <code>long</code>.
  170. */
  171. static const QString SERVICE_ID; // = ctkPluginConstants::SERVICE_ID
  172. /**
  173. * A service's objectClass. The type of the value for this event property is
  174. * <code>QStringList</code>.
  175. */
  176. static const QString SERVICE_OBJECTCLASS; // = "service.objectClass"
  177. /**
  178. * A service's persistent identity. The type of the value for this event
  179. * property is <code>QString</code>.
  180. */
  181. static const QString SERVICE_PID; // = ctkPluginConstants::SERVICE_PID
  182. /**
  183. * The time when the event occurred, as reported by
  184. * <code>QDateTime::currentDateTime()</code>. The type of the value for this
  185. * event property is <code>QDateTime</code>.
  186. */
  187. static const QString TIMESTAMP; // = "timestamp"
  188. };
  189. #endif // CTKEVENTCONSTANTS_H