ctkEventAdminActivator_p.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 CTKEVENTADMINACTIVATOR_H
  16. #define CTKEVENTADMINACTIVATOR_H
  17. #include <ctkPluginActivator.h>
  18. #include <service/log/ctkLogService.h>
  19. class ctkEALogTracker;
  20. class ctkEAConfiguration;
  21. class ctkEventAdminActivator : public QObject,
  22. public ctkPluginActivator
  23. {
  24. Q_OBJECT
  25. Q_INTERFACES(ctkPluginActivator)
  26. #ifdef HAVE_QT5
  27. Q_PLUGIN_METADATA(IID "org_commontk_eventadmin")
  28. #endif
  29. public:
  30. ctkEventAdminActivator();
  31. ~ctkEventAdminActivator();
  32. /**
  33. * Called upon starting of the plugin. Constructs and registers the ctkEventAdmin
  34. * service with the framework. Note that the properties of the service are
  35. * requested from the context in this method hence, the plugin has to be
  36. * restarted in order to take changed properties into account.
  37. *
  38. * @param context The plugin context passed by the framework
  39. *
  40. * @see ctkPluginActivator#start(ctkPluginContext*)
  41. */
  42. void start(ctkPluginContext* context);
  43. /**
  44. * Called upon stopping the plugin. This will block until all pending events are
  45. * delivered. An ctkIllegalStateException will be thrown on new events starting with
  46. * the begin of this method. However, it might take some time until we settle
  47. * down which is somewhat cumbersome given that the spec asks for return in
  48. * a timely manner.
  49. *
  50. * @param context The plugin context passed by the framework
  51. *
  52. * @see ctkPluginActivator#stop(ctkPluginContext*)
  53. */
  54. void stop(ctkPluginContext* context);
  55. /**
  56. * Gets a wrapper log service object. This object will either print messages
  57. * to standard out if no ctkLogService is present or call the respective
  58. * methods of available ctkLogService instances.
  59. */
  60. static ctkLogService* getLogService();
  61. private:
  62. QFile logFileFallback;
  63. static ctkEALogTracker* logTracker;
  64. ctkEAConfiguration* config;
  65. };
  66. #endif // CTKEVENTADMINACTIVATOR_H