• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • Nepomuk2
  • Service2
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Nepomuk2::Service2 Class Reference

#include <service2.h>

Inheritance diagram for Nepomuk2::Service2:
Inheritance graph
[legend]

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=Service
    X-KDE-ServiceTypes=NepomukService
    X-KDE-Nepomuk-autostart=true
    X-KDE-Nepomuk-start-on-demand=false
    # Dependencies default to 'nepomukstorage'
    X-KDE-Nepomuk-dependencies=nepomukfoobar
    Name=My fancy Nepomuk Service
    Comment=A Nepomuk service that does fancy things
    Exec=nepomuk_service_exec
class MyService : public Nepomuk2::Service2
{
// do fancy stuff
};

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.

Author
Vishesh Handa me@vh.nosp@m.anda.nosp@m..in
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
parentThe parent object
delayedInitializationIf 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.

Nepomuk2::Service2::~Service2 ( )
virtual

Destructor.

Definition at line 89 of file service2.cpp.

Member Function Documentation

QString Nepomuk2::Service2::dbusServiceName ( const QString &  serviceName)
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.

template<typename T >
static int Nepomuk2::Service2::init ( int  argc,
char **  argv,
const KAboutData &  aboutData 
)
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

int main( int argc, char **argv ) {
KAboutData aboutData( ... );
return Nepomuk2::Service2<MyService>( argc, argv, aboutData );
}

Definition at line 107 of file service2.h.

bool Nepomuk2::Service2::initCommon ( const QString &  name)
protected

Definition at line 176 of file service2.cpp.

template<typename T >
static int Nepomuk2::Service2::initUI ( int  argc,
char **  argv,
const KAboutData &  aboutData 
)
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.

void Nepomuk2::Service2::setServiceInitialized ( bool  success)
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
successSet 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:
  • service2.h
  • service2.cpp
This file is part of the KDE documentation.
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.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal