epoc32/include/mmsvstoremanager.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mmsvstoremanager.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,254 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __MMSVSTOREMANAGER_H__
    1.20 +#define __MMSVSTOREMANAGER_H__
    1.21 +
    1.22 +#include <msvstd.h>
    1.23 +
    1.24 +/**
    1.25 +Provides the File Access mechanism to the files that are stored in the message server's 
    1.26 +data cage in a secure manner. Presents a common interface to message store file access 
    1.27 +regardless of the process that its running in.
    1.28 +For instance, when the File Access APIs are used on the client-side process, the implementation 
    1.29 +uses secure IPC calls to the message server that includes capability policing, however, 
    1.30 +when the same API is used on the server-side, the implementation has direct access to 
    1.31 +the file in the message store.
    1.32 +
    1.33 +@internalTechnology
    1.34 +*/
    1.35 +class MMsvStoreManager
    1.36 +{
    1.37 +public:
    1.38 +	/**
    1.39 +	Allows clients to create a new empty file and allows clients to stream data to it.
    1.40 +	
    1.41 +	Creates a new attachment file in the message store for the message entry specified by the aEntryId 
    1.42 +	parameter. The attachment filename is set to the filename indicated by the aFilename parameter. 
    1.43 +	The empty attachment file is passed back to the client using an opened file handle to the file in the message store.
    1.44 +	
    1.45 +	@param aEntryId The entry for which an attachment needs to be created in the message store
    1.46 +	@param aFilename The name of the attachment file to be created
    1.47 +	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
    1.48 +	@leave KErrAlreadyexists, if the file with the same name already existed the directory.	
    1.49 +	*/
    1.50 +	virtual TBool CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile)=0;
    1.51 +
    1.52 +	/**
    1.53 +	Allows clients to replace an existing attachment file and allows clients to stream data to it.
    1.54 +	
    1.55 +	Replaces an existing attachment file in the message store for the message entry specified by the aEntryId 
    1.56 +	parameter. The attachment filename is set to the filename indicated by the aFilename parameter. 
    1.57 +	If an attachment with the supplied name does not exist, a new file is created. The empty attachment
    1.58 +	file is passed back to the client using an opened file handle to the file in the message store.
    1.59 +	
    1.60 +	@param aEntryId The entry for which an attachment needs to be created in the message store
    1.61 +	@param aFilename The name of the attachment file to be created
    1.62 +	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
    1.63 +	*/
    1.64 +	virtual void ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile)=0;
    1.65 +	
    1.66 +	/**
    1.67 +	Allows clients to view attachment files.
    1.68 +
    1.69 +	Opens an existing attachment file in the message associated with the message
    1.70 +	entry specified by the aEntryId parameter. The attachment is identified by 
    1.71 +	the file path specified by the aFilePath parameter. The attachment file is 
    1.72 +	returned as a read-only file handle to the file in the message store. 
    1.73 +	
    1.74 +	@param aEntryId The entry whose attachment needs to be opened/read from the message store
    1.75 +	@param aFilePath The name and path of the attachment file to be opened
    1.76 +	@param aFile On return, The opened file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
    1.77 +	*/
    1.78 +	virtual void OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)=0;
    1.79 +	
    1.80 +	/**
    1.81 +	Allows clients to open an attachment file for writing.
    1.82 +
    1.83 +	Opens an existing attachment file in the message associated with the message
    1.84 +	entry specified by the aEntryId parameter. The attachment is identified by 
    1.85 +	the file path specified by the aFilePath parameter. The attachment file is
    1.86 +	returned as a read/write file handle to the file in the message store. 
    1.87 +	
    1.88 +	@param aEntryId The entry whose attachment needs to be opened/read from the message store
    1.89 +	@param aFilePath The name and path of the attachment file to be opened
    1.90 +	@param aFile On return, The opened file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
    1.91 +	*/
    1.92 +	virtual void OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)=0;
    1.93 +	
    1.94 +	
    1.95 +	/**
    1.96 +	Allow clients to delete existing attachment files.
    1.97 +
    1.98 +	Deletes an existing attachment file in the message store associated with the
    1.99 +	message entry specified by the aEntryId parameter. The attachment is 
   1.100 +	identified by the file path specified by the aFilePath parameter. 
   1.101 +	
   1.102 +	@param aEntryId The entry whose attachment needs to be deleted from the message store
   1.103 +	@param aFilePath The name and path of the attachment file to be deleted
   1.104 +	@return KErrNone if successful, otherwise any of the system wide error codes.
   1.105 +	*/
   1.106 +	virtual TInt DeleteAttachment(TMsvId aEntryId, const TDesC& aFilePath)=0;
   1.107 +	
   1.108 +	/**
   1.109 +	Renames an existing attachment file.
   1.110 +	
   1.111 +	Renames an existing attachment file in the message store associated with the
   1.112 +	message entry specified by the aEntryId parameter. The attachment is 
   1.113 +	identified by the file path specified by the aOldFilePath parameter and renamed to
   1.114 +	the name supplied in the aNewName paramter.
   1.115 +	
   1.116 +	@param aEntryId The entry whose attachment needs to be renamed from the message store
   1.117 +	@param aOldFilePath The name and path of the attachment file to be renamed.
   1.118 +	@param aNewName The new name of the attachment file.
   1.119 +	@return KErrNone if successful, otherwise any of the system wide error codes.
   1.120 +	*/
   1.121 +	virtual TInt RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName) = 0;
   1.122 +	
   1.123 +	/**
   1.124 +	Check if an attachment file with the given path and name already exists.
   1.125 +
   1.126 +    @param aFilePath The full path specification of the file.
   1.127 +	@return ETrue if file exists, otherwise EFalse.
   1.128 +	*/
   1.129 +	virtual TBool FileExistsL(const TDesC& aFilePath)=0;
   1.130 +	
   1.131 +	/**
   1.132 +	Queries the message server for the file path where attachments are stored for the
   1.133 +	a particular message entry.
   1.134 +	
   1.135 +	@param aEntryId The message entry for which the attachment path is required.
   1.136 +	@param aFilePath On return, this will be set to the file path where the attachment should be stored.
   1.137 +	*/
   1.138 +	virtual void AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath) = 0;
   1.139 +	
   1.140 +	// To support CMsvStore to provide message store file management.
   1.141 +	/**
   1.142 +	Allows the message store classes to read the store file for a particular message entry.
   1.143 +
   1.144 +	Opens a message store file associated with the message entry specified by the aEntryId parameter. 
   1.145 +	This method returns an open read-only file handle to the message store file. 
   1.146 +	
   1.147 +	@param aEntryId The entry whose store needs to be opened/read 
   1.148 +	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
   1.149 +	@leave KErrNotFound if file is not found else any of the system wide errors
   1.150 +	*/
   1.151 +	virtual TInt OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile)=0;
   1.152 +	
   1.153 +	/**
   1.154 +	Opens a temporary store file associated with the message entry specified by the aEntryId parameter. 
   1.155 +	This method returns an open read-write file handle with an exclusive share to the temporary store file. 
   1.156 +	The temporary store file is defined as \<store_filename\>.new. Data can be streamed to the temporary store file. 
   1.157 +	It is expected that once the temporary store file has been written to and then closed, a call to 
   1.158 +	ReplaceFileStoreL is required to replace the old store file with this temporary one. 
   1.159 +	
   1.160 +	Along with ReplaceFileStoreL, this method allows the message store classes to write data 
   1.161 +	to the store file for a particular message entry.
   1.162 +	
   1.163 +	@param aEntryId The entry whose store needs to be opened/read 
   1.164 +	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
   1.165 +	*/
   1.166 +	virtual void OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile)=0;
   1.167 +
   1.168 +	/**
   1.169 +	Replaces the current store file with the temporary store file, created from OpenTempStoreFileL,
   1.170 +	for the message entry as specified by the aEntryId parameter. The method replaces the store file with 
   1.171 +	the temporary file (<store_filename.new>) and if successful, will then delete the temporary store file.
   1.172 +	This method assumes that the temporary file exists, otherwise a KErrNotFound error occurs. 
   1.173 +	
   1.174 +	Along with OpenTempStoreFileL, this method allows the message store classes to write data to the store 
   1.175 +	file for a particular message entry.
   1.176 +	
   1.177 +	@param aEntryId The entry whose store needs to be replaced/overwritten 
   1.178 +	*/
   1.179 +	virtual void ReplaceFileStoreL(TMsvId aEntryId)=0;
   1.180 +
   1.181 +	/**
   1.182 +	Deletes the store file associated with the message entry as specified by the aEntryId. 
   1.183 +	Also attempts to delete the temporary store file if one exists.
   1.184 +	
   1.185 +	@param aEntryId The entry whose store needs to be deleted
   1.186 +	*/
   1.187 +	virtual void DeleteFileStoreL(TMsvId aEntryId)=0;
   1.188 +
   1.189 +	/**
   1.190 +	Queries the message server to check if a store file exists for the message entry specified by
   1.191 +	the aEntryId parameter. 
   1.192 +	
   1.193 +	@param aEntryId The entry for whom the check for existance of store is being done
   1.194 +	@return ETrue if the store exists else EFalse 
   1.195 +	*/
   1.196 +	virtual TBool FileStoreExistsL(TMsvId aEntryId) const=0;
   1.197 +	
   1.198 +	/**
   1.199 +	Creates an Attachment using a ShareProtected RFs.Used in the case when a message contains a DRM attachment
   1.200 +
   1.201 +	@param aEntryId The entry for which an attachment needs to be created in the message store
   1.202 +	@param aFilename The name of the attachment file to be created
   1.203 +	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
   1.204 +	@leave KErrAlreadyexists, if the file with the same name already existed the directory.
   1.205 +	*/
   1.206 +	virtual TBool CreateShareProtectedAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile) = 0;	
   1.207 +	
   1.208 +	/**
   1.209 +	Gets the path of the bodytext file related to a message in the message store for the message id passed to it.
   1.210 +	@param aBodyTextId The Id of the bodytext for which the path is required in the message store
   1.211 +	@param aFilename On return, The path of the file corresponding to the message Id passed.
   1.212 +	@leave KErrAlreadyexists, if the file with the same name already existed the directory.
   1.213 +	*/
   1.214 +	virtual void BodyTextFilePathL(TMsvId aMessageId, TDes& aFilepath) = 0;
   1.215 +	
   1.216 +	/**
   1.217 +	Allows the message store classes to read the store file for a particular message entry.
   1.218 +
   1.219 +	Opens a message store file associated with the message entry specified by the aFilepath parameter. 
   1.220 +	This method returns an open read-only file handle to the message store file. 
   1.221 +	
   1.222 +	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
   1.223 +	@param aBodyTextId The Id of the bodytext.
   1.224 +	@param aFilepath The path of the file that needs to be opened/read
   1.225 +	@leave KErrNotFound if file is not found else any of the system wide errors
   1.226 +	*/
   1.227 +	virtual void OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath) = 0;
   1.228 +	
   1.229 +	/**
   1.230 +	Allows the message store classes to create the store file for a particular message entry.
   1.231 +
   1.232 +	Creates a message store file associated with the message entry specified by the aFilepath parameter. 
   1.233 +	This method returns an open read-write file handle to the message store file. 
   1.234 +	
   1.235 +	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
   1.236 +	@param aBodyTextId The Id of the bodytext.
   1.237 +	@leave one of the other system-wide error codes.
   1.238 +	*/
   1.239 +	virtual void CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId) = 0;
   1.240 +	
   1.241 +	/**
   1.242 +	Deletes the store file associated with the message entry as specified by aFilepath. 
   1.243 +		
   1.244 +	@param aBodyTextId The Id of the bodytext.
   1.245 +	@leave KErrNotFound if file is not found else any of the system wide errors
   1.246 +	*/
   1.247 +	virtual void DeletePlainTextFileL(TMsvId aBodyTextId) = 0;
   1.248 +	
   1.249 +	/**
   1.250 +	Replaces the bodytext file associated with the message specified by aEntryId. 
   1.251 +	@param aBodyTextId The Id of the bodytext.
   1.252 +	@leave KErrNotFound if file is not found else any of the system wide errors
   1.253 +	*/
   1.254 +	virtual void ReplacePlainTextFileL(TMsvId aBodyTextId) = 0;
   1.255 +	};
   1.256 +
   1.257 +#endif // __MMSVSTOREMANAGER_H__