StorageAdapter.h
/*
* This file is part of buteo-sync-plugins package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef STORAGEADAPTER_H
#define STORAGEADAPTER_H
#include <QMap>
#include <QVector>
#include <buteosyncfw5/StoragePlugin.h>
#include <buteosyncml5/StoragePlugin.h>
#include <buteosyncml5/DataStore.h>
#include <buteosyncml5/SyncItemKey.h>
#include "ItemIdMapper.h"
class StoragePlugin;
class StorageItem;
class StorageAdapter : public DataSync::StoragePlugin
{
public:
StorageAdapter( Buteo::StoragePlugin* aPlugin );
virtual ~StorageAdapter();
bool isValid();
Buteo::StoragePlugin* getPlugin() const;
bool init();
bool uninit();
virtual const QString& getSourceURI() const;
virtual const DataSync::StorageContentFormatInfo& getFormatInfo() const;
virtual qint64 getMaxObjSize() const;
virtual QByteArray getPluginCTCaps( DataSync::ProtocolVersion aVersion ) const;
virtual QByteArray getPluginExts() const;
virtual bool getAll( QList<DataSync::SyncItemKey>& aKeys );
virtual bool getModifications( QList<DataSync::SyncItemKey>& aNewKeys,
QList<DataSync::SyncItemKey>& aReplacedKeys,
QList<DataSync::SyncItemKey>& aDeletedKeys,
const QDateTime& aTimeStamp );
virtual DataSync::SyncItem* newItem();
virtual DataSync::SyncItem* getSyncItem( const DataSync::SyncItemKey& aKey );
virtual QList<DataSync::SyncItem*> getSyncItems( const QList <DataSync::SyncItemKey>& aKeyList );
virtual QList<StoragePluginStatus> addItems( const QList<DataSync::SyncItem*>& aItems );
virtual QList<StoragePluginStatus> replaceItems( const QList<DataSync::SyncItem*>& aItems );
virtual QList<StoragePluginStatus> deleteItems( const QList<DataSync::SyncItemKey>& aKeys );
protected:
private:
DataSync::StoragePlugin::StoragePluginStatus convertStatus( Buteo::StoragePlugin::OperationStatus aStatus ) const;
Buteo::StorageItem* toStorageItem( const DataSync::SyncItem* aSyncItem ) const;
Buteo::StoragePlugin* iPlugin;
QString iType;
DataSync::StorageContentFormatInfo iFormats;
QString iSourceDB;
QString iTargetDB;
ItemIdMapper iIdMapper;
};
#endif // STORAGEADAPTER_H
ItemIdMapper
Storage for persistently mapping ID's supplied by storage plugins to formats suitable for remote Sync...
Definition ItemIdMapper.h:34
StorageAdapter::getFormatInfo
virtual const DataSync::StorageContentFormatInfo & getFormatInfo() const
StorageAdapter::getSyncItem
virtual DataSync::SyncItem * getSyncItem(const DataSync::SyncItemKey &aKey)
StorageAdapter::StorageAdapter
StorageAdapter(Buteo::StoragePlugin *aPlugin)
Constructor.
StorageAdapter::isValid
bool isValid()
Returns if this adapter instance is valid.
StorageAdapter::replaceItems
virtual QList< StoragePluginStatus > replaceItems(const QList< DataSync::SyncItem * > &aItems)
StorageAdapter::getPluginCTCaps
virtual QByteArray getPluginCTCaps(DataSync::ProtocolVersion aVersion) const
StorageAdapter::newItem
virtual DataSync::SyncItem * newItem()
StorageAdapter::getAll
virtual bool getAll(QList< DataSync::SyncItemKey > &aKeys)
StorageAdapter::getPluginExts
virtual QByteArray getPluginExts() const
StorageAdapter::getMaxObjSize
virtual qint64 getMaxObjSize() const
StorageAdapter::deleteItems
virtual QList< StoragePluginStatus > deleteItems(const QList< DataSync::SyncItemKey > &aKeys)
StorageAdapter::addItems
virtual QList< StoragePluginStatus > addItems(const QList< DataSync::SyncItem * > &aItems)
StorageAdapter::~StorageAdapter
virtual ~StorageAdapter()
Destructor.
StorageAdapter::getModifications
virtual bool getModifications(QList< DataSync::SyncItemKey > &aNewKeys, QList< DataSync::SyncItemKey > &aReplacedKeys, QList< DataSync::SyncItemKey > &aDeletedKeys, const QDateTime &aTimeStamp)
StorageAdapter::uninit
bool uninit()
Uninitializes adapter.
StorageAdapter::init
bool init()
Initializes adapter.
StorageAdapter::getSyncItems
virtual QList< DataSync::SyncItem * > getSyncItems(const QList< DataSync::SyncItemKey > &aKeyList)
StorageAdapter::getSourceURI
virtual const QString & getSourceURI() const
StorageAdapter::getPlugin
Buteo::StoragePlugin * getPlugin() const
Returns the FW plugin instance.