Buteo Synchronization Framework
StoragePlugin.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#ifndef STORAGEPLUGIN_H_89943984899843
24#define STORAGEPLUGIN_H_89943984899843
25
26#include <QObject>
27#include <QMap>
28#include <QList>
29#include <QDateTime>
30
31namespace Buteo {
32
33class StorageItem;
34
38class StoragePlugin : public QObject
39{
40 Q_OBJECT
41
42public:
55
60 StoragePlugin(const QString &aPluginName);
61
65 virtual ~StoragePlugin();
66
71 const QString &getPluginName() const;
72
78 QString getProperty(const QString &aProperty) const;
79
84 void getProperties(QMap<QString, QString> &aProperties) const;
85
95 virtual bool init(const QMap<QString, QString> &aProperties) = 0;
96
100 virtual bool uninit() = 0;
101
107 virtual bool getAllItems(QList<StorageItem *> &aItems) = 0;
108
114 virtual bool getAllItemIds(QList<QString> &aItems) = 0;
115
122 virtual bool getNewItems(QList<StorageItem *> &aNewItems, const QDateTime &aTime) = 0;
123
130 virtual bool getNewItemIds(QList<QString> &aNewItemIds, const QDateTime &aTime) = 0;
131
139 virtual bool getModifiedItems(QList<StorageItem *> &aModifiedItems, const QDateTime &aTime) = 0;
140
148 virtual bool getModifiedItemIds(QList<QString> &aModifiedItemIds, const QDateTime &aTime) = 0;
149
157 virtual bool getDeletedItemIds(QList<QString> &aDeletedItemIds, const QDateTime &aTime) = 0;
158
167 virtual StorageItem *newItem() = 0;
168
174 virtual StorageItem *getItem(const QString &aItemId) = 0;
175
181 virtual QList<StorageItem *> getItems(const QStringList &aItemIdList) = 0;
182
192
202
209
216
222 virtual OperationStatus deleteItem(const QString &aItemId) = 0;
223
230
231protected:
233 QString iPluginName;
234
237};
238
239}
240
241#endif // STORAGEPLUGIN_H_89943984899843
Class to describe a storable item.
Definition StorageItem.h:37
Base class for storage plugins.
Definition StoragePlugin.h:39
void getProperties(QMap< QString, QString > &aProperties) const
Returns the properties set for this plugin.
Definition StoragePlugin.cpp:51
virtual QList< OperationStatus > deleteItems(const QList< QString > &aItemIds)=0
Deletes an item from the storage.
virtual OperationStatus deleteItem(const QString &aItemId)=0
Deletes an item from the storage.
QString getProperty(const QString &aProperty) const
Returns the value of the given property.
Definition StoragePlugin.cpp:41
virtual QList< StorageItem * > getItems(const QStringList &aItemIdList)=0
Returns items based on ids.
virtual bool getNewItemIds(QList< QString > &aNewItemIds, const QDateTime &aTime)=0
Returns id's of all new items since aTime (creation time > aTime)
virtual bool getModifiedItems(QList< StorageItem * > &aModifiedItems, const QDateTime &aTime)=0
Returns all modified items since aTime.
virtual bool uninit()=0
Uninitializes the plugin.
virtual StorageItem * getItem(const QString &aItemId)=0
Returns an item based on id.
QMap< QString, QString > iProperties
Properties of the plugin as read from profile xml.
Definition StoragePlugin.h:236
OperationStatus
Status of operation performed by storage plugin.
Definition StoragePlugin.h:46
@ STATUS_OBJECT_TOO_BIG
Definition StoragePlugin.h:49
@ STATUS_INVALID_FORMAT
Definition StoragePlugin.h:47
@ STATUS_NOT_FOUND
Definition StoragePlugin.h:52
@ STATUS_ERROR
Definition StoragePlugin.h:50
@ STATUS_STORAGE_FULL
Definition StoragePlugin.h:48
@ STATUS_OK
Definition StoragePlugin.h:53
@ STATUS_DUPLICATE
Definition StoragePlugin.h:51
virtual StorageItem * newItem()=0
Generates a new item.
virtual bool getModifiedItemIds(QList< QString > &aModifiedItemIds, const QDateTime &aTime)=0
Returns id's of all modified items since aTime.
const QString & getPluginName() const
Returns the name of this plugin.
Definition StoragePlugin.cpp:36
QString iPluginName
Name of the plugin.
Definition StoragePlugin.h:233
virtual bool init(const QMap< QString, QString > &aProperties)=0
Initializes the plugin.
virtual bool getAllItems(QList< StorageItem * > &aItems)=0
Returns all known items.
virtual QList< OperationStatus > modifyItems(const QList< StorageItem * > &aItems)=0
Modifies item in the storage.
virtual bool getNewItems(QList< StorageItem * > &aNewItems, const QDateTime &aTime)=0
Returns all new items since aTime.
virtual OperationStatus addItem(StorageItem &aItem)=0
Adds an item to the storage.
virtual QList< OperationStatus > addItems(const QList< StorageItem * > &aItems)=0
Adds items to the storage.
virtual bool getDeletedItemIds(QList< QString > &aDeletedItemIds, const QDateTime &aTime)=0
Returns id's of all deleted items since aTime.
virtual bool getAllItemIds(QList< QString > &aItems)=0
Returns id's of all known items.
virtual ~StoragePlugin()
Destructor.
Definition StoragePlugin.cpp:32
virtual OperationStatus modifyItem(StorageItem &aItem)=0
Modifies an item in the storage.
Definition SyncBackupAdaptor.h:40
Definition SyncBackupAdaptor.h:41