CHarvesterPlugin Class Reference

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(); }

Inherits from

Public Member Functions
~CHarvesterPlugin()
IMPORT_C voidGetMimeType(const TDesC &, TDes &)
IMPORT_C voidGetObjectType(const TDesC &, TDes &)
IMPORT_C voidListImplementationsL(RImplInfoPtrArray &)
IMPORT_C CHarvesterPlugin *NewL(const TUid &)
IMPORT_C voidSetBlacklist(CHarvesterBlacklist &)
IMPORT_C voidSetHarvesterPluginFactory(CHarvesterPluginFactory &)
IMPORT_C voidSetQueue(RPointerArray< CHarvesterData > &)
IMPORT_C voidStartHarvest()
Protected Member Functions
CHarvesterPlugin()
voidConstructL()
IMPORT_C voidDoCancel()
IMPORT_C voidHarvestL(CHarvesterData *)
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunL()
Private Member Functions
voidSetDefaultPropertiesL(CHarvesterData &)
voidSetNextRequest(THarvesterState)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTHarvesterState { 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

Constructor & Destructor Documentation

CHarvesterPlugin()

IMPORT_CCHarvesterPlugin()[protected]

Constuctor

~CHarvesterPlugin()

IMPORT_C~CHarvesterPlugin()[virtual]

Destructor - virtual and class not intended for derivation, so not exported.

Member Functions Documentation

ConstructL()

voidConstructL()[protected]

Construction of the interface class

DoCancel()

IMPORT_C voidDoCancel()[protected, virtual]

Active object DoCancel implementation.

GetMimeType(const TDesC &, TDes &)

IMPORT_C voidGetMimeType(const TDesC &aUri,
TDes &aMimeType
)[virtual]

Method for getting the mime type for given uri

Parameters

const TDesC & aUri
TDes & aMimeType

GetObjectType(const TDesC &, TDes &)

IMPORT_C voidGetObjectType(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.

Parameters

const TDesC & aUriURI of the file/item.
TDes & aObjectTypeReference to an object type which will returned to the FW from the plug-in

HarvestL(CHarvesterData *)

IMPORT_C voidHarvestL(CHarvesterData *aHD)[protected, pure virtual]

The method which does the actual harvesting. Harvesting plug-in MUST implelemt this method.

Parameters

CHarvesterData * aHDPointer to harvesting data/request.

ListImplementationsL(RImplInfoPtrArray &)

IMPORT_C voidListImplementationsL(RImplInfoPtrArray &aImplInfoArray)[static]

Lists all available implementations which satisfy this given interface.

Parameters

RImplInfoPtrArray & aImplInfoArrayReference to a list which will be populated with plug-in implementation details.

NewL(const TUid &)

IMPORT_C CHarvesterPlugin *NewL(const TUid &aUid)[static]

Construction

Parameters

const TUid & aUid

RunError(TInt)

IMPORT_C TIntRunError(TIntaError)[protected, virtual]

Active object RunError implementation.

Parameters

TInt aError

RunL()

IMPORT_C voidRunL()[protected, virtual]

Active object RunL implementation.

SetBlacklist(CHarvesterBlacklist &)

IMPORT_C voidSetBlacklist(CHarvesterBlacklist &aBlacklist)[virtual]

Method for setting the blacklisting functionality for the plug-in.

Parameters

CHarvesterBlacklist & aBlacklistReference to blacklisting component.

SetDefaultPropertiesL(CHarvesterData &)

voidSetDefaultPropertiesL(CHarvesterData &aData)[private]

Method sets some default properties to the metadata object

Parameters

CHarvesterData & aDataPointer to harvesting data/request.

SetHarvesterPluginFactory(CHarvesterPluginFactory &)

IMPORT_C voidSetHarvesterPluginFactory(CHarvesterPluginFactory &aFactory)

Method for adding reference to harvester plugin factory

Parameters

CHarvesterPluginFactory & aFactory

SetNextRequest(THarvesterState)

voidSetNextRequest(THarvesterStateaState)[private]

Sets next state for the active object

Parameters

THarvesterState aStateNext state to execute with RunL.

SetQueue(RPointerArray< CHarvesterData > &)

IMPORT_C voidSetQueue(RPointerArray< CHarvesterData > &aQueue)[virtual]

Method sets the Harvesting queue to the plug-in.

Parameters

RPointerArray< CHarvesterData > & aQueueQueue which contains harvesting requests.

StartHarvest()

IMPORT_C voidStartHarvest()[virtual]

Method which starts the harvesting of the file. Called by the harvesting framework from CHarvesterPluginFactory::HarvestL.

Member Enumerations Documentation

Enum THarvesterState

Enumerators

EHarvesterIdle = 0
EHarvesterGathering

Member Data Documentation

CHarvesterBlacklist * iBlacklist

CHarvesterBlacklist *iBlacklist[protected]

Pointer to blacklisting functionality

TUid iDtor_ID_Key

TUid iDtor_ID_Key[private]

CHarvesterPluginFactory * iFactory

CHarvesterPluginFactory *iFactory[protected]

TBool iFastModeEnabled

TBool iFastModeEnabled[protected]

RFs iFs

RFs iFs[protected]

Handle to File server session.

TBool iHarvesting

TBool iHarvesting[private]

CMdEPropertyDef * iOriginPropertyDef

CMdEPropertyDef *iOriginPropertyDef[private]

RPointerArray< CHarvesterData > * iQueue

RPointerArray< CHarvesterData > *iQueue[protected]

Pointer to Harvesting request queue.

THarvesterState iState

THarvesterState iState[protected]

State of this active object.

CMdEPropertyDef * iTitlePropertyDef

CMdEPropertyDef *iTitlePropertyDef[private]