ctkConfigurationAdminFactory_p.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 CTKCONFIGURATIONADMINFACTORY_P_H
  16. #define CTKCONFIGURATIONADMINFACTORY_P_H
  17. #include <QObject>
  18. #include <ctkPluginEvent.h>
  19. #include <ctkServiceFactory.h>
  20. #include <service/cm/ctkConfigurationListener.h>
  21. #include "ctkCMEventDispatcher_p.h"
  22. #include "ctkCMPluginManager_p.h"
  23. #include "ctkConfigurationStore_p.h"
  24. #include "ctkManagedServiceTracker_p.h"
  25. #include "ctkManagedServiceFactoryTracker_p.h"
  26. struct ctkLogService;
  27. class ctkConfigurationAdminImpl;
  28. class ctkConfigurationImpl;
  29. /**
  30. * ctkConfigurationAdminFactory provides a Configuration Admin ServiceFactory but more significantly
  31. * launches the whole implementation.
  32. */
  33. class ctkConfigurationAdminFactory : public QObject, public ctkServiceFactory
  34. {
  35. Q_OBJECT
  36. Q_INTERFACES(ctkServiceFactory)
  37. public:
  38. ctkConfigurationAdminFactory(ctkPluginContext* context, ctkLogService* log);
  39. ~ctkConfigurationAdminFactory();
  40. void start();
  41. void stop();
  42. QObject* getService(QSharedPointer<ctkPlugin> plugin, ctkServiceRegistration registration);
  43. void ungetService(QSharedPointer<ctkPlugin> plugin, ctkServiceRegistration registration, QObject* service);
  44. void checkConfigurationPermission();
  45. ctkLogService* getLogService() const;
  46. void dispatchEvent(ctkConfigurationEvent::Type type, const QString& factoryPid, const QString& pid);
  47. void notifyConfigurationUpdated(ctkConfigurationImpl* config, bool isFactory);
  48. void notifyConfigurationDeleted(ctkConfigurationImpl* config, bool isFactory);
  49. void modifyConfiguration(const ctkServiceReference& reference, ctkDictionary& properties);
  50. public Q_SLOTS:
  51. void pluginChanged(const ctkPluginEvent& event);
  52. private:
  53. //Permission configurationPermission = new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE); //$NON-NLS-1$
  54. ctkCMEventDispatcher eventDispatcher;
  55. ctkCMPluginManager pluginManager;
  56. ctkLogService* logService;
  57. ctkConfigurationStore configurationStore;
  58. ctkManagedServiceTracker managedServiceTracker;
  59. ctkManagedServiceFactoryTracker managedServiceFactoryTracker;
  60. QList<ctkConfigurationAdminImpl*> configAdmins;
  61. };
  62. #endif // CTKCONFIGURATIONADMINFACTORY_P_H