1 /* This file is part of the KDE Project
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef _SERVICE_MANAGER_H_
20 #define _SERVICE_MANAGER_H_
22 #include <QtCore/QObject>
23 #include <QtDBus/QDBusMessage>
27 class ServiceController
;
30 * Manages all Nepomuk services.
31 * Uses ServiceController to control the runtime
34 class ServiceManager
: public QObject
39 ServiceManager( QObject
* parent
= 0 );
42 static ServiceManager
* self() { return s_self
; }
43 static void messageFilter( const QDBusMessage
& );
46 * Even uninitialized services are running.
48 * \return A list of names of all running services.
50 QStringList
runningServices() const;
53 * All services that are available in the system. Started
54 * and not started. This list does only include valid
55 * services, i.e. those that have a proper dependency tree.
57 * \return A list of names of all running services.
59 QStringList
availableServices() const;
62 * \return \p true if the service identified by \p servicename
63 * is running and initialized.
65 bool isServiceInitialized( const QString
& servicename
) const;
69 * Emitted once a new service finished its initialization and
72 void serviceInitialized( const QString
& name
);
76 * Starts all autoload services.
78 void startAllServices();
83 void stopAllServices();
86 * Start a specific service. Blocks until the service
87 * and all dependencies are running.
89 bool startService( const QString
& name
);
92 * Stop a specific service. Blocks until the service
93 * and all services depending on it have been stopped.
95 bool stopService( const QString
& name
);
98 * \return \p true if the service indicated by \a name
99 * is started automatically.
101 bool isServiceAutostarted( const QString
& name
);
104 * Set the service indicated by \a name to be autostarted.
106 void setServiceAutostarted( const QString
& name
, bool autostart
);
109 static ServiceManager
* s_self
;
114 Q_PRIVATE_SLOT( d
, void _k_serviceInitialized(ServiceController
*) )