ctkPluginConstants.h 10 KB

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