add more spacing
[personal-kdebase.git] / runtime / nepomuk / server / servicemanager.h
blob8d8cd43e239e21f707c429753352405f36f99b1f
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>
25 namespace Nepomuk {
27 class ServiceController;
29 /**
30 * Manages all Nepomuk services.
31 * Uses ServiceController to control the runtime
32 * of each service.
34 class ServiceManager : public QObject
36 Q_OBJECT
38 public:
39 ServiceManager( QObject* parent = 0 );
40 ~ServiceManager();
42 static ServiceManager* self() { return s_self; }
43 static void messageFilter( const QDBusMessage& );
45 /**
46 * Even uninitialized services are running.
48 * \return A list of names of all running services.
50 QStringList runningServices() const;
52 /**
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;
61 /**
62 * \return \p true if the service identified by \p servicename
63 * is running and initialized.
65 bool isServiceInitialized( const QString& servicename ) const;
67 Q_SIGNALS:
68 /**
69 * Emitted once a new service finished its initialization and
70 * is ready for use.
72 void serviceInitialized( const QString& name );
74 public Q_SLOTS:
75 /**
76 * Starts all autoload services.
78 void startAllServices();
80 /**
81 * Stops all services.
83 void stopAllServices();
85 /**
86 * Start a specific service. Blocks until the service
87 * and all dependencies are running.
89 bool startService( const QString& name );
91 /**
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 );
97 /**
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 );
108 private:
109 static ServiceManager* s_self;
111 class Private;
112 Private* const d;
114 Q_PRIVATE_SLOT( d, void _k_serviceInitialized(ServiceController*) )
118 #endif