/*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef CTKEACONFIGURATION_P_H
#define CTKEACONFIGURATION_P_H
#include
*
* org.commontk.eventadmin.CacheSize - The size of various internal
* caches.
* ctkEAConfiguration
class encapsules the
* configuration for the event admin.
*
* The service knows about the following properties which are read at plugin startup:
*
*
* org.commontk.eventadmin.ThreadPoolSize - The size of the thread * pool. *
* The default value is 10. Increase in case of a large amount of synchronous events * where the ctkEventHandler services in turn send new synchronous events in * the event dispatching thread or a lot of timeouts are to be expected. A value of * less then 2 triggers the default value. A value of 2 effectively disables thread * pooling. * **
* org.commontk.eventadmin.Timeout - The black-listing timeout in * milliseconds *
* The default value is 5000. Increase or decrease at own discretion. A value of less * then 100 turns timeouts off. Any other value is the time in milliseconds granted * to each ctkEventHandler before it gets blacklisted. * **
* org.commontk.eventadmin.RequireTopic - Are ctkEventHandler * required to be registered with a topic? *
* The default is true. The specification says that ctkEventHandler * must register with a list of topics they are interested in. Setting this value to * false will enable that handlers without a topic are receiving all events * (i.e., they are treated the same as with a topic=*). * **
* org.commontk.eventadmin.IgnoreTimeout - Configure * ctkEventHandlers to be called without a timeout. *
* If a timeout is configured by default all event handlers are called using the timeout. * For performance optimization it is possible to configure event handlers where the * timeout handling is not used - this reduces the thread usage from the thread pools * as the timout handling requires an additional thread to call the event handler. * However, the application should work without this configuration property. It is a * pure optimization! * The value is a list of strings (separated by comma) which is assumed to define * exact class names. * * These properties are read at startup and serve as a default configuration. * If a configuration admin is configured, the event admin can be configured * through the config admin. */ class ctkEAConfiguration : public QObject, public ctkManagedService { Q_OBJECT Q_INTERFACES(ctkManagedService) public: /** The PID for the event admin. */ static const QString PID; // = "org.commontk.eventadmin.impl.EventAdmin" static const QString PROP_CACHE_SIZE; // = "org.commontk.eventadmin.CacheSize" static const QString PROP_THREAD_POOL_SIZE; // = "org.commontk.eventadmin.ThreadPoolSize" static const QString PROP_TIMEOUT; // = "org.commontk.eventadmin.Timeout" static const QString PROP_REQUIRE_TOPIC; // = "org.commontk.eventadmin.RequireTopic" static const QString PROP_IGNORE_TIMEOUT; // = "org.commontk.eventadmin.IgnoreTimeout" static const QString PROP_LOG_LEVEL; // = "org.commontk.eventadmin.LogLevel" private: QMutex mutex; /** The plugin context. */ ctkPluginContext* pluginContext; int cacheSize; int threadPoolSize; int timeout; bool requireTopic; QStringList ignoreTimeout; int logLevel; // The thread pool used - this is a member because we need to close it on stop ctkEADefaultThreadPool* sync_pool; ctkEADefaultThreadPool* async_pool; // The actual implementation of the service - this is a member because we need to // close it on stop. Note, security is not part of this implementation but is // added via a decorator in the start method (this is the wrapped object without // the wrapper). ctkEventAdminService* admin; QScopedPointer