epoc32/include/mmsvstoremanager.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// 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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __MMSVSTOREMANAGER_H__
williamr@2
    17
#define __MMSVSTOREMANAGER_H__
williamr@2
    18
williamr@2
    19
#include <msvstd.h>
williamr@2
    20
williamr@2
    21
/**
williamr@2
    22
Provides the File Access mechanism to the files that are stored in the message server's 
williamr@2
    23
data cage in a secure manner. Presents a common interface to message store file access 
williamr@2
    24
regardless of the process that its running in.
williamr@2
    25
For instance, when the File Access APIs are used on the client-side process, the implementation 
williamr@2
    26
uses secure IPC calls to the message server that includes capability policing, however, 
williamr@2
    27
when the same API is used on the server-side, the implementation has direct access to 
williamr@2
    28
the file in the message store.
williamr@2
    29
williamr@2
    30
@internalTechnology
williamr@2
    31
*/
williamr@2
    32
class MMsvStoreManager
williamr@2
    33
{
williamr@2
    34
public:
williamr@2
    35
	/**
williamr@2
    36
	Allows clients to create a new empty file and allows clients to stream data to it.
williamr@2
    37
	
williamr@2
    38
	Creates a new attachment file in the message store for the message entry specified by the aEntryId 
williamr@2
    39
	parameter. The attachment filename is set to the filename indicated by the aFilename parameter. 
williamr@2
    40
	The empty attachment file is passed back to the client using an opened file handle to the file in the message store.
williamr@2
    41
	
williamr@2
    42
	@param aEntryId The entry for which an attachment needs to be created in the message store
williamr@2
    43
	@param aFilename The name of the attachment file to be created
williamr@2
    44
	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
williamr@2
    45
	@leave KErrAlreadyexists, if the file with the same name already existed the directory.	
williamr@2
    46
	*/
williamr@2
    47
	virtual TBool CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile)=0;
williamr@2
    48
williamr@2
    49
	/**
williamr@2
    50
	Allows clients to replace an existing attachment file and allows clients to stream data to it.
williamr@2
    51
	
williamr@2
    52
	Replaces an existing attachment file in the message store for the message entry specified by the aEntryId 
williamr@2
    53
	parameter. The attachment filename is set to the filename indicated by the aFilename parameter. 
williamr@2
    54
	If an attachment with the supplied name does not exist, a new file is created. The empty attachment
williamr@2
    55
	file is passed back to the client using an opened file handle to the file in the message store.
williamr@2
    56
	
williamr@2
    57
	@param aEntryId The entry for which an attachment needs to be created in the message store
williamr@2
    58
	@param aFilename The name of the attachment file to be created
williamr@2
    59
	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
williamr@2
    60
	*/
williamr@2
    61
	virtual void ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile)=0;
williamr@2
    62
	
williamr@2
    63
	/**
williamr@2
    64
	Allows clients to view attachment files.
williamr@2
    65
williamr@2
    66
	Opens an existing attachment file in the message associated with the message
williamr@2
    67
	entry specified by the aEntryId parameter. The attachment is identified by 
williamr@2
    68
	the file path specified by the aFilePath parameter. The attachment file is 
williamr@2
    69
	returned as a read-only file handle to the file in the message store. 
williamr@2
    70
	
williamr@2
    71
	@param aEntryId The entry whose attachment needs to be opened/read from the message store
williamr@2
    72
	@param aFilePath The name and path of the attachment file to be opened
williamr@2
    73
	@param aFile On return, The opened file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
williamr@2
    74
	*/
williamr@2
    75
	virtual void OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)=0;
williamr@2
    76
	
williamr@2
    77
	/**
williamr@2
    78
	Allows clients to open an attachment file for writing.
williamr@2
    79
williamr@2
    80
	Opens an existing attachment file in the message associated with the message
williamr@2
    81
	entry specified by the aEntryId parameter. The attachment is identified by 
williamr@2
    82
	the file path specified by the aFilePath parameter. The attachment file is
williamr@2
    83
	returned as a read/write file handle to the file in the message store. 
williamr@2
    84
	
williamr@2
    85
	@param aEntryId The entry whose attachment needs to be opened/read from the message store
williamr@2
    86
	@param aFilePath The name and path of the attachment file to be opened
williamr@2
    87
	@param aFile On return, The opened file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
williamr@2
    88
	*/
williamr@2
    89
	virtual void OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)=0;
williamr@2
    90
	
williamr@2
    91
	
williamr@2
    92
	/**
williamr@2
    93
	Allow clients to delete existing attachment files.
williamr@2
    94
williamr@2
    95
	Deletes an existing attachment file in the message store associated with the
williamr@2
    96
	message entry specified by the aEntryId parameter. The attachment is 
williamr@2
    97
	identified by the file path specified by the aFilePath parameter. 
williamr@2
    98
	
williamr@2
    99
	@param aEntryId The entry whose attachment needs to be deleted from the message store
williamr@2
   100
	@param aFilePath The name and path of the attachment file to be deleted
williamr@2
   101
	@return KErrNone if successful, otherwise any of the system wide error codes.
williamr@2
   102
	*/
