ContentAccess::CAgentResolver Class Reference

class ContentAccess::CAgentResolver : public CActive

Used to identify the Content Access Agent who handles a particular file.

CAgentResolver builds an array of CAgentInfo objects. Each CAgentInfo object holds metadata related to a particular agent implementation.

This class resolves:
  • Content to the Agent which manages it

  • Supplier mime-types to the agent which imports files with that mime type.

Inherits from

Public Member Functions
~CAgentResolver ()
CAgentInfo & AgentInfo ( TInt )
TInt AgentInfoCount ()
CAgentInfo & AgentInfoL (const TUid &)
CAgentInfo & AgentInfoL (const TDesC &)
IMPORT_C const RArray < TPtrC8 > & ConsumerMimeTypes ()
HBufC * ConvertAgentFileNameL (const TDesC &)
TUid DefaultAgentUid ()
IMPORT_C TBool DoRecognizeL (const TDesC &, const TDesC8 &, TDes8 &, TDes8 &)
IMPORT_C CAgentResolver * NewL (const TBool )
IMPORT_C CAgentResolver * NewLC (const TBool )
IMPORT_C TInt PreferredBufferSize ()
CAgentInfo & ResolveConsumerMime (const TDesC8 &)
TUid ResolveDirectory (const TDesC &, TDes &, TBool &)
CAgentInfo & ResolveFileL ( RFile &)
CAgentInfo & ResolveFileL (const TDesC &, TDes &, TContentShareMode )
CAgentInfo & ResolveSupplierMimeL (const TDesC8 &)
IMPORT_C const RArray < TPtrC8 > & SupplierMimeTypes ()
Private Member Functions
CAgentResolver (const TBool )
void AddAgentL (const CImplementationInformation &)
void BuildListOfAgentsL ()
void CleanImplArray ( TAny *)
void ConstructL ()
void DestroyListOfAgents ()
void DoCancel ()
TBool IsF32Agent ( CAgentInfo &)
void RunL ()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::RunError(TInt)
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()
Inherited Enumerations
CActive:TPriority
Private Attributes
RPointerArray < CAgentInfo > iAgentInfos
RArray < TPtrC8 > iConsumerMimeTypes
CAgentInfo * iDefaultAgent
const TBool iDynamicAgentUpdate
REComSession * iEcomSession
RArray < TPtrC8 > iSupplierMimeTypes
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CAgentResolver(const TBool)

CAgentResolver ( const TBool aDynamicAgentUpdate ) [private]

Parameters

const TBool aDynamicAgentUpdate

~CAgentResolver()

~CAgentResolver ( ) [virtual]

Member Functions Documentation

AddAgentL(const CImplementationInformation &)

void AddAgentL ( const CImplementationInformation & aImplInfo ) [private]

Add an agent to the list of agents

Parameters

const CImplementationInformation & aImplInfo

AgentInfo(TInt)

CAgentInfo & AgentInfo ( TInt aIndex ) const

Reference an agent in the iAgentInfos array by index

Parameters

TInt aIndex

AgentInfoCount()

TInt AgentInfoCount ( ) const

The number of agents, excluding the F32Agent

AgentInfoL(const TUid &)

CAgentInfo & AgentInfoL ( const TUid & aUid ) const

Find an agent by it's Uid

Parameters

const TUid & aUid

AgentInfoL(const TDesC &)

CAgentInfo & AgentInfoL ( const TDesC & aAgentName ) const

Find an agent by it's name

Parameters

const TDesC & aAgentName

BuildListOfAgentsL()

void BuildListOfAgentsL ( ) [private]

Builds a list of all the Content Access Agents.

CleanImplArray(TAny *)

void CleanImplArray ( TAny * aArray ) [private, static]

Parameters

TAny * aArray

ConstructL()

void ConstructL ( ) [private]

Second phase constructor for CAgentResolver

ConsumerMimeTypes()

IMPORT_C const RArray < TPtrC8 > & ConsumerMimeTypes ( ) const

Accessor for the ConsumerMimeTypes array.

Note:

Planning to remove this from the CAF API

ConvertAgentFileNameL(const TDesC &)

HBufC * ConvertAgentFileNameL ( const TDesC & aFileName ) const

Converts a filename containing the agent SID to the filename containing the agent name.

Parameters

const TDesC & aFileName The filename in the form "c:\\private\\12345678\\"

DefaultAgentUid()

TUid DefaultAgentUid ( ) const

The default F32 agent

DestroyListOfAgents()

void DestroyListOfAgents ( ) [private]

Resets the list.

DoCancel()

