HarmattanSyncApplications
syncmlcommon/StorageAdapter.h
1/*
2 * This file is part of buteo-sync-plugins 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 STORAGEADAPTER_H
25#define STORAGEADAPTER_H
26
27#include <QMap>
28#include <QVector>
29
30#include <buteosyncfw5/StoragePlugin.h>
31#include <buteosyncml5/StoragePlugin.h>
32#include <buteosyncml5/DataStore.h>
33#include <buteosyncml5/SyncItemKey.h>
34
35#include "ItemIdMapper.h"
36
37class StoragePlugin;
38class StorageItem;
39
46class StorageAdapter : public DataSync::StoragePlugin
47{
48
49public:
50
55 StorageAdapter( Buteo::StoragePlugin* aPlugin );
56
60 virtual ~StorageAdapter();
61
66 bool isValid();
67
72 Buteo::StoragePlugin* getPlugin() const;
73
80 bool init();
81
86 bool uninit();
87
91 virtual const QString& getSourceURI() const;
92
96 virtual const DataSync::StorageContentFormatInfo& getFormatInfo() const;
97
101 virtual qint64 getMaxObjSize() const;
102
106 virtual QByteArray getPluginCTCaps( DataSync::ProtocolVersion aVersion ) const;
107
111 virtual QByteArray getPluginExts() const;
112
116 virtual bool getAll( QList<DataSync::SyncItemKey>& aKeys );
117
121 virtual bool getModifications( QList<DataSync::SyncItemKey>& aNewKeys,
122 QList<DataSync::SyncItemKey>& aReplacedKeys,
123 QList<DataSync::SyncItemKey>& aDeletedKeys,
124 const QDateTime& aTimeStamp );
125
129 virtual DataSync::SyncItem* newItem();
130
134 virtual DataSync::SyncItem* getSyncItem( const DataSync::SyncItemKey& aKey );
135
139 virtual QList<DataSync::SyncItem*> getSyncItems( const QList <DataSync::SyncItemKey>& aKeyList );
140
144 virtual QList<StoragePluginStatus> addItems( const QList<DataSync::SyncItem*>& aItems );
145
149 virtual QList<StoragePluginStatus> replaceItems( const QList<DataSync::SyncItem*>& aItems );
150
154 virtual QList<StoragePluginStatus> deleteItems( const QList<DataSync::SyncItemKey>& aKeys );
155
156protected:
157
158private:
159
160 DataSync::StoragePlugin::StoragePluginStatus convertStatus( Buteo::StoragePlugin::OperationStatus aStatus ) const;
161
162 Buteo::StorageItem* toStorageItem( const DataSync::SyncItem* aSyncItem ) const;
163
164
165 Buteo::StoragePlugin* iPlugin;
166
167 QString iType;
168
169 DataSync::StorageContentFormatInfo iFormats;
170 QString iSourceDB;
171 QString iTargetDB;
172
173 ItemIdMapper iIdMapper;
174
175};
176
177#endif // STORAGEADAPTER_H
Storage for persistently mapping ID's supplied by storage plugins to formats suitable for remote Sync...
Definition debian/tmp/usr/include/syncmlcommon/ItemIdMapper.h:34
Adapter to adapt framework storage plugin to SyncML stack storage plugin.
Definition debian/tmp/usr/include/syncmlcommon/StorageAdapter.h:47
virtual const DataSync::StorageContentFormatInfo & getFormatInfo() const
virtual DataSync::SyncItem * getSyncItem(const DataSync::SyncItemKey &aKey)
StorageAdapter(Buteo::StoragePlugin *aPlugin)
Constructor.
bool isValid()
Returns if this adapter instance is valid.
virtual QList< StoragePluginStatus > replaceItems(const QList< DataSync::SyncItem * > &aItems)
virtual QByteArray getPluginCTCaps(DataSync::ProtocolVersion aVersion) const
virtual DataSync::SyncItem * newItem()
virtual bool getAll(QList< DataSync::SyncItemKey > &aKeys)
virtual QByteArray getPluginExts() const
virtual qint64 getMaxObjSize() const
virtual QList< StoragePluginStatus > deleteItems(const QList< DataSync::SyncItemKey > &aKeys)
virtual QList< StoragePluginStatus > addItems(const QList< DataSync::SyncItem * > &aItems)
virtual ~StorageAdapter()
Destructor.
virtual bool getModifications(QList< DataSync::SyncItemKey > &aNewKeys, QList< DataSync::SyncItemKey > &aReplacedKeys, QList< DataSync::SyncItemKey > &aDeletedKeys, const QDateTime &aTimeStamp)
bool uninit()
Uninitializes adapter.
bool init()
Initializes adapter.
virtual QList< DataSync::SyncItem * > getSyncItems(const QList< DataSync::SyncItemKey > &aKeyList)
virtual const QString & getSourceURI() const
Buteo::StoragePlugin * getPlugin() const
Returns the FW plugin instance.