ctkPluginArchiveInterface_p.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #ifndef CTKPLUGINARCHIVEINTERFACE_P_H
  2. #define CTKPLUGINARCHIVEINTERFACE_P_H
  3. #include <QString>
  4. typedef quint64 qtimestamp;
  5. /**
  6. * Interface for managing plugin data.
  7. *
  8. */
  9. struct PluginArchiveInterface {
  10. /**
  11. * Autostart setting stopped.
  12. * @see PluginArchiveInterface#setAutostartSetting(const QString&)
  13. */
  14. static const QString AUTOSTART_SETTING_STOPPED; // = "stopped"
  15. /**
  16. * Autostart setting eager.
  17. * @see PluginArchiveInterface#setAutostartSetting(const QString&)
  18. */
  19. static const QString AUTOSTART_SETTING_EAGER; // = "eager"
  20. /**
  21. * Autostart setting declared activation policy.
  22. * @see PluginArchiveInterface#setAutostartSetting(const QString&)
  23. */
  24. static const QString AUTOSTART_SETTING_ACTIVATION_POLICY; // = "activation_policy"
  25. /**
  26. * Get an attribute from the manifest of a plugin.
  27. *
  28. * Not localized
  29. *
  30. * @param key Name of attribute to get.
  31. * @return A string with result or null if the entry doesn't exists.
  32. */
  33. QString getAttribute(const QString& key) const = 0;
  34. /**
  35. * Gets all localization entries from this plugin. Will typically
  36. * read the file OSGI-INF/plugin_&lt;locale&gt;.properties.
  37. *
  38. * @param localeFile Filename within archive for localization properties.
  39. * @return null or a mapping of the entries.
  40. */
  41. QHash<QString,QString> getLocalizationEntries(const QString& localeFile) const = 0;
  42. /**
  43. * @returns the (raw/unlocalized) attributes
  44. */
  45. QHash<QString,QString> getUnlocalizedAttributes() const = 0;
  46. /**
  47. * Get plugin identifier for this plugin archive.
  48. *
  49. * @return Plugin identifier.
  50. */
  51. int getPluginId() const = 0;
  52. /**
  53. * Get bundle location for this plugin archive.
  54. *
  55. * @return Bundle location.
  56. */
  57. QString getPluginLocation() const = 0;
  58. /**
  59. * Get a QIODevice to a named entry inside a plugin.
  60. * Leading '/' is stripped.
  61. *
  62. * @param component Entry to get reference to.
  63. * @return QIODevice to entry or null if it doesn't exist.
  64. */
  65. QIODevice* getPluginResource(const QString& component) const = 0;
  66. /**
  67. * Returns a QStringList of all the paths
  68. * to entries within the plugin whose longest sub-path matches the supplied
  69. * path argument.
  70. *
  71. * @param name
  72. * @return
  73. */
  74. QStringList findResourcesPath(const QString& path) const = 0;
  75. /**
  76. * Get stored plugin start level.
  77. */
  78. int getStartLevel() const = 0;
  79. /**
  80. * Set stored plugin start level.
  81. */
  82. void setStartLevel(int level) = 0;
  83. /**
  84. * Get last modified timestamp.
  85. */
  86. qtimestamp getLastModified() const = 0;
  87. /**
  88. * Set stored last modified timestamp.
  89. */
  90. void setLastModified(qtimestamp timemillisecs) = 0;
  91. /**
  92. * Get auto-start setting.
  93. *
  94. * @return the autostart setting. "-1" if the plugin is not started.
  95. */
  96. int getAutostartSetting() const = 0;
  97. /**
  98. * Set the auto-start setting.
  99. *
  100. * @param setting the autostart setting to use.
  101. */
  102. void setAutostartSetting(int setting) = 0;
  103. /**
  104. * @return the location of the cached plugin.
  105. */
  106. QString getLibLocation() const = 0;
  107. /**
  108. * Get certificate chains associated with a plugin.
  109. *
  110. * @param onlyTrusted Only return trusted certificates.
  111. * @return All certificates or null if bundle is unsigned.
  112. */
  113. //QList<> getCertificateChains(bool onlyTrusted) const = 0;
  114. /**
  115. * Mark certificate associated with the plugin as trusted.
  116. *
  117. */
  118. //void trustCertificateChain(QList<> trustedChain) = 0;
  119. /**
  120. * Remove plugin from persistent storage.
  121. */
  122. void purge() = 0;
  123. /**
  124. * Close archive and all its open files.
  125. */
  126. void close() = 0;
  127. }
  128. #endif // CTKPLUGINARCHIVEINTERFACE_P_H