ctkPluginConstants.h 11 KB

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