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 
29 namespace Buteo {
30 
31 
32 class ServerActivator;
33 class ServerPlugin;
34 class ServerThread;
35 class Profile;
36 
40 {
41  Q_OBJECT
42 
43 public:
44 
56  ServerPluginRunner(const QString &aPluginName, Profile *aProfile,
57  PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf,
58  ServerActivator *aServerActivator, QObject *aParent = 0);
59 
61  virtual ~ServerPluginRunner();
62 
64  virtual bool init();
65 
67  virtual bool start();
68 
70  virtual void stop();
71 
73  virtual void abort(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED);
74 
76  virtual SyncResults syncResults();
77 
79  virtual SyncPluginBase *plugin();
80 
82  virtual bool cleanUp();
83 
84  // Suspend a server plug-in
85  void suspend();
86 
87  // Resume a suspended server plug-in
88  void resume();
89 
90 private slots:
91 
92  // Slots for catching plug-in signals.
93 
94  void onNewSession(const QString &aDestination);
95 
96  void onTransferProgress(const QString &aProfileName,
97  Sync::TransferDatabase aDatabase, Sync::TransferType aType,
98  const QString &aMimeType, int aCommittedItems);
99 
100  void onStorageAccquired(const QString &aMimeType );
101  void onError(const QString &aProfileName, const QString &aMessage, SyncResults::MinorCode aErrorCode);
102 
103  void onSuccess(const QString &aProfileName, const QString &aMessage);
104 
105  // Slot for observing thread exit
106  void onThreadExit();
107 
108 private:
109 
110  void onSessionDone();
111 
112  Profile *iProfile;
113  ServerPlugin *iPlugin;
114  ServerThread *iThread;
115  ServerActivator *iServerActivator;
116 
117 #ifdef SYNCFW_UNIT_TESTS
118  friend class ServerPluginRunnerTest;
119 #endif
120 
121 };
122 
123 }
124 
125 #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
Base class for running sync plug-ins.
Definition: PluginRunner.h:45
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
Class for running server sync plug-ins.
Definition: ServerPluginRunner.h:40
virtual void stop()
Definition: ServerPluginRunner.cpp:132
virtual bool cleanUp()
Definition: ServerPluginRunner.cpp:190
virtual SyncPluginBase * plugin()
Definition: ServerPluginRunner.cpp:172
virtual ~ServerPluginRunner()
Destructor.
Definition: ServerPluginRunner.cpp:45
virtual bool start()
Definition: ServerPluginRunner.cpp:119
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
Definition: ServerPluginRunner.cpp:145
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:179
Base class for server plugins.
Definition: ServerPlugin.h:37
Thread for server plugin.
Definition: ServerThread.h:38
Base class for client and server plugins.
Definition: SyncPluginBase.h:46
Contains information about a completed synchronization session.
Definition: SyncResults.h:59
MinorCode
enum value
Definition: SyncResults.h:77