Buteo Synchronization Framework
Public Types | Public Member Functions | Protected Attributes | List of all members
Buteo::StoragePlugin Class Referenceabstract

Base class for storage plugins. More...

#include <StoragePlugin.h>

Inheritance diagram for Buteo::StoragePlugin:

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.
 
virtual ~StoragePlugin ()
 Destructor.
 
const QString & getPluginName () const
 Returns the name of this plugin.
 
QString getProperty (const QString &aProperty) const
 Returns the value of the given property.
 
void getProperties (QMap< QString, QString > &aProperties) const
 Returns the properties set for this plugin.
 
virtual bool init (const QMap< QString, QString > &aProperties)=0
 Initializes the plugin.
 
virtual bool uninit ()=0
 Uninitializes the plugin.
 
virtual bool getAllItems (QList< StorageItem * > &aItems)=0
 Returns all known items.
 
virtual bool getAllItemIds (QList< QString > &aItems)=0
 Returns id's of all known items.
 
virtual bool getNewItems (QList< StorageItem * > &aNewItems, const QDateTime &aTime)=0
 Returns all new items since aTime.
 
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 getModifiedItemIds (QList< QString > &aModifiedItemIds, const QDateTime &aTime)=0
 Returns id's of all modified items since aTime.
 
virtual bool getDeletedItemIds (QList< QString > &aDeletedItemIds, const QDateTime &aTime)=0
 Returns id's of all deleted items since aTime.
 
virtual StorageItemnewItem ()=0
 Generates a new item.
 
virtual StorageItemgetItem (const QString &aItemId)=0
 Returns an item based on id.
 
virtual QList< StorageItem * > getItems (const QStringList &aItemIdList)=0
 Returns items based on ids.
 
virtual OperationStatus addItem (StorageItem &aItem)=0
 Adds an item to the storage.
 
virtual QList< OperationStatusaddItems (const QList< StorageItem * > &aItems)=0
 Adds items to the storage.
 
virtual OperationStatus modifyItem (StorageItem &aItem)=0
 Modifies an item in the storage.
 
virtual QList< OperationStatusmodifyItems (const QList< StorageItem * > &aItems)=0
 Modifies item in the storage.
 
virtual OperationStatus deleteItem (const QString &aItemId)=0
 Deletes an item from the storage.
 
virtual QList< OperationStatusdeleteItems (const QList< QString > &aItemIds)=0
 Deletes an item from the storage.
 

Protected Attributes

QString iPluginName
 Name of the plugin.
 
QMap< QString, QString > iProperties
 Properties of the plugin as read from profile xml.
 

Detailed Description

Base class for storage plugins.

Member Enumeration Documentation

◆ OperationStatus

Status of operation performed by storage plugin.

Enumerator
STATUS_INVALID_FORMAT 

Operation failed because data is in invalid format

STATUS_STORAGE_FULL 

Operation failed because storage is full

STATUS_OBJECT_TOO_BIG 

Operation failed because object is too big

STATUS_ERROR 

General error occurred during operation

STATUS_DUPLICATE 

Operation was not performed as object was duplicate

STATUS_NOT_FOUND 

Operation failed as object was not found

STATUS_OK 

Operation was completed successfully

Constructor & Destructor Documentation

◆ StoragePlugin()

StoragePlugin::StoragePlugin ( const QString & aPluginName)

Constructor.

Parameters
aPluginNameName of this storage plugin

Member Function Documentation

◆ addItem()

virtual OperationStatus Buteo::StoragePlugin::addItem ( StorageItem & aItem)
pure virtual

Adds an item to the storage.

Upon successful addition, item is updated with its assigned ID.

Parameters
aItemItem to add
Returns
Operation status code

◆ addItems()

virtual QList< OperationStatus > Buteo::StoragePlugin::addItems ( const QList< StorageItem * > & aItems)
pure virtual

Adds items to the storage.

Upon successful addition, items are updated with its assigned ID.

Parameters
aItemsItems to add
Returns
Operation status codes

◆ deleteItem()

virtual OperationStatus Buteo::StoragePlugin::deleteItem ( const QString & aItemId)
pure virtual

Deletes an item from the storage.

Parameters
aItemIdId of the item to be deleted
Returns
Operation status code

◆ deleteItems()

virtual QList< OperationStatus > Buteo::StoragePlugin::deleteItems ( const QList< QString > & aItemIds)
pure virtual

