ctkPluginConstants.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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 CTKPLUGINCONSTANTS_H
  16. #define CTKPLUGINCONSTANTS_H
  17. #include <QString>
  18. #include "ctkPluginFrameworkExport.h"
  19. /**
  20. * \ingroup PluginFramework
  21. */
  22. struct CTK_PLUGINFW_EXPORT ctkPluginConstants {
  23. /**
  24. * Location identifier of the CTK <i>system plugin</i>, which is defined
  25. * to be &quot;System Plugin&quot;.
  26. */
  27. static const QString SYSTEM_PLUGIN_LOCATION; // = "System Plugin"
  28. /**
  29. * Alias for the symbolic name of the CTK <i>system plugin</i>. It is
  30. * defined to be &quot;system.plugin&quot;.
  31. *
  32. */
  33. static const QString SYSTEM_PLUGIN_SYMBOLICNAME; // = "system.plugin"
  34. /**
  35. * Framework environment property identifying the Framework version.
  36. *
  37. * <p>
  38. * The value of this property may be retrieved by calling the
  39. * <code>ctkPluginContext::getProperty</code> method.
  40. */
  41. static const QString FRAMEWORK_VERSION; // = "org.commontk.pluginfw.version"
  42. /**
  43. * Framework environment property identifying the Framework implementation
  44. * vendor.
  45. *
  46. * <p>
  47. * The value of this property may be retrieved by calling the
  48. * <code>ctkPluginContext::getProperty</code> method.
  49. */
  50. static const QString FRAMEWORK_VENDOR; // = "org.commontk.pluginfw.vendor"
  51. /**
  52. * Specifies the persistent storage area used by the framework. The value of
  53. * this property must be a valid file path in the file system to a
  54. * directory. If the specified directory does not exist then the framework
  55. * will create the directory. If the specified path exists but is not a
  56. * directory or if the framework fails to create the storage directory, then
  57. * framework initialization must fail. The framework is free to use this
  58. * directory as it sees fit. This area can not be shared with anything else.
  59. * <p>
  60. * If this property is not set, the framework should use a reasonable
  61. * platform default for the persistent storage area.
  62. */
  63. static const QString FRAMEWORK_STORAGE; // = "org.commontk.pluginfw.storage"
  64. /**
  65. * Specifies if and when the persistent storage area for the framework
  66. * should be cleaned. If this property is not set, then the framework
  67. * storage area must not be cleaned.
  68. *
  69. * @see #FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT
  70. */
  71. static const QString FRAMEWORK_STORAGE_CLEAN; // = "org.commontk.pluginfw.storage.clean";
  72. /**
  73. * Specifies that the framework storage area must be cleaned before the
  74. * framework is initialized for the first time. Subsequent inits, starts or
  75. * updates of the framework will not result in cleaning the framework
  76. * storage area.
  77. */
  78. static const QString FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT; // = "onFirstInit";
  79. /**
  80. * Manifest header identifying the plugin's symbolic name.
  81. *
  82. * <p>
  83. * The attribute value may be retrieved from the <code>QHash</code>
  84. * object returned by the <code>Plugin::getHeaders()</code> method.
  85. */
  86. static const QString PLUGIN_SYMBOLICNAME; // = "Plugin-SymbolicName"
  87. /**
  88. * Manifest header identifying the plugin's copyright information.
  89. * <p>
  90. * The attribute value may be retrieved from the <code>QHash</code>
  91. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  92. */
  93. static const QString PLUGIN_COPYRIGHT; // = "Plugin-Copyright"
  94. /**
  95. * Manifest header containing a brief description of the plugin's
  96. * functionality.
  97. * <p>
  98. * The attribute value may be retrieved from the <code>QHash</code>
  99. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  100. */
  101. static const QString PLUGIN_DESCRIPTION; // = "Plugin-Description"
  102. /**
  103. * Manifest header identifying the plugin's name.
  104. * <p>
  105. * The attribute value may be retrieved from the <code>QHash</code>
  106. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  107. */
  108. static const QString PLUGIN_NAME; // = "Plugin-Name"
  109. /**
  110. * Manifest header identifying the base name of the plugin's Qt .qm
  111. * files.
  112. *
  113. * <p>
  114. * The attribute value may be retrieved from the <code>QHash</code>
  115. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  116. *
  117. * @see #PLUGIN_LOCALIZATION_DEFAULT_BASENAME
  118. */
  119. static const QString PLUGIN_LOCALIZATION; // = "Plugin-Localization"
  120. /**
  121. * Default value for the <code>Plugin-Localization</code> manifest header.
  122. *
  123. * @see #PLUGIN_LOCALIZATION
  124. */
  125. static const QString PLUGIN_LOCALIZATION_DEFAULT_BASENAME; // = "CTK-INF/l10n/plugin"
  126. /**
  127. * Manifest header identifying the symbolic names of other plugins required
  128. * by the plugin.
  129. *
  130. * <p>
  131. * The attribute value may be retrieved from the <code>QHash</code>
  132. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  133. *
  134. */
  135. static const QString REQUIRE_PLUGIN; // = "Require-Plugin"
  136. /**
  137. * Manifest header attribute identifying a range of versions for a plugin
  138. * specified in the <code>Require-Plugin</code> manifest headers.
  139. * The default value is <code>0.0.0</code>.
  140. *
  141. * <p>
  142. * The attribute value is encoded in the Require-Plugin manifest header
  143. * like:
  144. *
  145. * <pre>
  146. * Require-Plugin: com.acme.module.test; plugin-version=&quot;1.1&quot;
  147. * Require-Plugin: com.acme.module.test; plugin-version=&quot;[1.0,2.0)&quot;
  148. * </pre>
  149. *
  150. * <p>
  151. * The plugin-version attribute value uses a mathematical interval notation
  152. * to specify a range of plugin versions. A plugin-version attribute value
  153. * specified as a single version means a version range that includes any
  154. * plugin version greater than or equal to the specified version.
  155. *
  156. * @see #REQUIRE_PLUGIN
  157. */
  158. static const QString PLUGIN_VERSION_ATTRIBUTE; // = "plugin-version"
  159. /**
  160. * Manifest header identifying the plugin's version.
  161. *
  162. * <p>
  163. * The attribute value may be retrieved from the <code>QHash</code>
  164. * object returned by the <code>ctkPlugin::getHeaders()</code> method.
  165. */
  166. static const QString PLUGIN_VERSION; // = "Plugin-Version"
  167. /**
  168. * Manifest header identifying the plugin's activation policy.
  169. * <p>
  170. * The attribute value may be retrieved from the <code>QHash</code>
  171. * object returned by the <code>Plugin::getHeaders()</code> method.
  172. *
  173. * @see #ACTIVATION_EAGER
  174. */
  175. static const QString PLUGIN_ACTIVATIONPOLICY; // = "Plugin-ActivationPolicy"
  176. /**
  177. * Plugin activation policy declaring the plugin must be activated when the
  178. * first object is instantiated from the plugin.
  179. * <p>
  180. * A plugin with the lazy (default) activation policy
  181. * will wait in the ctkPlugin#STARTING state until the first
  182. * class instantiation from the plugin occurs. The plugin will then be activated
  183. * before the instance is returned to the requester.
  184. * <p>
  185. * A plugin with the eager activation policy that is started with the
  186. * ctkPlugin#START_ACTIVATION_POLICY option will be activating immediately when
  187. * the framework is started.
  188. * <p>
  189. * The activation policy value is specified as in the
  190. * Plugin-ActivationPolicy manifest header like:
  191. *
  192. * <pre>
  193. * Plugin-ActivationPolicy: eager
  194. * </pre>
  195. *
  196. * @see #PLUGIN_ACTIVATIONPOLICY
  197. * @see ctkPlugin#start(int)
  198. * @see ctkPlugin#START_ACTIVATION_POLICY
  199. */
  200. static const QString ACTIVATION_EAGER; // = "eager"
  201. /**
  202. * Manifest header directive identifying the resolution type in the
  203. * Require-Plugin manifest header. The default value is
  204. * {@link #RESOLUTION_MANDATORY mandatory}.
  205. *
  206. * <p>
  207. * The directive value is encoded in the Require-Plugin
  208. * manifest header like:
  209. *
  210. * <pre>
  211. * Require-Plugin: com.acme.module.test; resolution:=&quot;optional&quot;
  212. * </pre>
  213. *
  214. * @see #REQUIRE_PLUGIN
  215. * @see #RESOLUTION_MANDATORY
  216. * @see #RESOLUTION_OPTIONAL
  217. */
  218. static const QString RESOLUTION_DIRECTIVE; // = "resolution"
  219. /**
  220. * Manifest header directive value identifying a mandatory resolution type.
  221. * A mandatory resolution type indicates that the required plugin
  222. * must be resolved when the plugin is resolved. If such a
  223. * require plugin cannot be resolved, the module fails to resolve.
  224. *
  225. * <p>
  226. * The directive value is encoded in the Require-Plugin
  227. * manifest header like:
  228. *
  229. * <pre>
  230. * Require-Plugin: com.acme.module.test; resolution:=&quot;manditory&quot;
  231. * </pre>
  232. *
  233. * @see #RESOLUTION_DIRECTIVE
  234. */
  235. static const QString RESOLUTION_MANDATORY; // = "mandatory"
  236. /**
  237. * Manifest header directive value identifying an optional resolution type.
  238. * An optional resolution type indicates that the require plugin
  239. * is optional and the plugin may be resolved without the require
  240. * plugin being resolved. If the require plugin is not resolved
  241. * when the plugin is resolved, therequire plugin may not be
  242. * resolved before the plugin is refreshed.
  243. *
  244. * <p>
  245. * The directive value is encoded in the Require-Plugin
  246. * manifest header like:
  247. *
  248. * <pre>
  249. * Require-Plugin: com.acme.module.test; resolution:=&quot;optional&quot;
  250. * </pre>
  251. *
  252. * @see #RESOLUTION_DIRECTIVE
  253. */
  254. static const QString RESOLUTION_OPTIONAL; // = "optional"
  255. /**
  256. * Service property identifying all of the class names under which a service
  257. * was registered in the Framework. The value of this property must be of
  258. * type <code>QStringList</code>.
  259. *
  260. * <p>
  261. * This property is set by the Framework when a service is registered.
  262. */
  263. static const QString OBJECTCLASS; // = "objectclass"
  264. /**
  265. * Service property identifying a service's registration number. The value
  266. * of this property must be of type <code>qlonglong</code>.
  267. *
  268. * <p>
  269. * The value of this property is assigned by the Framework when a service is
  270. * registered. The Framework assigns a unique value that is larger than all
  271. * previously assigned values since the Framework was started. These values
  272. * are NOT persistent across restarts of the Framework.
  273. */
  274. // ATTENTION!!! If the value is changed, change also ctkEventConstants::SERVICE_ID
  275. static const QString SERVICE_ID; // = "service.id"
  276. /**
  277. * Service property identifying a service's persistent identifier.
  278. *
  279. * <p>
  280. * This property may be supplied in the <code>properties</code>
  281. * <code>ctkDictionary</code> object passed to the
  282. * <code>ctkPluginContext#registerService</code> method. The value of this
  283. * property must be of type <code>QString</code> or <code>QStringList</code>.
  284. *
  285. * <p>
  286. * A service's persistent identifier uniquely identifies the service and
  287. * persists across multiple Framework invocations.
  288. *
  289. * <p>
  290. * By convention, every plugin has its own unique namespace, starting with
  291. * the plugin's identifier (see {@link ctkPlugin#getPluginId}) and followed by
  292. * a dot (.). A plugin may use this as the prefix of the persistent
  293. * identifiers for the services it registers.
  294. */
  295. // ATTENTION!!! If the value is changed, change also ctkEventConstants::SERVICE_PID
  296. static const QString SERVICE_PID; // = "service.pid"
  297. /**
  298. * Service property identifying a service's ranking number.
  299. *
  300. * <p>
  301. * This property may be supplied in the
  302. * <code>ctkDictionary</code> object passed to the
  303. * <code>ctkPluginContext::registerService</code> method. The value of this
  304. * property must be of type <code>int</code>.
  305. *
  306. * <p>
  307. * The service ranking is used by the Framework to determine the <i>natural
  308. * order</i> of services, see {@link ctkServiceReference::operator<(const ctkServiceReference&)},
  309. * and the <i>default</i> service to be returned from a call to the
  310. * {@link ctkPluginContext::getServiceReference} method.
  311. *
  312. * <p>
  313. * The default ranking is zero (0). A service with a ranking of
  314. * <code>std::numeric_limits<int>::max()</code> is very likely to be returned as the
  315. * default service, whereas a service with a ranking of
  316. * <code>std::numeric_limits<int>::min()</code> is very unlikely to be returned.
  317. *
  318. * <p>
  319. * If the supplied property value is not of type <code>int</code>, it is
  320. * deemed to have a ranking value of zero.
  321. */
  322. static const QString SERVICE_RANKING; // = "service.ranking"
  323. /**
  324. * Service property identifying a service's vendor.
  325. *
  326. * <p>
  327. * This property may be supplied in the properties <code>ctkDictionary</code> object
  328. * passed to the <code>ctkPluginContext::registerService()</code> method.
  329. */
  330. static const QString SERVICE_VENDOR; // = "service.vendor"
  331. /**
  332. * Service property identifying a service's description.
  333. *
  334. * <p>
  335. * This property may be supplied in the properties <code>ctkDictionary</code> object
  336. * passed to the <code>ctkPluginContext::registerService()</code> method.
  337. */
  338. static const QString SERVICE_DESCRIPTION; // = "service.description"
  339. };
  340. #endif // CTKPLUGINCONSTANTS_H