class CHarvesterPlugin : public CActive |
Harvester Plug-in ECom interface definition. Harvester plug-in implementation needs to inherit this class and implement the pure virtual method (HarvestL) which exist in this interface.
Example:
class CMyHarvesterPlugin: public CHarvesterPlugin { public:
// This method should also be overwritten in the plug-in void GetObjectType( const TDesC& aUri, TDes& aObjectType );
void HarvestL( CHarvesterData* aHD ); }
void GetObjectType( const TDesC& aUri, TDes& aObjectType ) { // Idea in this method is that it MUST return one of the object types // supported by the MdE DB - for example "Image", "Video" or "Audio". // If plug-in supports only one type of objects then it can just return // always that like: // TPtrC ptrImage( KImage ); // aObjectType.Copy( KImage ); return; // // However if multiple MdE object types are supported then file content // needs to be checked for example from file MIME-type like here:
TRAPD( err, content = CContent::NewL( aUri ) ); if (err == KErrNone) { err = content->GetStringAttribute( EMimeType, mime ); delete content; }
TPtrC ptrImage( KImage );
// MdsUtils::Find tries to find word "image" from the MIME-type // so that we know the file is an image if( MdsUtils::Find( mime, ptrImage ) != KErrNotFound ) { WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - mimetype %S. Object type changed to Image", &mime ); aObjectType.Copy( KImage ); return; }
TPtrC ptrVideo( KVideo ); if( MdsUtils::Find( mime, ptrVideo ) != KErrNotFound ) { WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - mimetype %S. Object type changed to Video", &mime ); aObjectType.Copy( KVideo ); return; } }
void HarvestL( CHarvesterData* aHD ) { CMdEObject& mdeObject = aHD->MdeObject();
CMdeObjectWrapper* wrapper = CMdeObjectWrapper::NewL(); }
Public Member Functions | |
---|---|
~CHarvesterPlugin() | |
IMPORT_C void | GetMimeType(const TDesC &, TDes &) |
IMPORT_C void | GetObjectType(const TDesC &, TDes &) |
IMPORT_C void | ListImplementationsL(RImplInfoPtrArray &) |
IMPORT_C CHarvesterPlugin * | NewL(const TUid &) |
IMPORT_C void | SetBlacklist(CHarvesterBlacklist &) |
IMPORT_C void | SetHarvesterPluginFactory(CHarvesterPluginFactory &) |
IMPORT_C void | SetQueue(RPointerArray< CHarvesterData > &) |
IMPORT_C void | StartHarvest() |
Protected Member Functions | |
---|---|
CHarvesterPlugin() | |
void | ConstructL() |
IMPORT_C void | DoCancel() |
IMPORT_C void | HarvestL(CHarvesterData *) |
IMPORT_C TInt | RunError(TInt) |
IMPORT_C void | RunL() |
Private Member Functions | |
---|---|
void | SetDefaultPropertiesL(CHarvesterData &) |
void | SetNextRequest(THarvesterState) |
Public Member Enumerations | |
---|---|
enum | THarvesterState { EHarvesterIdle = 0, EHarvesterGathering } |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Protected Attributes | |
---|---|
CHarvesterBlacklist * | iBlacklist |
CHarvesterPluginFactory * | iFactory |
TBool | iFastModeEnabled |
RFs | iFs |
RPointerArray< CHarvesterData > * | iQueue |
THarvesterState | iState |
Private Attributes | |
---|---|
TUid | iDtor_ID_Key |
TBool | iHarvesting |
CMdEPropertyDef * | iOriginPropertyDef |
CMdEPropertyDef * | iTitlePropertyDef |
Inherited Attributes | |
---|---|
CActive::iStatus |
IMPORT_C | ~CHarvesterPlugin | ( | ) | [virtual] |
Destructor - virtual and class not intended for derivation, so not exported.
IMPORT_C void | GetMimeType | ( | const TDesC & | aUri, |
TDes & | aMimeType | |||
) | [virtual] |
Method for getting the mime type for given uri
IMPORT_C void | GetObjectType | ( | const TDesC & | aUri, |
TDes & | aObjectType | |||
) | [virtual] |
Method which returns the MdE object type to harvesting FW when passing the file name to this method (aURI). The harvesting plug-in should overwrite method. In the case there are more than one plug-ins which support same file extension atleast one of these plug-ins needs to read the binary file for determining the valid MdE object type for the file.
IMPORT_C void | HarvestL | ( | CHarvesterData * | aHD | ) | [protected, pure virtual] |
The method which does the actual harvesting. Harvesting plug-in MUST implelemt this method.
CHarvesterData * aHD | Pointer to harvesting data/request. |
IMPORT_C void | ListImplementationsL | ( | RImplInfoPtrArray & | aImplInfoArray | ) | [static] |
Lists all available implementations which satisfy this given interface.
RImplInfoPtrArray & aImplInfoArray | Reference to a list which will be populated with plug-in implementation details. |
IMPORT_C CHarvesterPlugin * | NewL | ( | const TUid & | aUid | ) | [static] |
Construction
const TUid & aUid |
IMPORT_C TInt | RunError | ( | TInt | aError | ) | [protected, virtual] |
Active object RunError implementation.
TInt aError |
IMPORT_C void | SetBlacklist | ( | CHarvesterBlacklist & | aBlacklist | ) | [virtual] |
Method for setting the blacklisting functionality for the plug-in.
CHarvesterBlacklist & aBlacklist | Reference to blacklisting component. |
void | SetDefaultPropertiesL | ( | CHarvesterData & | aData | ) | [private] |
Method sets some default properties to the metadata object
CHarvesterData & aData | Pointer to harvesting data/request. |
IMPORT_C void | SetHarvesterPluginFactory | ( | CHarvesterPluginFactory & | aFactory | ) |
Method for adding reference to harvester plugin factory
CHarvesterPluginFactory & aFactory |
void | SetNextRequest | ( | THarvesterState | aState | ) | [private] |
Sets next state for the active object
THarvesterState aState | Next state to execute with RunL. |
IMPORT_C void | SetQueue | ( | RPointerArray< CHarvesterData > & | aQueue | ) | [virtual] |
Method sets the Harvesting queue to the plug-in.
RPointerArray< CHarvesterData > & aQueue | Queue which contains harvesting requests. |
IMPORT_C void | StartHarvest | ( | ) | [virtual] |
Method which starts the harvesting of the file. Called by the harvesting framework from CHarvesterPluginFactory::HarvestL.
CHarvesterBlacklist * | iBlacklist | [protected] |
Pointer to blacklisting functionality
RPointerArray< CHarvesterData > * | iQueue | [protected] |
Pointer to Harvesting request queue.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.