ButeoSynchronizationFramework
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, int 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 
114  ServerPlugin *iPlugin;
115 
116  ServerThread *iThread;
117 
118  ServerActivator *iServerActivator;
119 
120 #ifdef SYNCFW_UNIT_TESTS
121  friend class ServerPluginRunnerTest;
122 #endif
123 
124 };
125 
126 }
127 
128 #endif // SERVERPLUGINRUNNER_H
This class represents a single profile, a collection of settings or data releated to some entity...
Definition: Profile.h:52
virtual SyncResults syncResults()
Definition: ServerPluginRunner.cpp:195
Manages plugins.
Definition: PluginManager.h:91
virtual void stop()
Definition: ServerPluginRunner.cpp:144
Contains information about a completed synchronization session.
Definition: SyncResults.h:58
Definition: AccountsHelper.h:31
virtual ~ServerPluginRunner()
Destructor.
Definition: ServerPluginRunner.cpp:45
Keeps track of which server plug-ins should be enabled.
Definition: ServerActivator.h:47
ServerPluginRunner(const QString &aPluginName, Profile *aProfile, PluginManager *aPluginMgr, PluginCbInterface *aPluginCbIf, ServerActivator *aServerActivator, QObject *aParent=0)
Constructor.
Definition: ServerPluginRunner.cpp:33
Base class for server plugins.
Definition: ServerPlugin.h:36
virtual void abort(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
Definition: ServerPluginRunner.cpp:158
virtual bool init()
Definition: ServerPluginRunner.cpp:64
virtual bool start()
Definition: ServerPluginRunner.cpp:131
Interface which client and server plugins can use to communicate with synchronization daemon...
Definition: PluginCbInterface.h:38
virtual bool cleanUp()
Definition: ServerPluginRunner.cpp:209
Thread for server plugin.
Definition: ServerThread.h:36
Base class for client and server plugins.
Definition: SyncPluginBase.h:45
Base class for running sync plug-ins.
Definition: PluginRunner.h:44
Class for running server sync plug-ins.
Definition: ServerPluginRunner.h:39
virtual SyncPluginBase * plugin()
Definition: ServerPluginRunner.cpp:188