|
1 /* |
|
2 * Copyright (c) 2006-2007 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 "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: MNcdConfigurationManager declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_NCDCONFIGURATIONMANAGER_H |
|
20 #define M_NCDCONFIGURATIONMANAGER_H |
|
21 |
|
22 #include "ncduserconfiguration.h" |
|
23 |
|
24 class MCatalogsContext; |
|
25 class CNcdServerAddress; |
|
26 class MNcdServerDetails; |
|
27 class MNcdConfigurationObserver; |
|
28 |
|
29 |
|
30 /** |
|
31 * Interface used to manipulate provider-specific configurations |
|
32 * |
|
33 * |
|
34 * There can be three master server addresses. |
|
35 * |
|
36 * By default, hardcoded master server address is used. |
|
37 * If the client adds a KMasterServer-configuration, then that is used. |
|
38 * |
|
39 */ |
|
40 class MNcdConfigurationManager : public MNcdUserConfiguration |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Adds a configuration observer to a context. |
|
46 * |
|
47 * @param aObserver The observer. |
|
48 * @param aContext The context. |
|
49 */ |
|
50 virtual void AddObserverL( |
|
51 MNcdConfigurationObserver& aObserver, |
|
52 const MCatalogsContext& aContext ) = 0; |
|
53 |
|
54 /** |
|
55 * Removes a configuration observer. |
|
56 * @note The observer is removed from all the contexts. |
|
57 * |
|
58 * @param aObserver The observer. |
|
59 */ |
|
60 virtual void RemoveObserver( |
|
61 MNcdConfigurationObserver& aObserver ) = 0; |
|
62 |
|
63 /** |
|
64 * Gets current Master Server address from configuration manager. |
|
65 * The hardcoded address is returned if no other (valid) address is set |
|
66 * |
|
67 * @return Master server address. |
|
68 * @leave KNcdErrorNoMasterServerUri if there is no master server address at all |
|
69 */ |
|
70 virtual const TDesC& MasterServerAddressL( |
|
71 const MCatalogsContext& aContext ) const = 0; |
|
72 |
|
73 /** |
|
74 * Master server address validity getter |
|
75 * |
|
76 * @return Validity value for master server address |
|
77 */ |
|
78 //virtual TInt64 MasterServerAddressValidity() = 0; |
|
79 |
|
80 |
|
81 /** |
|
82 * Checks if the current Master server address is still valid |
|
83 * |
|
84 * @return True if the address is valid |
|
85 * @throw KErrNotFound if the validity of the address has not been |
|
86 * set yet |
|
87 */ |
|
88 virtual TBool IsMasterServerAddressValidL( |
|
89 const MCatalogsContext& aContext ) const = 0; |
|
90 |
|
91 /** |
|
92 * Master server address and validity setter |
|
93 * |
|
94 * @param aAddress Master server address |
|
95 * @param aValidity Master server address validity time. Must be |
|
96 * Universal time. |
|
97 */ |
|
98 virtual void SetMasterServerAddressL( |
|
99 const MCatalogsContext& aContext, |
|
100 const TDesC& aAddress, |
|
101 const TInt64& aValidity ) = 0; |
|
102 |
|
103 /** |
|
104 * @param aAddress Server address. Ownership is transferred after a |
|
105 * successful operation |
|
106 */ |
|
107 virtual void SetMasterServerAddressL( |
|
108 const MCatalogsContext& aContext, |
|
109 CNcdServerAddress* aAddress ) = 0; |
|
110 |
|
111 |
|
112 /** |
|
113 * Resets the Master server address to the previous address. |
|
114 */ |
|
115 virtual void ResetMasterServerAddressL( |
|
116 const MCatalogsContext& aContext ) = 0; |
|
117 |
|
118 |
|
119 /** |
|
120 * @ Remove if not needed |
|
121 virtual void SetClientUpdateL( const TDesC& aUri, |
|
122 const TCatalogsVersion& aVersion, TBool aForced ) = 0; |
|
123 |
|
124 virtual HBufC* GetClientUpdateL( TCatalogsVersion& aVersion, |
|
125 TBool& aForced ) = 0; |
|
126 */ |
|
127 /** |
|
128 * Client ID getter |
|
129 * |
|
130 * The ID is generated if it doesn't already exist |
|
131 * |
|
132 * @param aContext Client's context |
|
133 * @return Unique client ID |
|
134 */ |
|
135 virtual const TDesC& ClientIdL( const MCatalogsContext& aContext ) = 0; |
|
136 |
|
137 |
|
138 /** |
|
139 * SSID setter |
|
140 * |
|
141 * @param aContext Client's context |
|
142 * @param aSsid SSID to set for the context. Ownership is transferred. |
|
143 */ |
|
144 virtual void SetSsidL( |
|
145 const MCatalogsContext& aContext, |
|
146 HBufC8* aSsid ) = 0; |
|
147 |
|
148 /** |
|
149 * SSID getter |
|
150 * |
|
151 * @param aContext Context |
|
152 * @return SSID for the context or empty descriptor if not set |
|
153 */ |
|
154 virtual const TDesC8& SsidL( const MCatalogsContext& aContext ) = 0; |
|
155 |
|
156 |
|
157 /** |
|
158 * Server details getter |
|
159 * |
|
160 * @param aContext Context |
|
161 * @param aServerUri Server URI |
|
162 * @param aNamespace Namespace |
|
163 * @return Server details |
|
164 * |
|
165 * @note If the details don't exists, they are created |
|
166 */ |
|
167 virtual MNcdServerDetails& ServerDetailsL( |
|
168 const MCatalogsContext& aContext, |
|
169 const TDesC& aServerUri, |
|
170 const TDesC& aNamespace ) = 0; |
|
171 |
|
172 |
|
173 /** |
|
174 * Server details getter |
|
175 * |
|
176 * @param aContext Context |
|
177 * @param aServerUri Server URI |
|
178 * @param aNamespace Namespace |
|
179 * @return Server details or NULL if not found. |
|
180 * |
|
181 * Ownership of the server details is NOT transferred. |
|
182 * |
|
183 */ |
|
184 virtual const MNcdServerDetails* ServerDetails( |
|
185 const MCatalogsContext& aContext, |
|
186 const TDesC& aServerUri, |
|
187 const TDesC& aNamespace ) const = 0; |
|
188 |
|
189 |
|
190 /** |
|
191 * Saves the configuration of the given context to the database. |
|
192 * |
|
193 * @param aContext The context. |
|
194 */ |
|
195 virtual void SaveConfigurationToDbL( |
|
196 const MCatalogsContext& aContext ) = 0; |
|
197 |
|
198 /** |
|
199 * Clears the server capabilities and cookies from the database. |
|
200 * |
|
201 * @param aContext The context of which server capabilities are cleared. |
|
202 */ |
|
203 virtual void ClearServerCapabilitiesL( const MCatalogsContext& aContext ) = 0; |
|
204 |
|
205 /** |
|
206 * Destructor |
|
207 */ |
|
208 virtual ~MNcdConfigurationManager() |
|
209 { |
|
210 } |
|
211 }; |
|
212 |
|
213 #endif // M_NCDCONFIGURATIONMANAGER_H |