ctkPluginConstants.h 12 KB

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