• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

soprano

Soprano::Server::ServerCore

Soprano::Server::ServerCore Class Reference

Central Soprano server class. More...

#include <Soprano/Server/ServerCore>

Inheritance diagram for Soprano::Server::ServerCore:

Inheritance graph
[legend]

List of all members.


Public Member Functions

virtual QStringList allModels () const
const Backend * backend () const
QList< BackendSetting > backendSettings () const
bool listen (quint16 port=DEFAULT_PORT)
virtual Model * model (const QString &name)
void registerAsDBusObject (const QString &objectPath=QString())
virtual void removeModel (const QString &name)
 ServerCore (QObject *parent=0)
quint16 serverPort () const
void setBackend (const Backend *backend)
void setBackendSettings (const QList< BackendSetting > &settings)
bool start (const QString &socketPath=QString())
virtual ~ServerCore ()

Static Public Attributes

static const quint16 DEFAULT_PORT

Protected Member Functions

virtual Model * createModel (const QList< BackendSetting > &settings)

Detailed Description

Central Soprano server class.

The ServerCore provides a Soprano server which maintains a set of named Model instances that can be accessed by clients over a tcp connection through Server::BackendPlugin.

Creating a server is very simple: Either derive from ServerCore or create an instance and then call start() to make the server listen for incoming connections.

 Soprano::Server::ServerCore core;
 core.start();

Optionally ServerCore can be configured using normal BackendSetting settings through setBackendSettings().

Be aware the ServerCode supports multiple ways of communication. start() opens a TCP socket to accept new connections, registerAsDBusObject() registers a DBus interface on the DBus session bus. Both ways of communication can be used simultaneously.

ServerCore is designed for single-threaded usage. Thus, model() uses Util::AsyncModel to protect against deadlocks. This behaviour can of course be changed by reimplementing model().

Author:
Sebastian Trueg <trueg@kde.org>

Definition at line 69 of file servercore.h.


Constructor & Destructor Documentation

Soprano::Server::ServerCore::ServerCore ( QObject *  parent = 0  ) 

virtual Soprano::Server::ServerCore::~ServerCore (  )  [virtual]


Member Function Documentation

virtual QStringList Soprano::Server::ServerCore::allModels (  )  const [virtual]

Retrieve all models that have been loaded.

Returns:
A list of Model names.

const Backend* Soprano::Server::ServerCore::backend (  )  const

The Backend used by the Server to create Model instances.

QList<BackendSetting> Soprano::Server::ServerCore::backendSettings (  )  const

Retrieve the backend settings configured via setBackendSettings().

Returns:
A list of BackendSetting objects.

virtual Model* Soprano::Server::ServerCore::createModel ( const QList< BackendSetting > &  settings  )  [protected, virtual]

Create a new Model.

The default implementation uses the configured Backend with the configured settings to create a new Model. This method can be reimplemented to create specialized Model, for example in combination with some FilterModel.

Parameters:
settings The settings to use (a reimplementation may choose to ignore the settings.)
Returns:
A newly create Model.

bool Soprano::Server::ServerCore::listen ( quint16  port = DEFAULT_PORT  ) 

Start the Server.

Calling this method will make the Server listen on the specified port for incoming client connections.

Parameters:
port The port to listen on for client connections.
Use Client::TcpClient to connect.

Warning:
Via the TCP connection signals are not supported. Thus, the models created by it will not emit signals such as Model::statementAdded. Also no permission handling or any kind of security is implemented at the moment. Thus, if a server is running and is listening on a port, it is open to connections from any client on any computer in the network.
Returns:
true if the server was successfully started, false otherwise.

virtual Model* Soprano::Server::ServerCore::model ( const QString &  name  )  [virtual]

Get or create Model with the specific name.

The default implementation will use createModel() to create a new Model if none with the specified name exists and protect it against deadlocks with a Util::AsyncModel.

Parameters:
name The name of the requested Model.

void Soprano::Server::ServerCore::registerAsDBusObject ( const QString &  objectPath = QString()  ) 

Register the ServerCore as a DBus object.

The process needs to be registered as a DBus service before (QDBusConnection::registerService()).

Parameters:
objectPath The DBus object path to register the server as. If empty the default path will be used (/org/soprano/Server).
Use Client::DBusClient to connect.

In case Soprano is compiled without D-Bus support this method does nothing.

virtual void Soprano::Server::ServerCore::removeModel ( const QString &  name  )  [virtual]

Remove a model and delete all data in it.

Use with care.

Be aware that the Model instance will also be deleted.

Should be reimplemented if model() is reimplemented.

Parameters:
name The name of the requested Model.
Warning:
This is not the same as deleting the Model instance. It will also delete all the data on the harddisk.

quint16 Soprano::Server::ServerCore::serverPort (  )  const

Returns:
The port this server is listening on or 0 if listen has not been called successfully.
Since:
2.1

void Soprano::Server::ServerCore::setBackend ( const Backend *  backend  ) 

Set the Backend used in the Server to create Models.

void Soprano::Server::ServerCore::setBackendSettings ( const QList< BackendSetting > &  settings  ) 

Set the settings that are to be used by createModel() to create new Model instances.

Be aware that Soprano::BackendOptionStorageDir will be changed to include a subdir which is the Model's name.

Parameters:
settings The settings to use for new Models.

bool Soprano::Server::ServerCore::start ( const QString &  socketPath = QString()  ) 

Start the core on a local socket.

On Windows this is a named pipe and on Unix this this is a local domain socket.

Use Client::LocalSocketClient to connect.

Warning:
Via the local socket connection signals are not supported.
Returns:
true if the local socket could be successfully opened. false on error. See ErrorCache::lastError() for details.


Member Data Documentation

const quint16 Soprano::Server::ServerCore::DEFAULT_PORT [static]

The default Soprano server port: 5000.

Definition at line 80 of file servercore.h.


The documentation for this class was generated from the following file:
  • servercore.h

soprano

Skip menu "soprano"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.8
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal