00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SOPRANO_SERVER_CORE_H_
00023 #define _SOPRANO_SERVER_CORE_H_
00024
00025 #include <QtCore/QObject>
00026
00027 #include "error.h"
00028 #include "soprano_export.h"
00029
00030 namespace Soprano {
00031
00032 class Backend;
00033 class Model;
00034 class BackendSetting;
00035
00036 namespace Server {
00069 class SOPRANO_SERVER_EXPORT ServerCore : public QObject, public Error::ErrorCache
00070 {
00071 Q_OBJECT
00072
00073 public:
00074 ServerCore( QObject* parent = 0 );
00075 virtual ~ServerCore();
00076
00080 static const quint16 DEFAULT_PORT;
00081
00085 void setBackend( const Backend* backend );
00086
00090 const Backend* backend() const;
00091
00099 void setBackendSettings( const QList<BackendSetting>& settings );
00100
00106 QList<BackendSetting> backendSettings() const;
00107
00116 virtual Model* model( const QString& name );
00117
00131 virtual void removeModel( const QString& name );
00132
00138 virtual QStringList allModels() const;
00139
00151 bool start( const QString& socketPath = QString() );
00152
00169 bool listen( quint16 port = DEFAULT_PORT );
00170
00177 quint16 serverPort() const;
00178
00190 void registerAsDBusObject( const QString& objectPath = QString() );
00191
00192 private Q_SLOTS:
00193 void slotNewTcpConnection();
00194 void slotNewSocketConnection();
00195 void serverConnectionFinished();
00196
00197 protected:
00209
00210 virtual Model* createModel( const QList<BackendSetting>& settings );
00211
00212 private:
00213 class Private;
00214 Private* const d;
00215
00216 Q_PRIVATE_SLOT( d, void _s_localSocketError( QLocalSocket::LocalSocketError ) )
00217 Q_PRIVATE_SLOT( d, void _s_tcpSocketError( QAbstractSocket::SocketError ) )
00218 };
00219 }
00220 }
00221
00222 #endif