Nepomuk-Core
#include <service2.h>
Public Member Functions | |
Service2 (QObject *parent=0, bool delayedInitialization=false) | |
virtual | ~Service2 () |
QString | dbusServiceName () |
QString | description () |
QString | name () |
Static Public Member Functions | |
static QString | dbusServiceName (const QString &serviceName) |
template<typename T > | |
static int | init (int argc, char **argv, const KAboutData &aboutData) |
template<typename T > | |
static int | initUI (int argc, char **argv, const KAboutData &aboutData) |
Protected Member Functions | |
bool | initCommon (const QString &name) |
void | setServiceInitialized (bool success) |
Detailed Description
New Base class for all Nepomuk services.
A Nepomuk service is intended to perform some kind of operation on the Nepomuk data storage. This can include data gathering, data enrichment, or enhanced data query.
Nepomuk services are started and managed by the Nepomuk server. Very much like KDED modules a Nepomuk service has autostart and start-on-demand properties. In addition a Nepomuk service can define an arbitrary number of dependencies which are necessary to run the service. These dependencies name other services.
The following is needed for creating a new service -
- A class deriving from the Service2 class
- call init() in your main function
- a .desktop file similar to the following example [Desktop Entry]Type=ServiceX-KDE-ServiceTypes=NepomukServiceX-KDE-Nepomuk-autostart=trueX-KDE-Nepomuk-start-on-demand=false# Dependencies default to 'nepomukstorage'X-KDE-Nepomuk-dependencies=nepomukfoobarName=My fancy Nepomuk ServiceComment=A Nepomuk service that does fancy thingsExec=nepomuk_service_exec
The Nepomuk server will automatically export all D-Bus interfaces defined on the service instance. Thus, the simplest way to export methods via D-Bus is by marking them with Q_SCRIPTABLE.
- Since
- 4.11
Definition at line 88 of file service2.h.
Constructor & Destructor Documentation
Nepomuk2::Service2::Service2 | ( | QObject * | parent = 0 , |
bool | delayedInitialization = false |
||
) |
Create a new Service.
- Parameters
-
parent The parent object delayedInitialization If true
the service will not be usable until setServiceInitialized has been called. This allows to design services that need to perform long initialization tasks.
Definition at line 80 of file service2.cpp.
|
virtual |
Destructor.
Definition at line 89 of file service2.cpp.
Member Function Documentation
|
static |
Gives the dbus service name for the service with name serviceName
.
Definition at line 171 of file service2.cpp.
QString Nepomuk2::Service2::dbusServiceName | ( | ) |
Returns the DBus Service Name.
Definition at line 165 of file service2.cpp.
QString Nepomuk2::Service2::description | ( | ) |
Returns the description of the service.
Definition at line 100 of file service2.cpp.
|
inlinestatic |
Use this method in the main function of your service application to initialize your service.
This method takes care of creation a KApplication, registering it on DBus and parsing the command line args
Definition at line 107 of file service2.h.
|
protected |
Definition at line 176 of file service2.cpp.
|
inlinestatic |
Similar to the init method above except that it creates an application with a UI so that you can use UI components in the service.
Definition at line 137 of file service2.h.
QString Nepomuk2::Service2::name | ( | ) |
Return the generic service name.
Definition at line 95 of file service2.cpp.
|
protected |
A Nepomuk service can make use of a warmup phase in which it is not usable yet.
Call this method once your service is fully initialized.
Most services do not need to call this method.
- Parameters
-
success Set to true
if initialization was successful,false
otherwise.
- See also
- Service::Service
Definition at line 106 of file service2.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.