Buteo Synchronization Framework
|
Base class for storage plugins. More...
#include <StoragePlugin.h>
Public Types | |
enum | OperationStatus { STATUS_INVALID_FORMAT = -6 , STATUS_STORAGE_FULL = -5 , STATUS_OBJECT_TOO_BIG = -4 , STATUS_ERROR = -3 , STATUS_DUPLICATE = -2 , STATUS_NOT_FOUND = -1 , STATUS_OK = 0 } |
Status of operation performed by storage plugin. More... | |
Public Member Functions | |
StoragePlugin (const QString &aPluginName) | |
Constructor. More... | |
virtual | ~StoragePlugin () |
Destructor. | |
const QString & | getPluginName () const |
Returns the name of this plugin. More... | |
QString | getProperty (const QString &aProperty) const |
Returns the value of the given property. More... | |
void | getProperties (QMap< QString, QString > &aProperties) const |
Returns the properties set for this plugin. More... | |
virtual bool | init (const QMap< QString, QString > &aProperties)=0 |
Initializes the plugin. More... | |
virtual bool | uninit ()=0 |
Uninitializes the plugin. | |
virtual bool | getAllItems (QList< StorageItem * > &aItems)=0 |
Returns all known items. More... | |
virtual bool | getAllItemIds (QList< QString > &aItems)=0 |
Returns id's of all known items. More... | |
virtual bool | getNewItems (QList< StorageItem * > &aNewItems, const QDateTime &aTime)=0 |
Returns all new items since aTime. More... | |
virtual bool | getNewItemIds (QList< QString > &aNewItemIds, const QDateTime &aTime)=0 |
Returns id's of all new items since aTime (creation time > aTime) More... | |
virtual bool | getModifiedItems (QList< StorageItem * > &aModifiedItems, const QDateTime &aTime)=0 |
Returns all modified items since aTime. More... | |
virtual bool | getModifiedItemIds (QList< QString > &aModifiedItemIds, const QDateTime &aTime)=0 |
Returns id's of all modified items since aTime. More... | |
virtual bool | getDeletedItemIds (QList< QString > &aDeletedItemIds, const QDateTime &aTime)=0 |
Returns id's of all deleted items since aTime. More... | |
virtual StorageItem * | newItem ()=0 |
Generates a new item. More... | |
virtual StorageItem * | getItem (const QString &aItemId)=0 |
Returns an item based on id. More... | |
virtual QList< StorageItem * > | getItems (const QStringList &aItemIdList)=0 |
Returns items based on ids. More... | |
virtual OperationStatus | addItem (StorageItem &aItem)=0 |
Adds an item to the storage. More... | |
virtual QList< OperationStatus > | addItems (const QList< StorageItem * > &aItems)=0 |
Adds items to the storage. More... | |
virtual OperationStatus | modifyItem (StorageItem &aItem)=0 |
Modifies an item in the storage. More... | |
virtual QList< OperationStatus > | modifyItems (const QList< StorageItem * > &aItems)=0 |
Modifies item in the storage. More... | |
virtual OperationStatus | deleteItem (const QString &aItemId)=0 |
Deletes an item from the storage. More... | |
virtual QList< OperationStatus > | deleteItems (const QList< QString > &aItemIds)=0 |
Deletes an item from the storage. More... | |
Protected Attributes | |
QString | iPluginName |
Name of the plugin. | |
QMap< QString, QString > | iProperties |
Properties of the plugin as read from profile xml. | |
Base class for storage plugins.
Status of operation performed by storage plugin.
StoragePlugin::StoragePlugin | ( | const QString & | aPluginName | ) |
Constructor.
aPluginName | Name of this storage plugin |
|
pure virtual |
Adds an item to the storage.
Upon successful addition, item is updated with its assigned ID.
aItem | Item to add |
|
pure virtual |
Adds items to the storage.
Upon successful addition, items are updated with its assigned ID.
aItems | Items to add |
|
pure virtual |
Deletes an item from the storage.
aItemId | Id of the item to be deleted |
|
pure virtual |
Deletes an item from the storage.
aItemIds | Id's of the item to be deleted |
|
pure virtual |
Returns id's of all known items.
aItems | Array where to place item id's |
|
pure virtual |
Returns all known items.
aItems | Array where to place items |
|
pure virtual |
Returns id's of all deleted items since aTime.
aDeletedItemIds | Array where to place item id's |
aTime | Items with deletion time > aTime and creation time <= aTime are returned. |
|
pure virtual |
Returns an item based on id.
aItemId | Id of the item to return |
|
pure virtual |
Returns items based on ids.
aItemIdList | List of id's |
|
pure virtual |
Returns id's of all modified items since aTime.
aModifiedItemIds | Array where to place item id's |
aTime | Items with modification time > aTime and creation time <= aTime are returned. |
|
pure virtual |
Returns all modified items since aTime.
aModifiedItems | Array where to place items |
aTime | Items with modification time > aTime and creation time <= aTime are returned. |
|
pure virtual |
Returns id's of all new items since aTime (creation time > aTime)
aNewItemIds | Array where to place item id's |
aTime | Items with creation time > aTime are returned |
|
pure virtual |
Returns all new items since aTime.
aNewItems | Array where to place items |
aTime | Items with creation time > aTime are returned |
const QString & StoragePlugin::getPluginName | ( | ) | const |
Returns the name of this plugin.
void StoragePlugin::getProperties | ( | QMap< QString, QString > & | aProperties | ) | const |
Returns the properties set for this plugin.
aProperties | Properties that are set |
QString StoragePlugin::getProperty | ( | const QString & | aProperty | ) | const |
Returns the value of the given property.
aProperty | Property |
|
pure virtual |
Initializes the plugin.
It is recommended that the plugin should do not do any thread insecure initializations inside constructor, instead it should do inside this method. Parameters that were read from storage profile are passed as parameter to this function.
aProperties | Properties that should be set for this plugin |
|
pure virtual |
Modifies an item in the storage.
aItem | Item to modify |
|
pure virtual |
Modifies item in the storage.
aItems | Items to add |
|
pure virtual |
Generates a new item.
Returned item is temporary. Therefore returned item ALWAYS has its id set as empty ID (""). ID will be assigned only after addItem() has been called for the item.