Deletes an item from the storage.

Parameters
aItemIdsId's of the item to be deleted
Returns
Operation status codes

◆ getAllItemIds()

virtual bool Buteo::StoragePlugin::getAllItemIds ( QList< QString > & aItems)
pure virtual

Returns id's of all known items.

Parameters
aItemsArray where to place item id's
Returns
True on success, otherwise false

◆ getAllItems()

virtual bool Buteo::StoragePlugin::getAllItems ( QList< StorageItem * > & aItems)
pure virtual

Returns all known items.

Parameters
aItemsArray where to place items
Returns
True on success, otherwise false

◆ getDeletedItemIds()

virtual bool Buteo::StoragePlugin::getDeletedItemIds ( QList< QString > & aDeletedItemIds,
const QDateTime & aTime )
pure virtual

Returns id's of all deleted items since aTime.

Parameters
aDeletedItemIdsArray where to place item id's
aTimeItems with deletion time > aTime and creation time <= aTime are returned.
Returns
True on success, otherwise false

◆ getItem()

virtual StorageItem * Buteo::StoragePlugin::getItem ( const QString & aItemId)
pure virtual

Returns an item based on id.

Parameters
aItemIdId of the item to return
Returns
On success pointer to the item, otherwise NULL

◆ getItems()

virtual QList< StorageItem * > Buteo::StoragePlugin::getItems ( const QStringList & aItemIdList)
pure virtual

Returns items based on ids.

Parameters
aItemIdListList of id's
Returns
List of items

◆ getModifiedItemIds()

virtual bool Buteo::StoragePlugin::getModifiedItemIds ( QList< QString > & aModifiedItemIds,
const QDateTime & aTime )
pure virtual

Returns id's of all modified items since aTime.

Parameters
aModifiedItemIdsArray where to place item id's
aTimeItems with modification time > aTime and creation time <= aTime are returned.
Returns
True on success, otherwise false

◆ getModifiedItems()

virtual bool Buteo::StoragePlugin::getModifiedItems ( QList< StorageItem * > & aModifiedItems,
const QDateTime & aTime )
pure virtual

Returns all modified items since aTime.

Parameters
aModifiedItemsArray where to place items
aTimeItems with modification time > aTime and creation time <= aTime are returned.
Returns
True on success, otherwise false

◆ getNewItemIds()

virtual bool Buteo::StoragePlugin::getNewItemIds ( QList< QString > & aNewItemIds,
const QDateTime & aTime )
pure virtual

Returns id's of all new items since aTime (creation time > aTime)

Parameters
aNewItemIdsArray where to place item id's
aTimeItems with creation time > aTime are returned
Returns
True on success, otherwise false

◆ getNewItems()

virtual bool Buteo::StoragePlugin::getNewItems ( QList< StorageItem * > & aNewItems,
const QDateTime & aTime )
pure virtual

Returns all new items since aTime.

Parameters
aNewItemsArray where to place items
aTimeItems with creation time > aTime are returned
Returns
True on success, otherwise false

◆ getPluginName()

const QString & StoragePlugin::getPluginName ( ) const

Returns the name of this plugin.

Returns
Name of the plugin

◆ getProperties()

void StoragePlugin::getProperties ( QMap< QString, QString > & aProperties) const

Returns the properties set for this plugin.

Parameters
aPropertiesProperties that are set

◆ getProperty()

QString StoragePlugin::getProperty ( const QString & aProperty) const

Returns the value of the given property.

Parameters
aPropertyProperty
Returns
Property value if property found, otherwise empty string

◆ init()

virtual bool Buteo::StoragePlugin::init ( const QMap< QString, QString > & aProperties)
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.

Parameters
aPropertiesProperties that should be set for this plugin

◆ modifyItem()

virtual OperationStatus Buteo::StoragePlugin::modifyItem ( StorageItem & aItem)
pure virtual

Modifies an item in the storage.

Parameters
aItemItem to modify
Returns
Operation status code

◆ modifyItems()

virtual QList< OperationStatus > Buteo::StoragePlugin::modifyItems ( const QList< StorageItem * > & aItems)
pure virtual

Modifies item in the storage.

Parameters
aItemsItems to add
Returns
Operation status codes

◆ newItem()

virtual StorageItem * Buteo::StoragePlugin::newItem ( )
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.

Returns
On success pointer to the item generated, otherwise NULL

The documentation for this class was generated from the following files: