Buteo Synchronization Framework
ServerPluginRunner.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef SERVERPLUGINRUNNER_H
25#define SERVERPLUGINRUNNER_H
26
27#include "PluginRunner.h"
28
29namespace Buteo {
30
31class ServerActivator;
32class ServerPlugin;
33class ServerThread;
34class Profile;
35
39{
40 Q_OBJECT
41
42public:
54 ServerPluginRunner(const QString &aPluginName, Profile *aProfile,
55 PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf,
56 ServerActivator *aServerActivator, QObject *aParent = 0);
57
59 virtual ~ServerPluginRunner();
60
62 virtual bool init();
63
65 virtual bool start();
66
68 virtual void stop();
69
71 virtual void abort(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED);
72
74 virtual SyncResults syncResults();
75
77 virtual SyncPluginBase *plugin();
78
80 virtual bool cleanUp();
81
82 // Suspend a server plug-in
83 void suspend();
84
85 // Resume a suspended server plug-in
86 void resume();
87
88private slots:
89 // Slots for catching plug-in signals.
90 void onNewSession(const QString &aDestination);
91 void onTransferProgress(const QString &aProfileName,
92 Sync::TransferDatabase aDatabase, Sync::TransferType aType,
93 const QString &aMimeType, int aCommittedItems);
94 void onStorageAccquired(const QString &aMimeType );
95 void onError(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
96 void onSuccess(const QString &aProfileName, const QString &aMessage);
97
98 // Slot for observing thread exit
99 void onThreadExit();
100
101private:
102 void onSessionDone();
103
104 Profile *iProfile;
105 ServerPlugin *iPlugin;
106 ServerThread *iThread;
107 ServerActivator *iServerActivator;
108
109#ifdef SYNCFW_UNIT_TESTS
110 friend class ServerPluginRunnerTest;
111#endif
112};
113
114}
115
116#endif // SERVERPLUGINRUNNER_H
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition PluginCbInterface.h:39
Manages plugins.
Definition PluginManager.h:56
PluginRunner(PluginType aPluginType, const QString &aPluginName, PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf, QObject *aParent=0)
Constructor.
Definition PluginRunner.cpp:30
This class represents a single profile, a collection of settings or data releated to some entity.
Definition Profile.h:53
Keeps track of which server plug-ins should be enabled.
Definition ServerActivator.h:48
virtual void stop()
Definition ServerPluginRunner.cpp:134
virtual bool cleanUp()
Definition ServerPluginRunner.cpp:192
virtual SyncPluginBase * plugin()
Definition ServerPluginRunner.cpp:174
virtual ~ServerPluginRunner()
Destructor.
Definition ServerPluginRunner.cpp:45
virtual bool start()
Definition ServerPluginRunner.cpp:120
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
Definition ServerPluginRunner.cpp:147
virtual bool init()
Definition ServerPluginRunner.cpp:64
ServerPluginRunner(const QString &aPluginName, Profile *aProfile, PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf, ServerActivator *aServerActivator, QObject *aParent=0)
Constructor.
Definition ServerPluginRunner.cpp:33
virtual SyncResults syncResults()
Definition ServerPluginRunner.cpp:181
Base class for server plugins.
Definition ServerPlugin.h:37
Thread for server plugin.
Definition ServerThread.h:39
Base class for client and server plugins.
Definition SyncPluginBase.h:46
Contains information about a completed synchronization session.
Definition SyncResults.h:67
MinorCode
enum value
Definition SyncResults.h:93