Buteo Synchronization Framework: PluginRunner.h Source File

Buteo Synchronization Framework

PluginRunner.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 PLUGINRUNNER_H
25 #define PLUGINRUNNER_H
26
27 #include <SyncResults.h>
28 #include "SyncCommonDefs.h"
29 #include "SyncPluginBase.h"
30 #include <QObject>
31 #include <QString>
32
33 namespace Buteo {
34
35 class PluginManager;
36 class PluginCbInterface;
37
44 class PluginRunner : public QObject
45 {
46 Q_OBJECT
47
48 public:
49
51 enum PluginType {
52 PLUGIN_CLIENT,
53 PLUGIN_SERVER
54 };
55
65 PluginRunner(PluginType aPluginType, const QString &aPluginName,
66 PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf,
67 QObject *aParent = 0);
68
75 virtual bool init() = 0;
76
81 virtual bool start() = 0;
82
87 virtual void stop() = 0;
88
95 virtual void abort(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED) = 0;
96
103 virtual SyncResults syncResults() = 0;
104
105
110 virtual bool cleanUp() = 0;
111
116 PluginType pluginType() const;
117
122 QString pluginName() const;
123
128 virtual SyncPluginBase *plugin() = 0;
129
130 signals:
132 void transferProgress(const QString &aProfileName,
133 Sync::TransferDatabase aDatabase, Sync::TransferType aType,
134 const QString &aMimeType, int aCommittedItems);
135
137 void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
138
140 void success(const QString &aProfileName, const QString &aMessage);
141
143 void storageAccquired (const QString &aMimeType);
144
146 void syncProgressDetail(const QString &aProfileName, int aProgressDetail);
147
152 void done();
153
155 void newSession(const QString &aDestination);
156
158 void connectivityStateChanged(Sync::ConnectivityType aType, bool aState);
159
160 protected:
161
163 bool iInitialized;
164
166 PluginManager *iPluginMgr;
167
169 PluginCbInterface *iPluginCbIf;
170
172 PluginType iType;
173
175 QString iPluginName;
176
177 private:
178
179 #ifdef SYNCFW_UNIT_TESTS
180 friend class PluginRunnerTest;
181 #endif
182
183 };
184
185 }
186
187 #endif // PLUGINRUNNER_H
Buteo::PluginCbInterface
Interface which client and server plugins can use to communicate with synchronization daemon.
Definition: PluginCbInterface.h:39
Buteo::PluginManager
Manages plugins.
Definition: PluginManager.h:56
Buteo::PluginRunner
Base class for running sync plug-ins.
Definition: PluginRunner.h:45
Buteo::PluginRunner::plugin
virtual SyncPluginBase * plugin()=0
Gets the plug-in associated with this plug-in runner.
Buteo::PluginRunner::PluginType
PluginType
Plug-in type: client or server.
Definition: PluginRunner.h:51
Buteo::PluginRunner::start
virtual bool start()=0
Starts running the plug-in.
Buteo::PluginRunner::iType
PluginType iType
type of the plugin
Definition: PluginRunner.h:172
Buteo::PluginRunner::iPluginName
QString iPluginName
name of the plugin
Definition: PluginRunner.h:175
Buteo::PluginRunner::iPluginMgr
PluginManager * iPluginMgr
pointer to an instance of plugin manager
Definition: PluginRunner.h:166
Buteo::PluginRunner::success
void success(const QString &aProfileName, const QString &aMessage)
Definition: moc_PluginRunner.cpp:262
Buteo::PluginRunner::storageAccquired
void storageAccquired(const QString &aMimeType)
Definition: moc_PluginRunner.cpp:269
Buteo::PluginRunner::connectivityStateChanged
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Definition: moc_PluginRunner.cpp:296
Buteo::PluginRunner::cleanUp
virtual bool cleanUp()=0
Calls the cleanup for the plugin.
Buteo::PluginRunner::syncProgressDetail
void syncProgressDetail(const QString &aProfileName, int aProgressDetail)
Definition: moc_PluginRunner.cpp:276
Buteo::PluginRunner::done
void done()
Signal sent when the plug-in runner has finished.
Definition: moc_PluginRunner.cpp:283
Buteo::PluginRunner::abort
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)=0
Aborts running the plug-in.
Buteo::PluginRunner::syncResults
virtual SyncResults syncResults()=0
Gets the sync results from the plug-in.
Buteo::PluginRunner::pluginType
PluginType pluginType() const
Gets the plug-in type.
Definition: PluginRunner.cpp:51
Buteo::PluginRunner::pluginName
QString pluginName() const
Gets the plug-in name.
Definition: PluginRunner.cpp:58
Buteo::PluginRunner::transferProgress
void transferProgress(const QString &aProfileName, Sync::TransferDatabase aDatabase, Sync::TransferType aType, const QString &aMimeType, int aCommittedItems)
Definition: moc_PluginRunner.cpp:248
Buteo::PluginRunner::error
void error(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode)
Definition: moc_PluginRunner.cpp:255
Buteo::PluginRunner::stop
virtual void stop()=0
Stops running the plug-in.
Buteo::PluginRunner::iPluginCbIf
PluginCbInterface * iPluginCbIf
pointer to an instance of synchronizer
Definition: PluginRunner.h:169
Buteo::PluginRunner::newSession
void newSession(const QString &aDestination)
Definition: moc_PluginRunner.cpp:289
Buteo::PluginRunner::init
virtual bool init()=0
Initializes the plug-in runner.
Buteo::PluginRunner::iInitialized
bool iInitialized
Initialization status of the plugin.
Definition: PluginRunner.h:163
Buteo::PluginRunner::PluginRunner
PluginRunner(PluginType aPluginType, const QString &aPluginName, PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf, QObject *aParent=0)
Constructor.
Definition: PluginRunner.cpp:30
Buteo::SyncPluginBase
Base class for client and server plugins.
Definition: SyncPluginBase.h:46
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition: SyncResults.h:59
Buteo::SyncResults::MinorCode
MinorCode
enum value
Definition: SyncResults.h:77