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
00031 namespace Soprano {
00032
00033 class Backend;
00034 class Model;
00035 class BackendSetting;
00036
00037 namespace Server {
00070 class SOPRANO_SERVER_EXPORT ServerCore : public QObject, public Error::ErrorCache
00071 {
00072 Q_OBJECT
00073
00074 public:
00075 ServerCore( QObject* parent = 0 );
00076 virtual ~ServerCore();
00077
00081 static const quint16 DEFAULT_PORT;
00082
00086 void setBackend( const Backend* backend );
00087
00091 const Backend* backend() const;
00092
00100 void setBackendSettings( const QList<BackendSetting>& settings );
00101
00107 QList<BackendSetting> backendSettings() const;
00108
00117 virtual Model* model( const QString& name );
00118
00132 virtual void removeModel( const QString& name );
00133
00139 virtual QStringList allModels() const;
00140
00152 bool start( const QString& socketPath = QString() );
00153
00170 bool listen( quint16 port = DEFAULT_PORT );
00171
00178 quint16 serverPort() const;
00179
00189 void registerAsDBusObject( const QString& objectPath = QString() );
00190
00191 private Q_SLOTS:
00192 void slotNewTcpConnection();
00193 void slotNewSocketConnection();
00194 void serverConnectionFinished();
00195
00196 protected:
00208
00209 virtual Model* createModel( const QList<BackendSetting>& settings );
00210
00211 private:
00212 class Private;
00213 Private* const d;
00214
00215 Q_PRIVATE_SLOT( d, void _s_localSocketError( QLocalSocket::LocalSocketError ) )
00216 Q_PRIVATE_SLOT( d, void _s_tcpSocketError( QAbstractSocket::SocketError ) )
00217 };
00218 }
00219 }
00220
00221 #endif