|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __TMSVSERVERSTOREMANAGER_H__ |
|
17 #define __TMSVSERVERSTOREMANAGER_H__ |
|
18 |
|
19 #include <mmsvstoremanager.h> |
|
20 /** |
|
21 Provides implementation of the File Access APIs at the server-side. |
|
22 This class has direct access to the Message store, unlike the client version of it. |
|
23 This can be used by the server side classed to access the store and attachment entries. |
|
24 |
|
25 @see MMsvStoreManager , TMsvServerStoreManager implements MMsvStoreManager |
|
26 @internalComponent |
|
27 */ |
|
28 class TMsvServerStoreManager : public MMsvStoreManager |
|
29 { |
|
30 public: |
|
31 TMsvServerStoreManager(); |
|
32 void SetMsvServerAndFileSession(CMsvServer& aMsvServer,RFs& aFs); |
|
33 |
|
34 // from MMsvStoreManager |
|
35 virtual TBool CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
36 virtual void ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
37 virtual void OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile); |
|
38 virtual void OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile); |
|
39 virtual TInt DeleteAttachment(TMsvId aEntryId, const TDesC& aFilePath); |
|
40 virtual TInt RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName); |
|
41 virtual TBool FileExistsL(const TDesC& aFilePath); |
|
42 virtual void AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath); |
|
43 virtual TInt OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile); |
|
44 virtual void OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile); |
|
45 virtual void ReplaceFileStoreL(TMsvId aEntryId); |
|
46 virtual void DeleteFileStoreL(TMsvId aEntryId); |
|
47 virtual TBool FileStoreExistsL(TMsvId aEntryId) const; |
|
48 |
|
49 TBool CreateShareProtectedAttachmentForWriteL(TMsvId aEntryId, TDes& aFilename, RFile& aFile); |
|
50 |
|
51 void BodyTextFilePathL(TMsvId aBodyTextId, TDes& aFilePath); |
|
52 void OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath); |
|
53 void CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId); |
|
54 void DeletePlainTextFileL(TMsvId aBodyTextId); |
|
55 void ReplacePlainTextFileL(TMsvId aBodyTextId); |
|
56 |
|
57 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
58 //PREQ2073 |
|
59 void CreateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList); |
|
60 void LoadHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, RPointerArray<CHeaderFields>& aFieldPairList); |
|
61 void DeleteHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId); |
|
62 void UpdateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList); |
|
63 TBool DoesAnyStoreExists(TMsvId aId, TUid aMtmId); |
|
64 TBool DoesHeaderTableExist(const TUid& aMtmId); |
|
65 #endif |
|
66 |
|
67 |
|
68 private: |
|
69 TInt GetFilePath(TMsvId aEntryId,TFileName& aDirectory) const; |
|
70 void GetStoreFileName(TMsvId aEntryId, TFileName& aFileName) const; |
|
71 TBool CheckFileNameLengthAndTrimL(const TDesC& aFilePath,TDes& aFileName); |
|
72 TBool GenerateFileNameIfExistsL(TDes& aFileName); |
|
73 void GetOwningServiceAndFilePath(TMsvId aEntryId,TDes& aFilePath,TMsvId& aOwningService) const; |
|
74 TBool CreateAttachmentL(TMsvId aEntryId, TDes& aFilename, RFile& aFile, RFs& aFs,TBool aSharedAccess = EFalse); |
|
75 |
|
76 private: |
|
77 // Does not own these members. They are set to CMsvServer and RFs |
|
78 // references in the class where the TMsvServerStoreManager object is created. |
|
79 CMsvServer* iMsvServer; |
|
80 RFs* iFs; |
|
81 |
|
82 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
83 friend class CTestMsvServer; |
|
84 #endif |
|
85 }; |
|
86 |
|
87 #endif // __TMSVSERVERSTOREMANAGER_H__ |