ctkEventConstants.h 7.6 KB

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