ctkPluginFrameworkContextPrivate.cxx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "ctkPluginFrameworkContextPrivate_p.h"
  2. namespace ctk {
  3. QMutex PluginFrameworkContextPrivate::globalFwLock;
  4. int PluginFrameworkContextPrivate::globalId = 1;
  5. PluginFrameworkContextPrivate::PluginFrameworkContextPrivate(
  6. const PluginFrameworkContext::Properties& initProps)
  7. : /*plugins(this), services(this), systemPlugin(this)*/
  8. props(initProps)
  9. {
  10. {
  11. QMutexLocker lock(&globalFwLock);
  12. id = globalId++;
  13. }
  14. log() << "created";
  15. }
  16. void PluginFrameworkContextPrivate::init()
  17. {
  18. log() << "initializing";
  19. // if (Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT
  20. // .equals(props.getProperty(Constants.FRAMEWORK_STORAGE_CLEAN))) {
  21. // deleteFWDir();
  22. // // Must remove the storage clean property since it should not be
  23. // // used more than once!
  24. // props.removeProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
  25. // }
  26. // props.save();
  27. // systemPlugin.initSystemBundle();
  28. // plugins.load();
  29. log() << "inited";
  30. log() << "Installed bundles:";
  31. // // Use the ordering in the bundle storage to get a sorted list of bundles.
  32. // final BundleArchive [] allBAs = storage.getAllBundleArchives();
  33. // for (int i = 0; i<allBAs.length; i++) {
  34. // final BundleArchive ba = allBAs[i];
  35. // final Bundle b = bundles.getBundle(ba.getBundleLocation());
  36. // log(" #" +b.getBundleId() +" " +b.getSymbolicName() +":"
  37. // +b.getVersion() +" location:" +b.getLocation());
  38. // }
  39. }
  40. void PluginFrameworkContextPrivate::uninit()
  41. {
  42. log() << "uninit";
  43. //systemBundle.uninitSystemBundle();
  44. //storage.close();
  45. }
  46. int PluginFrameworkContextPrivate::getId() {
  47. return id;
  48. }
  49. void PluginFrameworkContextPrivate::checkOurPlugin(Plugin* b) {
  50. // if (this != ((BundleImpl)b).fwCtx) {
  51. // throw new IllegalArgumentException("Bundle does not belong to this framework: " + b);
  52. // }
  53. }
  54. QDebug PluginFrameworkContextPrivate::log() {
  55. QDebug dbg(qDebug());
  56. dbg << "Framework instance " << getId() << ": ";
  57. return dbg;
  58. }
  59. }