ctkPluginArchive_p.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 CTKPLUGINARCHIVE_P_H
  16. #define CTKPLUGINARCHIVE_P_H
  17. #include <QHash>
  18. #include <QUrl>
  19. #include <QDateTime>
  20. /**
  21. * \ingroup PluginFramework
  22. *
  23. * Interface for managing plugin data.
  24. *
  25. */
  26. class ctkPluginArchive
  27. {
  28. public:
  29. /**
  30. * Autostart setting stopped.
  31. * @see ctkPluginArchive#setAutostartSetting(const QString&)
  32. */
  33. static const QString AUTOSTART_SETTING_STOPPED; // = "stopped"
  34. /**
  35. * Autostart setting eager.
  36. * @see ctkPluginArchive#setAutostartSetting(const QString&)
  37. */
  38. static const QString AUTOSTART_SETTING_EAGER; // = "eager"
  39. /**
  40. * Autostart setting declared activation policy.
  41. * @see ctkPluginArchive#setAutostartSetting(const QString&)
  42. */
  43. static const QString AUTOSTART_SETTING_ACTIVATION_POLICY; // = "activation_policy"
  44. virtual ~ctkPluginArchive() {}
  45. /**
  46. * Get an attribute from the manifest of a plugin.
  47. *
  48. * Not localized
  49. *
  50. * @param key Name of attribute to get.
  51. * @return A string with result or null if the entry doesn't exists.
  52. */
  53. virtual QString getAttribute(const QString& key) const = 0;
  54. /**
  55. * @returns the (raw/unlocalized) attributes
  56. */
  57. virtual QHash<QString,QString> getUnlocalizedAttributes() const = 0;
  58. /**
  59. * Get the plugin generation associated with this plugin archive.
  60. *
  61. * @return A integer representing the generation.
  62. */
  63. virtual int getPluginGeneration() const = 0;
  64. /**
  65. * Get plugin identifier for this plugin archive.
  66. *
  67. * @return ctkPlugin identifier.
  68. */
  69. virtual int getPluginId() const = 0;
  70. /**
  71. * Get plugin location for this plugin archive.
  72. *
  73. * @return Bundle location.
  74. */
  75. virtual QUrl getPluginLocation() const = 0;
  76. /**
  77. * Get the path to the plugin library on the local
  78. * file system
  79. *
  80. * @return Path to the plugin library
  81. */
  82. virtual QString getLibLocation() const = 0;
  83. /**
  84. * Get a Qt resource as a byte array from a plugin. The resource
  85. * is cached and may be aquired even if the plugin is not active.
  86. *
  87. * @param component Resource to get the byte array from.
  88. * @return QByteArray to the entry (empty if it doesn't exist).
  89. */
  90. virtual QByteArray getPluginResource(const QString& component) const = 0;
  91. /**
  92. * Returns a QStringList of all the paths
  93. * to entries within the plugin whose longest sub-path matches the supplied
  94. * path argument.
  95. *
  96. * @param name
  97. * @return
  98. */
  99. virtual QStringList findResourcesPath(const QString& path) const = 0;
  100. /**
  101. * Get stored plugin start level.
  102. */
  103. virtual int getStartLevel() const = 0;
  104. /**
  105. * Set stored plugin start level.
  106. */
  107. virtual void setStartLevel(int level) = 0;
  108. /**
  109. * Get last modified timestamp.
  110. */
  111. virtual QDateTime getLastModified() const = 0;
  112. /**
  113. * Set stored last modified timestamp.
  114. */
  115. virtual void setLastModified(const QDateTime& timemillisecs) = 0;
  116. /**
  117. * Get auto-start setting.
  118. *
  119. * @return the autostart setting. "-1" if the plugin is not started.
  120. */
  121. virtual int getAutostartSetting() const = 0;
  122. /**
  123. * Set the auto-start setting.
  124. *
  125. * @param setting the autostart setting to use.
  126. */
  127. virtual void setAutostartSetting(int setting) = 0;
  128. /**
  129. * Get certificate chains associated with a plugin.
  130. *
  131. * @param onlyTrusted Only return trusted certificates.
  132. * @return All certificates or null if bundle is unsigned.
  133. */
  134. //QList<> getCertificateChains(bool onlyTrusted) const;
  135. /**
  136. * Mark certificate associated with the plugin as trusted.
  137. *
  138. */
  139. //void trustCertificateChain(QList<> trustedChain);
  140. /**
  141. * Remove plugin from persistent storage.
  142. */
  143. virtual void purge() = 0;
  144. /**
  145. * Close archive and all its open files.
  146. */
  147. virtual void close() = 0;
  148. };
  149. #endif // CTKPLUGINARCHIVE_P_H