ctkPluginConstants.h 16 KB

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