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 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 )
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
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

Constructor & Destructor Documentation

CHarvesterPlugin()

IMPORT_C CHarvesterPlugin ( ) [protected]

Constuctor

~CHarvesterPlugin()

IMPORT_C ~CHarvesterPlugin ( ) [virtual]

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

Member Functions Documentation

ConstructL()

void ConstructL ( ) [protected]

Construction of the interface class

DoCancel()

IMPORT_C void DoCancel ( ) [protected, virtual]

Active object DoCancel implementation.

GetMimeType(const TDesC &, TDes &)

IMPORT_C void GetMimeType ( 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 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.

Parameters

const TDesC & aUri URI of the file/item.
TDes & aObjectType Reference to an object type which will returned to the FW from the plug-in

HarvestL(CHarvesterData *)

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

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

Parameters

CHarvesterData * aHD Pointer to harvesting data/request.

ListImplementationsL(RImplInfoPtrArray &)

IMPORT_C void ListImplementationsL ( RImplInfoPtrArray & aImplInfoArray ) [static]

Lists all available implementations which satisfy this given interface.

Parameters

RImplInfoPtrArray & aImplInfoArray Reference 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 TInt RunError ( TInt aError ) [protected, virtual]

Active object RunError implementation.

Parameters

TInt aError

RunL()

IMPORT_C void RunL ( ) [protected, virtual]

Active object RunL implementation.

SetBlacklist(CHarvesterBlacklist &)

IMPORT_C void SetBlacklist ( CHarvesterBlacklist & aBlacklist ) [virtual]

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

Parameters

CHarvesterBlacklist & aBlacklist Reference to blacklisting component.

SetDefaultPropertiesL(CHarvesterData &)

void SetDefaultPropertiesL ( CHarvesterData & aData ) [private]

Method sets some default properties to the metadata object

Parameters

CHarvesterData & aData Pointer to harvesting data/request.

SetHarvesterPluginFactory(CHarvesterPluginFactory &)

IMPORT_C void SetHarvesterPluginFactory ( CHarvesterPluginFactory & aFactory )

Method for adding reference to harvester plugin factory

Parameters

CHarvesterPluginFactory & aFactory

SetNextRequest(THarvesterState)

void SetNextRequest ( THarvesterState aState ) [private]

Sets next state for the active object

Parameters

THarvesterState aState Next state to execute with RunL.

SetQueue(RPointerArray< CHarvesterData > &)

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

Method sets the Harvesting queue to the plug-in.

Parameters

RPointerArray < CHarvesterData > & aQueue Queue which contains harvesting requests.

StartHarvest()

IMPORT_C void StartHarvest ( ) [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]