ctkPluginStorage_p.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 CTKPLUGINSTORAGE_P_H
  16. #define CTKPLUGINSTORAGE_P_H
  17. #include <QUrl>
  18. #include <QStringList>
  19. #include <QSharedPointer>
  20. // CTK class forward declarations
  21. class ctkPluginArchive;
  22. /**
  23. * \ingroup PluginFramework
  24. *
  25. * Interface for managing all plugin meta-data and resources
  26. */
  27. class ctkPluginStorage
  28. {
  29. public:
  30. virtual ~ctkPluginStorage() {}
  31. /**
  32. * Insert a plugin (shared library) into the persistent storage
  33. *
  34. * @param location Location of the plugin.
  35. * @param localPath Path to the plugin on the local file system
  36. * @return Plugin archive object.
  37. */
  38. virtual QSharedPointer<ctkPluginArchive> insertPlugin(const QUrl& location, const QString& localPath) = 0;
  39. /**
  40. * Insert a new plugin (shared library) into the persistent
  41. * storagedata as an update
  42. * to an existing plugin archive. To commit this data a call to
  43. * <code>replacePluginArchive</code> is needed.
  44. *
  45. * @param old ctkPluginArchive to be replaced.
  46. * @param updateLocation Location of the updated plugin.
  47. * @param localPath Path to a plugin on the local file system.
  48. * @return Plugin archive object.
  49. */
  50. virtual QSharedPointer<ctkPluginArchive> updatePluginArchive(QSharedPointer<ctkPluginArchive> old,
  51. const QUrl& updateLocation, const QString& localPath) = 0;
  52. /**
  53. * Replace old plugin archive with a new updated plugin archive, that
  54. * was created with updatePluginArchive.
  55. *
  56. * @param oldPA ctkPluginArchive to be replaced.
  57. * @param newPA new ctkPluginArchive.
  58. */
  59. virtual void replacePluginArchive(QSharedPointer<ctkPluginArchive> oldPA, QSharedPointer<ctkPluginArchive> newPA) = 0;
  60. /**
  61. * Remove plugin archive from archives list and persistent storage.
  62. * The plugin archive is deleted and must not be used afterwards, if
  63. * this method returns \a true.
  64. *
  65. * @param pa Plugin archive to remove.
  66. * @return true if element was removed.
  67. */
  68. virtual bool removeArchive(QSharedPointer<ctkPluginArchive> pa) = 0;
  69. /**
  70. * Get all plugin archive objects.
  71. *
  72. * @return QList of all PluginArchives.
  73. */
  74. virtual QList<QSharedPointer<ctkPluginArchive> > getAllPluginArchives() const = 0;
  75. /**
  76. * Get all plugins to start at next launch of framework.
  77. * This list is sorted in increasing plugin id order.
  78. *
  79. * @return A List with plugin locations.
  80. */
  81. virtual QList<QString> getStartOnLaunchPlugins() const = 0;
  82. /**
  83. * Close this plugin storage and all bundles in it.
  84. */
  85. virtual void close() = 0;
  86. };
  87. #endif // CTKPLUGINSTORAGE_P_H