williamr@2
   103
	virtual TInt DeleteAttachment(TMsvId aEntryId, const TDesC& aFilePath)=0;
williamr@2
   104
	
williamr@2
   105
	/**
williamr@2
   106
	Renames an existing attachment file.
williamr@2
   107
	
williamr@2
   108
	Renames an existing attachment file in the message store associated with the
williamr@2
   109
	message entry specified by the aEntryId parameter. The attachment is 
williamr@2
   110
	identified by the file path specified by the aOldFilePath parameter and renamed to
williamr@2
   111
	the name supplied in the aNewName paramter.
williamr@2
   112
	
williamr@2
   113
	@param aEntryId The entry whose attachment needs to be renamed from the message store
williamr@2
   114
	@param aOldFilePath The name and path of the attachment file to be renamed.
williamr@2
   115
	@param aNewName The new name of the attachment file.
williamr@2
   116
	@return KErrNone if successful, otherwise any of the system wide error codes.
williamr@2
   117
	*/
williamr@2
   118
	virtual TInt RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName) = 0;
williamr@2
   119
	
williamr@2
   120
	/**
williamr@2
   121
	Check if an attachment file with the given path and name already exists.
williamr@2
   122
williamr@2
   123
    @param aFilePath The full path specification of the file.
williamr@2
   124
	@return ETrue if file exists, otherwise EFalse.
williamr@2
   125
	*/
williamr@2
   126
	virtual TBool FileExistsL(const TDesC& aFilePath)=0;
williamr@2
   127
	
williamr@2
   128
	/**
williamr@2
   129
	Queries the message server for the file path where attachments are stored for the
williamr@2
   130
	a particular message entry.
williamr@2
   131
	
williamr@2
   132
	@param aEntryId The message entry for which the attachment path is required.
williamr@2
   133
	@param aFilePath On return, this will be set to the file path where the attachment should be stored.
williamr@2
   134
	*/
williamr@2
   135
	virtual void AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath) = 0;
williamr@2
   136
	
williamr@2
   137
	// To support CMsvStore to provide message store file management.
williamr@2
   138
	/**
williamr@2
   139
	Allows the message store classes to read the store file for a particular message entry.
williamr@2
   140
williamr@2
   141
	Opens a message store file associated with the message entry specified by the aEntryId parameter. 
williamr@2
   142
	This method returns an open read-only file handle to the message store file. 
williamr@2
   143
	
williamr@2
   144
	@param aEntryId The entry whose store needs to be opened/read 
williamr@2
   145
	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
williamr@2
   146
	@leave KErrNotFound if file is not found else any of the system wide errors
williamr@2
   147
	*/
williamr@2
   148
	virtual TInt OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile)=0;
williamr@2
   149
	
williamr@2
   150
	/**
williamr@2
   151
	Opens a temporary store file associated with the message entry specified by the aEntryId parameter. 
williamr@2
   152
	This method returns an open read-write file handle with an exclusive share to the temporary store file. 
williamr@2
   153
	The temporary store file is defined as \<store_filename\>.new. Data can be streamed to the temporary store file. 
williamr@2
   154
	It is expected that once the temporary store file has been written to and then closed, a call to 
williamr@2
   155
	ReplaceFileStoreL is required to replace the old store file with this temporary one. 
williamr@2
   156
	
williamr@2
   157
	Along with ReplaceFileStoreL, this method allows the message store classes to write data 
williamr@2
   158
	to the store file for a particular message entry.
williamr@2
   159
	
williamr@2
   160
	@param aEntryId The entry whose store needs to be opened/read 
williamr@2
   161
	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
williamr@2
   162
	*/
williamr@2
   163
	virtual void OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile)=0;
williamr@2
   164
williamr@2
   165
	/**
williamr@2
   166
	Replaces the current store file with the temporary store file, created from OpenTempStoreFileL,
williamr@2
   167
	for the message entry as specified by the aEntryId parameter. The method replaces the store file with 
williamr@2
   168
	the temporary file (<store_filename.new>) and if successful, will then delete the temporary store file.
williamr@2
   169
	This method assumes that the temporary file exists, otherwise a KErrNotFound error occurs. 
williamr@2
   170
	
williamr@2
   171
	Along with OpenTempStoreFileL, this method allows the message store classes to write data to the store 
williamr@2
   172
	file for a particular message entry.
williamr@2
   173
	
williamr@2
   174
	@param aEntryId The entry whose store needs to be replaced/overwritten 
williamr@2
   175
	*/
williamr@2
   176
	virtual void ReplaceFileStoreL(TMsvId aEntryId)=0;