void DoCancel ( ) [private, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel() .

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel() .

CActive::Cancel

DoRecognizeL(const TDesC &, const TDesC8 &, TDes8 &, TDes8 &)

IMPORT_C TBool DoRecognizeL ( const TDesC & aName,
const TDesC8 & aBuffer,
TDes8 & aFileMimeType,
TDes8 & aContentMimeType
)

Determines the MIME types of the a file and the mime type of its contents.

This function should only be used by the CAF recogizer DLL.

Parameters

const TDesC & aName The file name/URI to be investigated.
const TDesC8 & aBuffer A buffer containing bytes from the start of the file.
TDes8 & aFileMimeType If the file is recognized this will be populated with the mime type of the file.
TDes8 & aContentMimeType If the file is recognized this will be populated with the mime type of the content object within the file.

IsF32Agent(CAgentInfo &)

TBool IsF32Agent ( CAgentInfo & aAgentInfo ) [private]

Is this the F32 Agent

Parameters

CAgentInfo & aAgentInfo The agentinfo representing the agent

NewL(const TBool)

IMPORT_C CAgentResolver * NewL ( const TBool aDynamicAgentUpdate ) [static]
Constructs a new CAgentResolver
leave
KErrCANoAgent If no F32 agent was found

Parameters

const TBool aDynamicAgentUpdate ETrue if the CAgentResolver should update its list of agents when new agents appear. A CActiveScheduler must already be running when ETrue is supplied

NewLC(const TBool)

IMPORT_C CAgentResolver * NewLC ( const TBool aDynamicAgentUpdate ) [static]
Constructs a new CAgentResolver and puts it on the cleanup stack
leave
KErrCANoAgent If no F32 agent was found

Parameters

const TBool aDynamicAgentUpdate ETrue if the CAgentResolver should update its list of agents when new agents appear. A CActiveScheduler must already be running when ETrue is supplied

PreferredBufferSize()

IMPORT_C TInt PreferredBufferSize ( )

Gets the preferred buffer size for recognizing files using the RecognizeFile() function.

This function should only be used by the CAF recogizer DLL.

ResolveConsumerMime(const TDesC8 &)

CAgentInfo & ResolveConsumerMime ( const TDesC8 & aMimeType ) const

Finds the agent that handles the given consumer MIME type.

Note:

Planning to remove this from the CAF API

Parameters

const TDesC8 & aMimeType MIME type of the file

ResolveDirectory(const TDesC &, TDes &, TBool &)

TUid ResolveDirectory ( const TDesC & aPath,
TDes & aActualPath,
TBool & aThePrivateDir
) const

Find the agent who owns a directory

This function also maps a path from the agent directory name to it's actual name in the file system.

ie. For example if an agent "x" has files stored in a private server directory "c:\\private\\12345678\\"

The file appear as "c:\\private\\x\\" to applications using CAF. This function converts "c:\\private\\x\\" back to "c:\\private\\12345678\\"

Parameters

const TDesC & aPath The path in the form c:\private\agent_name\...
TDes & aActualPath The path in the form c:\private\SID\...
TBool & aThePrivateDir to ETrue if the directory is just "\\private\\"

ResolveFileL(RFile &)

CAgentInfo & ResolveFileL ( RFile & aFile ) const

Finds the agent that handles a file.

Parameters

RFile & aFile Handle of the file to be resolved.

ResolveFileL(const TDesC &, TDes &, TContentShareMode)

CAgentInfo & ResolveFileL ( const TDesC & aUri,
TDes & aActualUri,
TContentShareMode aShareMode = EContentShareReadOnly
) const

Finds the agent that handles a file and returns the actual URI of the content.

If the aUri is of the form "c:\\private\\agent_name\\" it will be translated to the form "c:\\private\\SID\\" in aActualUri. Otherwise the aUri is just copied to aActualUri

Parameters

const TDesC & aUri Location of file to be resolved.
TDes & aActualUri The actual location of the file
TContentShareMode aShareMode = EContentShareReadOnly The file sharing mode to be used with this file

ResolveSupplierMimeL(const TDesC8 &)

CAgentInfo & ResolveSupplierMimeL ( const TDesC8 & aMimeType ) const

Finds the agent that handles the given supplier MIME type.

leave
KErrCANoAgent If no CA agent supports the given MIME type.

Parameters

const TDesC8 & aMimeType MIME type from the supplier application.

RunL()

void RunL ( ) [private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SupplierMimeTypes()

IMPORT_C const RArray < TPtrC8 > & SupplierMimeTypes ( ) const

Accessor for the SupplierMimeTypes array.

Member Data Documentation

RPointerArray< CAgentInfo > iAgentInfos

RPointerArray < CAgentInfo > iAgentInfos [private]

RArray< TPtrC8 > iConsumerMimeTypes

RArray < TPtrC8 > iConsumerMimeTypes [private]

CAgentInfo * iDefaultAgent

CAgentInfo * iDefaultAgent [private]

const TBool iDynamicAgentUpdate

const TBool iDynamicAgentUpdate [private]

REComSession * iEcomSession

REComSession * iEcomSession [private]

RArray< TPtrC8 > iSupplierMimeTypes

RArray < TPtrC8 > iSupplierMimeTypes [private]