|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CBSSERVER.H |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CBSSERVER_H__ |
|
21 #define __CBSSERVER_H__ |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "rbsobjowningptrarray.h" |
|
25 #include "mbsbackupobserver.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CBSSession; |
|
29 class CBSStorageManager; |
|
30 class CBSInstallHandler; |
|
31 class CBSBackupObserver; |
|
32 |
|
33 /** |
|
34 * Service server. |
|
35 */ |
|
36 NONSHARABLE_CLASS( CBSServer ): public CPolicyServer, |
|
37 public MBSBackupObserver |
|
38 { |
|
39 public: |
|
40 NONSHARABLE_CLASS( CBSFileMapping ): public CBase |
|
41 { |
|
42 public: |
|
43 static CBSFileMapping* NewL( CBSSession* aSession, |
|
44 const TDesC& aFile, |
|
45 TBool aVersioned ); |
|
46 |
|
47 ~CBSFileMapping(); |
|
48 private: // constructors |
|
49 void ConstructL( CBSSession* aSession, |
|
50 const TDesC& aFile ); |
|
51 CBSFileMapping( TBool aVersioned ); |
|
52 |
|
53 public: // new methods |
|
54 CBSSession* Session(); |
|
55 const TDesC& File(); |
|
56 TBool Versioned(); |
|
57 |
|
58 private: // data |
|
59 // doesn't own: session |
|
60 CBSSession* iSession; |
|
61 HBufC* iFile; |
|
62 TBool iVersioned; |
|
63 }; |
|
64 |
|
65 public: // Execution and destructors |
|
66 static void ExecuteL(); |
|
67 virtual ~CBSServer(); |
|
68 |
|
69 private: // C++ constructor |
|
70 CBSServer(); |
|
71 |
|
72 protected: // Methods from CPolicyServer |
|
73 |
|
74 CSession2* NewSessionL( const TVersion& aVersion, |
|
75 const RMessage2& aMessage ) const; |
|
76 |
|
77 |
|
78 CPolicyServer::TCustomResult CustomFailureActionL( |
|
79 const RMessage2& aMsg, |
|
80 TInt aAction, |
|
81 const TSecurityInfo& aMissing); |
|
82 |
|
83 public: // From MBSBackupObserver |
|
84 |
|
85 void HandleBackupStateL( TBackupState aState ); |
|
86 |
|
87 public: //New methods |
|
88 void SessionCreatedL( CBSSession* aSession ); |
|
89 void SessionDied( CBSSession* aSession ); |
|
90 |
|
91 TBool MatchSessionL( const TDesC& aApplicationId, |
|
92 const TDesC& aBrandId, |
|
93 TLanguage aLanguageId, |
|
94 CBSSession* aSession, |
|
95 TInt aReserved = 0 ); |
|
96 |
|
97 TBool MatchSessionUninstallL( const TDesC& aApplicationId, |
|
98 const TDesC& aBrandId, CBSSession* aSession); |
|
99 |
|
100 void RegisterFileForSessionL( CBSSession* aSession, |
|
101 const TDesC& aFile, |
|
102 TBool aVersioned ); |
|
103 |
|
104 TArray<CBSServer::CBSFileMapping*> RegisteredFiles(); |
|
105 |
|
106 TBool FileStillInUse( CBSSession* aSession, |
|
107 const TDesC& aFile ); |
|
108 |
|
109 void BrandUpdatedL( const TDesC& aApplicationId, |
|
110 const TDesC& aBrandId, |
|
111 TLanguage aLanguageId, |
|
112 CBSSession* aSession, |
|
113 TInt aReserved ); |
|
114 /** |
|
115 * Displays the info for each open session - except for the one that |
|
116 * called this method. |
|
117 * |
|
118 * @param aSession the session that called this method |
|
119 * @param aErrorCode a system-wide errorcode which is simply displayed |
|
120 * by this method |
|
121 */ |
|
122 void DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ); |
|
123 |
|
124 private: // New methods |
|
125 void UnRegisterSessionL( CBSSession* aSession ); |
|
126 |
|
127 |
|
128 void CleanupFileL( const TDesC& aFile ); |
|
129 |
|
130 void InitializeL(); |
|
131 |
|
132 private: //Data |
|
133 TInt iSessionCount; |
|
134 RPointerArray<CBSSession> iSessions; |
|
135 RBSObjOwningPtrArray<CBSFileMapping> iFileMapping; |
|
136 CBSStorageManager* iStorageManager; |
|
137 CBSInstallHandler* iInstallHandler; |
|
138 |
|
139 // Own. Observer for backup and restore events |
|
140 CBSBackupObserver* iBackupObserver; |
|
141 }; |
|
142 |
|
143 #endif // __CBSSERVER_H__ |
|
144 |
|
145 |
|
146 // END OF FILE |
|
147 |
|
148 |