ctkPluginConstants.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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 plugin's vendor.
  111. *
  112. * <p>
  113. * The header value may be retrieved from the <code>QHash</code> object
  114. * returned by the <code>ctkPlugin::getHeaders</code> method.
  115. */
  116. static const QString PLUGIN_VENDOR; // = "Plugin-Vendor"
  117. /**
  118. * Manifest header identifying the base name of the plugin's Qt .qm
  119. * files.
  120. *
  121. * <p>
  122. * The attribute value may be retrieved from the <code>QHash</code>
  123. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  124. *
  125. * @see #PLUGIN_LOCALIZATION_DEFAULT_BASENAME
  126. */
  127. static const QString PLUGIN_LOCALIZATION; // = "Plugin-Localization"
  128. /**
  129. * Default value for the <code>Plugin-Localization</code> manifest header.
  130. *
  131. * @see #PLUGIN_LOCALIZATION
  132. */
  133. static const QString PLUGIN_LOCALIZATION_DEFAULT_BASENAME; // = "CTK-INF/l10n/plugin"
  134. /**
  135. * Manifest header identifying the symbolic names of other plugins required
  136. * by the plugin.
  137. *
  138. * <p>
  139. * The attribute value may be retrieved from the <code>QHash</code>
  140. * object returned by the <code>ctkPlugin::getHeaders</code> method.
  141. *
  142. */
  143. static const QString REQUIRE_PLUGIN; // = "Require-Plugin"
  144. /**
  145. * Manifest header attribute identifying a range of versions for a plugin
  146. * specified in the <code>Require-Plugin</code> manifest headers.
  147. * The default value is <code>0.0.0</code>.
  148. *
  149. * <p>
  150. * The attribute value is encoded in the Require-Plugin manifest header
  151. * like:
  152. *
  153. * <pre>
  154. * Require-Plugin: com.acme.module.test; plugin-version=&quot;1.1&quot;
  155. * Require-Plugin: com.acme.module.test; plugin-version=&quot;[1.0,2.0)&quot;
  156. * </pre>
  157. *
  158. * <p>
  159. * The plugin-version attribute value uses a mathematical interval notation
  160. * to specify a range of plugin versions. A plugin-version attribute value
  161. * specified as a single version means a version range that includes any
  162. * plugin version greater than or equal to the specified version.
  163. *
  164. * @see #REQUIRE_PLUGIN
  165. */
  166. static const QString PLUGIN_VERSION_ATTRIBUTE; // = "plugin-version"
  167. /**
  168. * Manifest header identifying the plugin's version.
  169. *
  170. * <p>
  171. * The attribute value may be retrieved from the <code>QHash</code>
  172. * object returned by the <code>ctkPlugin::getHeaders()</code> method.
  173. */
  174. static const QString PLUGIN_VERSION; // = "Plugin-Version"
  175. /**
  176. * Manifest header identifying the plugin's activation policy.
  177. * <p>
  178. * The attribute value may be retrieved from the <code>QHash</code>
  179. * object returned by the <code>Plugin::getHeaders()</code> method.
  180. *
  181. * @see #ACTIVATION_EAGER
  182. */
  183. static const QString PLUGIN_ACTIVATIONPOLICY; // = "Plugin-ActivationPolicy"
  184. /**
  185. * Plugin activation policy declaring the plugin must be activated immediately.
  186. *
  187. * <p>
  188. * A plugin with the eager activation policy that is started with the
  189. * ctkPlugin#START_ACTIVATION_POLICY option will be activating immediately when
  190. * the framework is started.
  191. * <p>
  192. * The activation policy value is specified as in the
  193. * Plugin-ActivationPolicy manifest header like:
  194. *
  195. * <pre>
  196. * Plugin-ActivationPolicy: eager
  197. * </pre>
  198. *
  199. * @see #PLUGIN_ACTIVATIONPOLICY
  200. * @see ctkPlugin#start(int)
  201. * @see ctkPlugin#START_ACTIVATION_POLICY
  202. */
  203. static const QString ACTIVATION_EAGER; // = "eager"
  204. /**
  205. * Plugin activation policy declaring the plugin must be activated when the
  206. * first object is instantiated from the plugin.
  207. * <p>
  208. * A plugin with the lazy activation policy that is started with the
  209. * {@link ctkPlugin#START_ACTIVATION_POLICY START_ACTIVATION_POLICY} option
  210. * will wait in the ctkPlugin#STARTING state until the first
  211. * class instantiation from the plugin occurs. The plugin will then be activated
  212. * before the instance is returned to the requester.
  213. * <p>
  214. * The lazy activation policy is the default for every plugin.
  215. *
  216. * @see #PLUGIN_ACTIVATIONPOLICY
  217. * @see ctkPlugin#start(int)
  218. * @see ctkPlugin#START_ACTIVATION_POLICY
  219. */
  220. static const QString ACTIVATION_LAZY; // = "lazy"
  221. /**
  222. * Manifest header directive identifying the resolution type in the
  223. * Require-Plugin manifest header. The default value is
  224. * {@link #RESOLUTION_MANDATORY mandatory}.
  225. *
  226. * <p>
  227. * The directive value is encoded in the Require-Plugin
  228. * manifest header like:
  229. *
  230. * <pre>
  231. * Require-Plugin: com.acme.module.test; resolution:=&quot;optional&quot;
  232. * </pre>
  233. *
  234. * @see #REQUIRE_PLUGIN
  235. * @see #RESOLUTION_MANDATORY
  236. * @see #RESOLUTION_OPTIONAL
  237. */
  238. static const QString RESOLUTION_DIRECTIVE; // = "resolution"
  239. /**
  240. * Manifest header directive value identifying a mandatory resolution type.
  241. * A mandatory resolution type indicates that the required plugin
  242. * must be resolved when the plugin is resolved. If such a
  243. * require plugin cannot be resolved, the module fails to resolve.
  244. *
  245. * <p>
  246. * The directive value is encoded in the Require-Plugin
  247. * manifest header like:
  248. *
  249. * <pre>
  250. * Require-Plugin: com.acme.module.test; resolution:=&quot;manditory&quot;
  251. * </pre>
  252. *
  253. * @see #RESOLUTION_DIRECTIVE
  254. */
  255. static const QString RESOLUTION_MANDATORY; // = "mandatory"
  256. /**
  257. * Manifest header directive value identifying an optional resolution type.
  258. * An optional resolution type indicates that the require plugin
  259. * is optional and the plugin may be resolved without the require
  260. * plugin being resolved. If the require plugin is not resolved
  261. * when the plugin is resolved, therequire plugin may not be
  262. * resolved before the plugin is refreshed.
  263. *
  264. * <p>
  265. * The directive value is encoded in the Require-Plugin
  266. * manifest header like:
  267. *
  268. * <pre>
  269. * Require-Plugin: com.acme.module.test; resolution:=&quot;optional&quot;
  270. * </pre>
  271. *
  272. * @see #RESOLUTION_DIRECTIVE
  273. */
  274. static const QString RESOLUTION_OPTIONAL; // = "optional"
  275. /**
  276. * Service property identifying all of the class names under which a service
  277. * was registered in the Framework. The value of this property must be of
  278. * type <code>QStringList</code>.
  279. *
  280. * <p>
  281. * This property is set by the Framework when a service is registered.
  282. */
  283. static const QString OBJECTCLASS; // = "objectclass"
  284. /**
  285. * Service property identifying a service's registration number. The value
  286. * of this property must be of type <code>qlonglong</code>.
  287. *
  288. * <p>
  289. * The value of this property is assigned by the Framework when a service is
  290. * registered. The Framework assigns a unique value that is larger than all
  291. * previously assigned values since the Framework was started. These values
  292. * are NOT persistent across restarts of the Framework.
  293. */
  294. // ATTENTION!!! If the value is changed, change also ctkEventConstants::SERVICE_ID
  295. static const QString SERVICE_ID; // = "service.id"
  296. /**
  297. * Service property identifying a service's persistent identifier.
  298. *
  299. * <p>
  300. * This property may be supplied in the <code>properties</code>
  301. * <code>ctkDictionary</code> object passed to the
  302. * <code>ctkPluginContext#registerService</code> method. The value of this
  303. * property must be of type <code>QString</code> or <code>QStringList</code>.
  304. *
  305. * <p>
  306. * A service's persistent identifier uniquely identifies the service and
  307. * persists across multiple Framework invocations.
  308. *
  309. * <p>
  310. * By convention, every plugin has its own unique namespace, starting with
  311. * the plugin's identifier (see ctkPlugin::getPluginId) and followed by
  312. * a dot (.). A plugin may use this as the prefix of the persistent
  313. * identifiers for the services it registers.
  314. */
  315. // ATTENTION!!! If the value is changed, change also ctkEventConstants::SERVICE_PID
  316. static const QString SERVICE_PID; // = "service.pid"
  317. /**
  318. * Service property identifying a service's ranking number.
  319. *
  320. * <p>
  321. * This property may be supplied in the
  322. * <code>ctkDictionary</code> object passed to the
  323. * <code>ctkPluginContext::registerService</code> method. The value of this
  324. * property must be of type <code>int</code>.
  325. *
  326. * <p>
  327. * The service ranking is used by the Framework to determine the <i>natural
  328. * order</i> of services, see ctkServiceReference::operator<(const ctkServiceReference&),
  329. * and the <i>default</i> service to be returned from a call to the
  330. * {@link ctkPluginContext::getServiceReference} method.
  331. *
  332. * <p>
  333. * The default ranking is zero (0). A service with a ranking of
  334. * <code>std::numeric_limits<int>::max()</code> is very likely to be returned as the
  335. * default service, whereas a service with a ranking of
  336. * <code>std::numeric_limits<int>::min()</code> is very unlikely to be returned.
  337. *
  338. * <p>
  339. * If the supplied property value is not of type <code>int</code>, it is
  340. * deemed to have a ranking value of zero.
  341. */
  342. static const QString SERVICE_RANKING; // = "service.ranking"
  343. /**
  344. * Service property identifying a service's vendor.
  345. *
  346. * <p>
  347. * This property may be supplied in the properties <code>ctkDictionary</code> object
  348. * passed to the <code>ctkPluginContext::registerService()</code> method.
  349. */
  350. static const QString SERVICE_VENDOR; // = "service.vendor"
  351. /**
  352. * Service property identifying a service's description.
  353. *
  354. * <p>
  355. * This property may be supplied in the properties <code>ctkDictionary</code> object
  356. * passed to the <code>ctkPluginContext::registerService()</code> method.
  357. */
  358. static const QString SERVICE_DESCRIPTION; // = "service.description"
  359. };
  360. #endif // CTKPLUGINCONSTANTS_H