ContentAccess::CAgentImportFile Class Reference

class ContentAccess::CAgentImportFile : public CBase

Defines the interface for importing files into a Content access agent.

The agent should treat the import as a transaction and either import the entire file or revert to the state before the import if the import is cancelled.

The client cancels an import by deleting the CAgentImportFile object before WriteDataComplete() is called.

Inherits from

  • ContentAccess::CAgentImportFile

Member Functions Documentation

Cancel()

IMPORT_C void Cancel ( ) [virtual]

Cancel an outstanding asynchronous WriteData() request.

ContentMimeTypeL(TDes8 &)

IMPORT_C TBool ContentMimeTypeL ( TDes8 & aContentMime ) [virtual]

Retrieve the content MIME type based on available data

This function should only be called when the agent has returned KErrCANewFileHandleRequired from WriteData() If the agent cannot return a content MIME type, the importer should assume that no content type will be available until after the import session has been finished

Parameters

TDes8 & aContentMime On return this will contain the appropriate content MIME type.

ContinueWithNewOutputFile(RFile &, const TDesC &)

TInt ContinueWithNewOutputFile ( RFile & aFile,
const TDesC & aFileName
) [pure virtual]

Continue the last write operation with a new file handle as requested by the agent

Parameters

RFile & aFile A new file handle opened with write permission.
const TDesC & aFileName The name of the file handle that has been supplied. This is used by the agent when creating CSupplierOutputFile objects. It should include the full path and filename in order to be consistent with files generated by the agent.

ContinueWithNewOutputFile(RFile &, const TDesC &, TRequestStatus &)

void ContinueWithNewOutputFile ( RFile & aFile,
const TDesC & aFileName,
TRequestStatus & aStatus
) [pure virtual]

Continue the last write operation with a new file handle and return the result asynchronously.

Parameters

RFile & aFile A new file handle opened with write permission
const TDesC & aFileName The name of the file handle that has been supplied. This is used by the agent when creating CSupplierOutputFile objects. It should include the full path and filename in order to be consistent with files generated by the agent
TRequestStatus & aStatus Asynchronous request status. On completion this will contain one of the following error codes: KErrNone if the WriteData() or WriteDataComplete() operation is now complete. KErrCANewFileHandleRequired if the agent requires a new file handle before proceeding - the agent must save its state and continue processing when the new handle is supplied by ContinueWithNewOutputFile(). Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

GetImportStatus()

TImportStatus GetImportStatus ( ) const [pure virtual]

Retrieve the import status

Used to indicate non fatal problems encountered during the import operation. Provides feedback to the client in case any problems are encountered.

The client can then decide whether or not to continue the import.

GetSuggestedOutputFileExtension(TDes &)

TInt GetSuggestedOutputFileExtension ( TDes & aFileExtension ) [pure virtual]

Get the agents suggestion for the file extension of the output file required by the agent

This function should only be called when the agent has returned KErrCANewFileHandleRequired from WriteData() or WriteDataComplete() .

The extension must include the dot '.' character.

Parameters

TDes & aFileExtension On completion this will contain the appropriate file extension.

GetSuggestedOutputFileName(TDes &)

TInt GetSuggestedOutputFileName ( TDes & aFileName ) [pure virtual]

Get the agents suggestion for the file name (with extension) of the output file required by the agent

This function should only be called when the agent has returned KErrCANewFileHandleRequired from WriteData() or WriteDataComplete() .

The file name is of the form filename.extension.

Parameters

TDes & aFileName On completion this will contain the appropriate filename.

OutputFileCountL()

TInt OutputFileCountL ( ) const [pure virtual]

Gets the number of output files produced so far.

OutputFileL(TInt)

CSupplierOutputFile & OutputFileL ( TInt aIndex ) [pure virtual]

Return information about an output file generated by the import operation.

It is possible that the output file does not have the same name as the one suggested at the beginning of the import. An agent may need to use a particular file extension or a particular name.

The agent may decide not to store the output file in the output directory suggested at the start of the import. eg. it may store the file in its private server directory.

The output files may only appear in this array after the WriteDataComplete() function has been called.

Parameters

TInt aIndex The zero-based index of the file (must be less than the value returned by OutputFileCountL().

WriteData(const TDesC8 &)

TInt WriteData ( const TDesC8 & aData ) [pure virtual]

Writes a block of data from a file to the agent

Parameters

const TDesC8 & aData The block of data.

WriteData(const TDesC8 &, TRequestStatus &)

void WriteData ( const TDesC8 & aData,
TRequestStatus & aStatus
) [pure virtual]

Asynchronously writes a block of data from a file the agent

Notifies the client when the write operation is complete.

Parameters

const TDesC8 & aData The block of data.
TRequestStatus & aStatus Asynchronous request status. On completion this will contain one of the following error codes: KErrNone if the data was written successfully. KErrCANewFileHandleRequired if the agent requires a new file handle before proceeding - the agent must save its state and continue processing when the new handle is supplied by ContinueWithNewOutputFile(). KErrNotReady if the agent was not expecting WriteDataComplete() to be called at this point. Otherwise one of the other CAF error codes defined in caferr.h or one of the other standard system-wide error codes for any other errors.

WriteDataComplete()

TInt WriteDataComplete ( ) [pure virtual]

Signals to the agent that the entire file has now been transferred to the agent.

WriteDataComplete(TRequestStatus &)

void WriteDataComplete ( TRequestStatus & aStatus ) [pure virtual]

Signals to the agent that the entire file has now been transferred to the agent

Notifies the client when any final processing operation is complete.

Parameters

TRequestStatus & aStatus Asynchronous request status. On completion this will contain one of the following error codes: KErrNone if the data was written successfully. KErrCANewFileHandleRequired if the agent requires a new file handle before proceeding - the agent must save its state and continue processing when the new handle is supplied by ContinueWithNewOutputFile(). KErrNotReady if the agent was not expecting WriteDataComplete() to be called at this point. Otherwise one of the other CAF error codes defined in caferr.h or one of the other standard system-wide error codes for any other errors.