ctkPluginConstants.h 12 KB

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