williamr@2
   177
williamr@2
   178
	/**
williamr@2
   179
	Deletes the store file associated with the message entry as specified by the aEntryId. 
williamr@2
   180
	Also attempts to delete the temporary store file if one exists.
williamr@2
   181
	
williamr@2
   182
	@param aEntryId The entry whose store needs to be deleted
williamr@2
   183
	*/
williamr@2
   184
	virtual void DeleteFileStoreL(TMsvId aEntryId)=0;
williamr@2
   185
williamr@2
   186
	/**
williamr@2
   187
	Queries the message server to check if a store file exists for the message entry specified by
williamr@2
   188
	the aEntryId parameter. 
williamr@2
   189
	
williamr@2
   190
	@param aEntryId The entry for whom the check for existance of store is being done
williamr@2
   191
	@return ETrue if the store exists else EFalse 
williamr@2
   192
	*/
williamr@2
   193
	virtual TBool FileStoreExistsL(TMsvId aEntryId) const=0;
williamr@2
   194
	
williamr@2
   195
	/**
williamr@2
   196
	Creates an Attachment using a ShareProtected RFs.Used in the case when a message contains a DRM attachment
williamr@2
   197
williamr@2
   198
	@param aEntryId The entry for which an attachment needs to be created in the message store
williamr@2
   199
	@param aFilename The name of the attachment file to be created
williamr@2
   200
	@param aFile On return, The created file handle for the attachment file.The ownership is transferred . The caller must close the file handle.
williamr@2
   201
	@leave KErrAlreadyexists, if the file with the same name already existed the directory.
williamr@2
   202
	*/
williamr@2
   203
	virtual TBool CreateShareProtectedAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile) = 0;	
williamr@2
   204
	
williamr@2
   205
	/**
williamr@2
   206
	Gets the path of the bodytext file related to a message in the message store for the message id passed to it.
williamr@2
   207
	@param aBodyTextId The Id of the bodytext for which the path is required in the message store
williamr@2
   208
	@param aFilename On return, The path of the file corresponding to the message Id passed.
williamr@2
   209
	@leave KErrAlreadyexists, if the file with the same name already existed the directory.
williamr@2
   210
	*/
williamr@2
   211
	virtual void BodyTextFilePathL(TMsvId aMessageId, TDes& aFilepath) = 0;
williamr@2
   212
	
williamr@2
   213
	/**
williamr@2
   214
	Allows the message store classes to read the store file for a particular message entry.
williamr@2
   215
williamr@2
   216
	Opens a message store file associated with the message entry specified by the aFilepath parameter. 
williamr@2
   217
	This method returns an open read-only file handle to the message store file. 
williamr@2
   218
	
williamr@2
   219
	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
williamr@2
   220
	@param aBodyTextId The Id of the bodytext.
williamr@2
   221
	@param aFilepath The path of the file that needs to be opened/read
williamr@2
   222
	@leave KErrNotFound if file is not found else any of the system wide errors
williamr@2
   223
	*/
williamr@2
   224
	virtual void OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath) = 0;
williamr@2
   225
	
williamr@2
   226
	/**
williamr@2
   227
	Allows the message store classes to create the store file for a particular message entry.
williamr@2
   228
williamr@2
   229
	Creates a message store file associated with the message entry specified by the aFilepath parameter. 
williamr@2
   230
	This method returns an open read-write file handle to the message store file. 
williamr@2
   231
	
williamr@2
   232
	@param aFile On return, The opened file hanlde to the store . The ownership is transferred . The caller must close the file handle.
williamr@2
   233
	@param aBodyTextId The Id of the bodytext.
williamr@2
   234
	@leave one of the other system-wide error codes.
williamr@2
   235
	*/
williamr@2
   236
	virtual void CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId) = 0;
williamr@2
   237
	
williamr@2
   238
	/**
williamr@2
   239
	Deletes the store file associated with the message entry as specified by aFilepath. 
williamr@2
   240
		
williamr@2
   241
	@param aBodyTextId The Id of the bodytext.
williamr@2
   242
	@leave KErrNotFound if file is not found else any of the system wide errors
williamr@2
   243
	*/
williamr@2
   244
	virtual void DeletePlainTextFileL(TMsvId aBodyTextId) = 0;
williamr@2
   245
	
williamr@2
   246
	/**
williamr@2
   247
	Replaces the bodytext file associated with the message specified by aEntryId. 
williamr@2
   248
	@param aBodyTextId The Id of the bodytext.
williamr@2
   249
	@leave KErrNotFound if file is not found else any of the system wide errors
williamr@2
   250
	*/
williamr@2
   251
	virtual void ReplacePlainTextFileL(TMsvId aBodyTextId) = 0;
williamr@2
   252
	};
williamr@2
   253
williamr@2
   254
#endif // __MMSVSTOREMANAGER_H__