ctkPluginConstants.h 15 KB

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