williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: CPosLmDatabaseManagerPluginBase class
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
|
williamr@4
|
20 |
#ifndef CPOSLMDATABASEMANAGERPLUGINBASE_H
|
williamr@4
|
21 |
#define CPOSLMDATABASEMANAGERPLUGINBASE_H
|
williamr@4
|
22 |
|
williamr@4
|
23 |
#include <e32base.h>
|
williamr@4
|
24 |
#include <badesca.h>
|
williamr@4
|
25 |
#include <EPos_TPosLmDatabaseEvent.h>
|
williamr@4
|
26 |
#include <EPos_TPosLmDatabaseSettings.h>
|
williamr@4
|
27 |
#include <EPos_HPosLmDatabaseInfo.h>
|
williamr@4
|
28 |
|
williamr@4
|
29 |
class CPosLmDbManPluginBaseExtension;
|
williamr@4
|
30 |
class RPosLandmarkServer;
|
williamr@4
|
31 |
|
williamr@4
|
32 |
/**
|
williamr@4
|
33 |
* @internal
|
williamr@4
|
34 |
*
|
williamr@4
|
35 |
* <b>This class is not used by client applications.
|
williamr@4
|
36 |
* It is reserved for future extensions.</b>
|
williamr@4
|
37 |
*/
|
williamr@4
|
38 |
/*
|
williamr@4
|
39 |
* This class is the base class which has to be subclassed in order to write a
|
williamr@4
|
40 |
* plug-in for database management for a specific protocol. It is reserved for
|
williamr@4
|
41 |
* for future extensions.
|
williamr@4
|
42 |
*
|
williamr@4
|
43 |
* @p CPosLmDatabaseManagerPluginBase contains functions for listing,
|
williamr@4
|
44 |
* registering, unregistering, creating, deleting, copying landmark databases,
|
williamr@4
|
45 |
* etc.
|
williamr@4
|
46 |
*
|
williamr@4
|
47 |
* @lib eposlmdbmanlib.lib
|
williamr@4
|
48 |
* @since S60 3.0
|
williamr@4
|
49 |
*/
|
williamr@4
|
50 |
class CPosLmDatabaseManagerPluginBase : public CBase
|
williamr@4
|
51 |
{
|
williamr@4
|
52 |
public:
|
williamr@4
|
53 |
|
williamr@4
|
54 |
/*
|
williamr@4
|
55 |
* Destructor.
|
williamr@4
|
56 |
*/
|
williamr@4
|
57 |
IMPORT_C virtual ~CPosLmDatabaseManagerPluginBase();
|
williamr@4
|
58 |
|
williamr@4
|
59 |
public:
|
williamr@4
|
60 |
|
williamr@4
|
61 |
/*
|
williamr@4
|
62 |
* Retrieves the type of media where a landmark database resides.
|
williamr@4
|
63 |
*
|
williamr@4
|
64 |
* This function does not validate the URI. If the URI is invalid, this
|
williamr@4
|
65 |
* function will just return @p EMediaUnknown.
|
williamr@4
|
66 |
*
|
williamr@4
|
67 |
* @param[in] aDatabaseUri The URI of the database to check media for.
|
williamr@4
|
68 |
* @return Type of storage media.
|
williamr@4
|
69 |
*/
|
williamr@4
|
70 |
virtual TMediaType DatabaseMedia( const TDesC& aDatabaseUri ) = 0;
|
williamr@4
|
71 |
|
williamr@4
|
72 |
/*
|
williamr@4
|
73 |
* Retrieves the drive letter for the drive where a landmark database
|
williamr@4
|
74 |
* resides.
|
williamr@4
|
75 |
*
|
williamr@4
|
76 |
* If the landmark database is remote or otherwise the drive letter is
|
williamr@4
|
77 |
* not applicable, 0 is returned.
|
williamr@4
|
78 |
*
|
williamr@4
|
79 |
* This function does not validate the URI. If the URI is invalid, this
|
williamr@4
|
80 |
* function will just return 0.
|
williamr@4
|
81 |
*
|
williamr@4
|
82 |
* @param[in] aDatabaseUri The URI of the database to check drive letter
|
williamr@4
|
83 |
* for.
|
williamr@4
|
84 |
* @return The drive letter, or 0 if drive letter is not applicable.
|
williamr@4
|
85 |
*/
|
williamr@4
|
86 |
virtual TChar DatabaseDrive( const TDesC& aDatabaseUri ) = 0;
|
williamr@4
|
87 |
|
williamr@4
|
88 |
/*
|
williamr@4
|
89 |
* Returns the protocol which the plug-in handles.
|
williamr@4
|
90 |
*
|
williamr@4
|
91 |
* The returned descriptor pointer is valid until the plug-in is
|
williamr@4
|
92 |
* unloaded.
|
williamr@4
|
93 |
*
|
williamr@4
|
94 |
* @return Pointer to the protocol descriptor, e.g. "file"
|
williamr@4
|
95 |
*/
|
williamr@4
|
96 |
virtual TPtrC Protocol() = 0;
|
williamr@4
|
97 |
|
williamr@4
|
98 |
/*
|
williamr@4
|
99 |
* Lists the URIs to all landmark databases handled by this
|
williamr@4
|
100 |
* plug-in.
|
williamr@4
|
101 |
*
|
williamr@4
|
102 |
* The client takes ownership of the returned array.
|
williamr@4
|
103 |
*
|
williamr@4
|
104 |
* If no databases are found, an empty array is returned.
|
williamr@4
|
105 |
*
|
williamr@4
|
106 |
* This function requires @p ReadUserData capability.
|
williamr@4
|
107 |
*
|
williamr@4
|
108 |
* @return The list of database URIs.
|
williamr@4
|
109 |
*/
|
williamr@4
|
110 |
virtual CDesCArray* ListDatabasesLC() = 0;
|
williamr@4
|
111 |
|
williamr@4
|
112 |
/*
|
williamr@4
|
113 |
* Lists information about each landmark database handled by this
|
williamr@4
|
114 |
* plug-in.
|
williamr@4
|
115 |
*
|
williamr@4
|
116 |
* The client specifies an array which is populated by this function.
|
williamr@4
|
117 |
* The client takes ownership of all information objects in the array.
|
williamr@4
|
118 |
*
|
williamr@4
|
119 |
* If no databases are found, the input array is not modified.
|
williamr@4
|
120 |
*
|
williamr@4
|
121 |
* This function requires @p ReadUserData capability.
|
williamr@4
|
122 |
*
|
williamr@4
|
123 |
* @param[out] aDatabaseInfoArray On return, contains information about
|
williamr@4
|
124 |
* the landmark databases.
|
williamr@4
|
125 |
*/
|
williamr@4
|
126 |
virtual void ListDatabasesL(
|
williamr@4
|
127 |
RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray
|
williamr@4
|
128 |
) = 0;
|
williamr@4
|
129 |
|
williamr@4
|
130 |
/*
|
williamr@4
|
131 |
* Registers a landmark database.
|
williamr@4
|
132 |
*
|
williamr@4
|
133 |
* The landmark database is then returned when listing landmark
|
williamr@4
|
134 |
* databases.
|
williamr@4
|
135 |
*
|
williamr@4
|
136 |
* Some protocols like "file" does not allow registering of databases
|
williamr@4
|
137 |
* and will leave with error code @p KErrNotSupported. To add a
|
williamr@4
|
138 |
* database of such protocol, the client must call @ref CreateDatabaseL.
|
williamr@4
|
139 |
*
|
williamr@4
|
140 |
* The client supplies an information object containing the URI of the
|
williamr@4
|
141 |
* database to register. The information object can also contain
|
williamr@4
|
142 |
* database settings, e.g. a display name for the database.
|
williamr@4
|
143 |
*
|
williamr@4
|
144 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
145 |
* capabilities.
|
williamr@4
|
146 |
*
|
williamr@4
|
147 |
* @param[in,out] aDatabaseInfo Information about the landmark database to
|
williamr@4
|
148 |
* register.
|
williamr@4
|
149 |
*
|
williamr@4
|
150 |
* @leave KErrNotSupported The protocol specified in the URI is not
|
williamr@4
|
151 |
* supported by this plug-in or the protocol does not allow
|
williamr@4
|
152 |
* registering landmark databases.
|
williamr@4
|
153 |
* @leave KErrArgument The URI is incorrect.
|
williamr@4
|
154 |
* @leave KErrAlreadyExists The database already exists in the registry.
|
williamr@4
|
155 |
*/
|
williamr@4
|
156 |
virtual void RegisterDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
|
williamr@4
|
157 |
|
williamr@4
|
158 |
/*
|
williamr@4
|
159 |
* Unregisters a landmark database.
|
williamr@4
|
160 |
*
|
williamr@4
|
161 |
* After this, the landmark database will not be returned when listing
|
williamr@4
|
162 |
* landmark databases.
|
williamr@4
|
163 |
*
|
williamr@4
|
164 |
* Some protocols like "file" does not allow unregistering of databases
|
williamr@4
|
165 |
* and will leave with error code @p KErrNotSupported. To remove a
|
williamr@4
|
166 |
* database of such protocol, the client must call @ref DeleteDatabaseL.
|
williamr@4
|
167 |
*
|
williamr@4
|
168 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
169 |
* capabilities.
|
williamr@4
|
170 |
*
|
williamr@4
|
171 |
* @param[in] aDatabaseUri The URI of the database to register.
|
williamr@4
|
172 |
*
|
williamr@4
|
173 |
* @leave KErrNotSupported The protocol specified in the URI is not
|
williamr@4
|
174 |
* supported by this plug-in or the protocol does not allow
|
williamr@4
|
175 |
* unregistering landmark databases.
|
williamr@4
|
176 |
* @leave KErrArgument The URI is incorrect.
|
williamr@4
|
177 |
*/
|
williamr@4
|
178 |
virtual void UnregisterDatabaseL( const TDesC& aDatabaseUri ) = 0;
|
williamr@4
|
179 |
|
williamr@4
|
180 |
/*
|
williamr@4
|
181 |
* Unregisters all landmark database which are accessed through this
|
williamr@4
|
182 |
* plug-in.
|
williamr@4
|
183 |
*
|
williamr@4
|
184 |
* After this, the landmark databases will not be returned when listing
|
williamr@4
|
185 |
* landmark databases.
|
williamr@4
|
186 |
*
|
williamr@4
|
187 |
* Some protocols like "file" does not allow unregistering of databases
|
williamr@4
|
188 |
* and will leave with error code @p KErrNotSupported. To remove a
|
williamr@4
|
189 |
* "file"-protocol database, the client must call @ref DeleteDatabaseL.
|
williamr@4
|
190 |
*
|
williamr@4
|
191 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
192 |
* capabilities.
|
williamr@4
|
193 |
*
|
williamr@4
|
194 |
* @leave KErrNotSupported This plug-in does not allow unregistering
|
williamr@4
|
195 |
* landmark databases.
|
williamr@4
|
196 |
*/
|
williamr@4
|
197 |
virtual void UnregisterAllDatabasesL() = 0;
|
williamr@4
|
198 |
|
williamr@4
|
199 |
/*
|
williamr@4
|
200 |
* Modifies the settings for a landmark database.
|
williamr@4
|
201 |
*
|
williamr@4
|
202 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
203 |
* capabilities.
|
williamr@4
|
204 |
*
|
williamr@4
|
205 |
* @param[in] aDatabaseUri The URI of the database to modify settings for.
|
williamr@4
|
206 |
* @param[in] aDatabaseSettings The new settings for the database.
|
williamr@4
|
207 |
*
|
williamr@4
|
208 |
* @leave KErrNotSupported The protocol specified in the URI is not
|
williamr@4
|
209 |
* supported by this plug-in.
|
williamr@4
|
210 |
* @leave KErrNotFound The specified database is not found.
|
williamr@4
|
211 |
*/
|
williamr@4
|
212 |
virtual void ModifyDatabaseSettingsL(
|
williamr@4
|
213 |
const TDesC& aDatabaseUri,
|
williamr@4
|
214 |
const TPosLmDatabaseSettings& aDatabaseSettings
|
williamr@4
|
215 |
) = 0;
|
williamr@4
|
216 |
|
williamr@4
|
217 |
/*
|
williamr@4
|
218 |
* Retrieve information about a landmark database.
|
williamr@4
|
219 |
*
|
williamr@4
|
220 |
* This function requires @p ReadUserData capability.
|
williamr@4
|
221 |
*
|
williamr@4
|
222 |
* @param[in,out] aDatabaseInfo An information object containing the URI of the
|
williamr@4
|
223 |
* landmark database. On return, the object contains information about
|
williamr@4
|
224 |
* the landmark database, including any database settings.
|
williamr@4
|
225 |
*
|
williamr@4
|
226 |
* @leave KErrNotSupported The protocol specified in the URI is not
|
williamr@4
|
227 |
* supported by this plug-in.
|
williamr@4
|
228 |
* @leave KErrNotFound The specified database is not found.
|
williamr@4
|
229 |
*/
|
williamr@4
|
230 |
virtual void GetDatabaseInfoL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
|
williamr@4
|
231 |
|
williamr@4
|
232 |
/*
|
williamr@4
|
233 |
* Checks if the specified landmark database exists.
|
williamr@4
|
234 |
*
|
williamr@4
|
235 |
* The database to check is specified by passing a URI to this function.
|
williamr@4
|
236 |
* URI construction is described in the class description for
|
williamr@4
|
237 |
* @ref CPosLmDatabaseManager.
|
williamr@4
|
238 |
*
|
williamr@4
|
239 |
* This function requires @p ReadUserData capability. If the database is
|
williamr@4
|
240 |
* remote, @p NetworkServices capability is also needed.
|
williamr@4
|
241 |
*
|
williamr@4
|
242 |
* @param[in] aDatabaseUri The URI of the database which should be checked
|
williamr@4
|
243 |
* for existence.
|
williamr@4
|
244 |
* @return @p ETrue if the database exists, otherwise @p EFalse.
|
williamr@4
|
245 |
*
|
williamr@4
|
246 |
* @leave KErrArgument The URI is incorrect or the protocol specified in the
|
williamr@4
|
247 |
* URI is not supported by this plug-in.
|
williamr@4
|
248 |
*/
|
williamr@4
|
249 |
virtual TBool DatabaseExistsL( const TDesC& aDatabaseUri ) = 0;
|
williamr@4
|
250 |
|
williamr@4
|
251 |
/*
|
williamr@4
|
252 |
* Creates a landmark database.
|
williamr@4
|
253 |
*
|
williamr@4
|
254 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
255 |
* capabilities. If the database is remote, @p NetworkServices
|
williamr@4
|
256 |
* capability is also needed.
|
williamr@4
|
257 |
*
|
williamr@4
|
258 |
* @param[in,out] aDatabaseInfo Information about the landmark database to
|
williamr@4
|
259 |
* create.
|
williamr@4
|
260 |
*
|
williamr@4
|
261 |
* @leave KErrNotSupported The protocol is not supported or the create
|
williamr@4
|
262 |
* operation is not supported by the protocol plug-in.
|
williamr@4
|
263 |
* @leave KErrArgument The URI is incorrect or the protocol specified in the
|
williamr@4
|
264 |
* URI is not supported by this plug-in.
|
williamr@4
|
265 |
* @leave KErrAlreadyExists There is already a database at this URI.
|
williamr@4
|
266 |
*/
|
williamr@4
|
267 |
virtual void CreateDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
|
williamr@4
|
268 |
|
williamr@4
|
269 |
/*
|
williamr@4
|
270 |
* Deletes a landmark database.
|
williamr@4
|
271 |
*
|
williamr@4
|
272 |
* The database to delete is specified by passing a URI to this
|
williamr@4
|
273 |
* function. URI construction is described in the class description for
|
williamr@4
|
274 |
* @ref CPosLmDatabaseManager. The URI must specify the protocol which
|
williamr@4
|
275 |
* is handled by this database manager plug-in.
|
williamr@4
|
276 |
*
|
williamr@4
|
277 |
* If the specified database does not exist, the call is ignored.
|
williamr@4
|
278 |
*
|
williamr@4
|
279 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
280 |
* capabilities. If the database is remote, @p NetworkServices
|
williamr@4
|
281 |
* capability is also needed.
|
williamr@4
|
282 |
*
|
williamr@4
|
283 |
* @param[in] aDatabaseUri The URI of the database to delete.
|
williamr@4
|
284 |
*
|
williamr@4
|
285 |
* @leave KErrNotSupported The protocol is not supported or the delete
|
williamr@4
|
286 |
* operation is not supported by the plug-in.
|
williamr@4
|
287 |
* @leave KErrArgument The URI is incorrect or the protocol specified in the
|
williamr@4
|
288 |
* URI is not supported by this plug-in.
|
williamr@4
|
289 |
* @leave KErrInUse The database is in use by some client.
|
williamr@4
|
290 |
* @leave KErrAccessDenied The database is read-only.
|
williamr@4
|
291 |
*/
|
williamr@4
|
292 |
virtual void DeleteDatabaseL( const TDesC& aDatabaseUri ) = 0;
|
williamr@4
|
293 |
|
williamr@4
|
294 |
/*
|
williamr@4
|
295 |
* Copies a landmark database to a new location.
|
williamr@4
|
296 |
*
|
williamr@4
|
297 |
* Database locations are specified as URIs. URI construction is
|
williamr@4
|
298 |
* described in the class description for @ref CPosLmDatabaseManager.
|
williamr@4
|
299 |
* The target and source URIs must specify the protocol which is handled
|
williamr@4
|
300 |
* by this database manager plug-in.
|
williamr@4
|
301 |
*
|
williamr@4
|
302 |
* This function requires @p ReadUserData and @p WriteUserData
|
williamr@4
|
303 |
* capabilities. If the database is remote, @p NetworkServices
|
williamr@4
|
304 |
* capability is also needed.
|
williamr@4
|
305 |
*
|
williamr@4
|
306 |
* @param[in] aSourceUri The URI of the database to copy.
|
williamr@4
|
307 |
* @param[in] aTargetUri The URI of the new database location.
|
williamr@4
|
308 |
*
|
williamr@4
|
309 |
* @leave KErrNotSupported The operation is not supported by the plug-in.
|
williamr@4
|
310 |
* @leave KErrArgument A URI is incorrect or the protocol specified in a
|
williamr@4
|
311 |
* URI is not supported by this plug-in.
|
williamr@4
|
312 |
* @leave KErrInUse There is a write-lock on the database, e.g. some client
|
williamr@4
|
313 |
* is currently modifying the database.
|
williamr@4
|
314 |
* @leave KErrNotFound There is no database at the source URI.
|
williamr@4
|
315 |
*/
|
williamr@4
|
316 |
virtual void CopyDatabaseL(
|
williamr@4
|
317 |
const TDesC& aSourceUri,
|
williamr@4
|
318 |
const TDesC& aTargetUri
|
williamr@4
|
319 |
) = 0;
|
williamr@4
|
320 |
|
williamr@4
|
321 |
protected:
|
williamr@4
|
322 |
|
williamr@4
|
323 |
/*
|
williamr@4
|
324 |
* C++ constructor.
|
williamr@4
|
325 |
*/
|
williamr@4
|
326 |
IMPORT_C CPosLmDatabaseManagerPluginBase();
|
williamr@4
|
327 |
|
williamr@4
|
328 |
/*
|
williamr@4
|
329 |
* Creates the internals of the manager.
|
williamr@4
|
330 |
*
|
williamr@4
|
331 |
* This function must be called first in the manager's @b ConstructL()
|
williamr@4
|
332 |
* method.
|
williamr@4
|
333 |
*
|
williamr@4
|
334 |
* @param[in] aConstructionParameters The construction parameters supplied
|
williamr@4
|
335 |
* in the factory call.
|
williamr@4
|
336 |
*/
|
williamr@4
|
337 |
IMPORT_C void BaseConstructL( TAny* aConstructionParameters );
|
williamr@4
|
338 |
|
williamr@4
|
339 |
protected:
|
williamr@4
|
340 |
|
williamr@4
|
341 |
/*
|
williamr@4
|
342 |
* Returns a reference to an open landmark server session.
|
williamr@4
|
343 |
*
|
williamr@4
|
344 |
* @return The server session.
|
williamr@4
|
345 |
*/
|
williamr@4
|
346 |
IMPORT_C RPosLandmarkServer& Session() const;
|
williamr@4
|
347 |
|
williamr@4
|
348 |
private:
|
williamr@4
|
349 |
|
williamr@4
|
350 |
// Prohibit copy constructor
|
williamr@4
|
351 |
CPosLmDatabaseManagerPluginBase(
|
williamr@4
|
352 |
const CPosLmDatabaseManagerPluginBase& );
|
williamr@4
|
353 |
// Prohibit assigment operator
|
williamr@4
|
354 |
CPosLmDatabaseManagerPluginBase& operator=(
|
williamr@4
|
355 |
const CPosLmDatabaseManagerPluginBase& );
|
williamr@4
|
356 |
|
williamr@4
|
357 |
private:
|
williamr@4
|
358 |
|
williamr@4
|
359 |
CPosLmDbManPluginBaseExtension* iExtension;
|
williamr@4
|
360 |
};
|
williamr@4
|
361 |
|
williamr@4
|
362 |
#endif // CPOSLMDATABASEMANAGERPLUGINBASE_H
|
williamr@4
|
363 |
|
williamr@4
|
364 |
|