2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: CPosLmDatabaseManagerPluginBase class
20 #ifndef CPOSLMDATABASEMANAGERPLUGINBASE_H
21 #define CPOSLMDATABASEMANAGERPLUGINBASE_H
25 #include <EPos_TPosLmDatabaseEvent.h>
26 #include <EPos_TPosLmDatabaseSettings.h>
27 #include <EPos_HPosLmDatabaseInfo.h>
29 class CPosLmDbManPluginBaseExtension;
30 class RPosLandmarkServer;
35 * <b>This class is not used by client applications.
36 * It is reserved for future extensions.</b>
39 * This class is the base class which has to be subclassed in order to write a
40 * plug-in for database management for a specific protocol. It is reserved for
41 * for future extensions.
43 * @p CPosLmDatabaseManagerPluginBase contains functions for listing,
44 * registering, unregistering, creating, deleting, copying landmark databases,
47 * @lib eposlmdbmanlib.lib
50 class CPosLmDatabaseManagerPluginBase : public CBase
57 IMPORT_C virtual ~CPosLmDatabaseManagerPluginBase();
62 * Retrieves the type of media where a landmark database resides.
64 * This function does not validate the URI. If the URI is invalid, this
65 * function will just return @p EMediaUnknown.
67 * @param[in] aDatabaseUri The URI of the database to check media for.
68 * @return Type of storage media.
70 virtual TMediaType DatabaseMedia( const TDesC& aDatabaseUri ) = 0;
73 * Retrieves the drive letter for the drive where a landmark database
76 * If the landmark database is remote or otherwise the drive letter is
77 * not applicable, 0 is returned.
79 * This function does not validate the URI. If the URI is invalid, this
80 * function will just return 0.
82 * @param[in] aDatabaseUri The URI of the database to check drive letter
84 * @return The drive letter, or 0 if drive letter is not applicable.
86 virtual TChar DatabaseDrive( const TDesC& aDatabaseUri ) = 0;
89 * Returns the protocol which the plug-in handles.
91 * The returned descriptor pointer is valid until the plug-in is
94 * @return Pointer to the protocol descriptor, e.g. "file"
96 virtual TPtrC Protocol() = 0;
99 * Lists the URIs to all landmark databases handled by this
102 * The client takes ownership of the returned array.
104 * If no databases are found, an empty array is returned.
106 * This function requires @p ReadUserData capability.
108 * @return The list of database URIs.
110 virtual CDesCArray* ListDatabasesLC() = 0;
113 * Lists information about each landmark database handled by this
116 * The client specifies an array which is populated by this function.
117 * The client takes ownership of all information objects in the array.
119 * If no databases are found, the input array is not modified.
121 * This function requires @p ReadUserData capability.
123 * @param[out] aDatabaseInfoArray On return, contains information about
124 * the landmark databases.
126 virtual void ListDatabasesL(
127 RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray
131 * Registers a landmark database.
133 * The landmark database is then returned when listing landmark
136 * Some protocols like "file" does not allow registering of databases
137 * and will leave with error code @p KErrNotSupported. To add a
138 * database of such protocol, the client must call @ref CreateDatabaseL.
140 * The client supplies an information object containing the URI of the
141 * database to register. The information object can also contain
142 * database settings, e.g. a display name for the database.
144 * This function requires @p ReadUserData and @p WriteUserData
147 * @param[in,out] aDatabaseInfo Information about the landmark database to
150 * @leave KErrNotSupported The protocol specified in the URI is not
151 * supported by this plug-in or the protocol does not allow
152 * registering landmark databases.
153 * @leave KErrArgument The URI is incorrect.
154 * @leave KErrAlreadyExists The database already exists in the registry.
156 virtual void RegisterDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
159 * Unregisters a landmark database.
161 * After this, the landmark database will not be returned when listing
162 * landmark databases.
164 * Some protocols like "file" does not allow unregistering of databases
165 * and will leave with error code @p KErrNotSupported. To remove a
166 * database of such protocol, the client must call @ref DeleteDatabaseL.
168 * This function requires @p ReadUserData and @p WriteUserData
171 * @param[in] aDatabaseUri The URI of the database to register.
173 * @leave KErrNotSupported The protocol specified in the URI is not
174 * supported by this plug-in or the protocol does not allow
175 * unregistering landmark databases.
176 * @leave KErrArgument The URI is incorrect.
178 virtual void UnregisterDatabaseL( const TDesC& aDatabaseUri ) = 0;
181 * Unregisters all landmark database which are accessed through this
184 * After this, the landmark databases will not be returned when listing
185 * landmark databases.
187 * Some protocols like "file" does not allow unregistering of databases
188 * and will leave with error code @p KErrNotSupported. To remove a
189 * "file"-protocol database, the client must call @ref DeleteDatabaseL.
191 * This function requires @p ReadUserData and @p WriteUserData
194 * @leave KErrNotSupported This plug-in does not allow unregistering
195 * landmark databases.
197 virtual void UnregisterAllDatabasesL() = 0;
200 * Modifies the settings for a landmark database.
202 * This function requires @p ReadUserData and @p WriteUserData
205 * @param[in] aDatabaseUri The URI of the database to modify settings for.
206 * @param[in] aDatabaseSettings The new settings for the database.
208 * @leave KErrNotSupported The protocol specified in the URI is not
209 * supported by this plug-in.
210 * @leave KErrNotFound The specified database is not found.
212 virtual void ModifyDatabaseSettingsL(
213 const TDesC& aDatabaseUri,
214 const TPosLmDatabaseSettings& aDatabaseSettings
218 * Retrieve information about a landmark database.
220 * This function requires @p ReadUserData capability.
222 * @param[in,out] aDatabaseInfo An information object containing the URI of the
223 * landmark database. On return, the object contains information about
224 * the landmark database, including any database settings.
226 * @leave KErrNotSupported The protocol specified in the URI is not
227 * supported by this plug-in.
228 * @leave KErrNotFound The specified database is not found.
230 virtual void GetDatabaseInfoL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
233 * Checks if the specified landmark database exists.
235 * The database to check is specified by passing a URI to this function.
236 * URI construction is described in the class description for
237 * @ref CPosLmDatabaseManager.
239 * This function requires @p ReadUserData capability. If the database is
240 * remote, @p NetworkServices capability is also needed.
242 * @param[in] aDatabaseUri The URI of the database which should be checked
244 * @return @p ETrue if the database exists, otherwise @p EFalse.
246 * @leave KErrArgument The URI is incorrect or the protocol specified in the
247 * URI is not supported by this plug-in.
249 virtual TBool DatabaseExistsL( const TDesC& aDatabaseUri ) = 0;
252 * Creates a landmark database.
254 * This function requires @p ReadUserData and @p WriteUserData
255 * capabilities. If the database is remote, @p NetworkServices
256 * capability is also needed.
258 * @param[in,out] aDatabaseInfo Information about the landmark database to
261 * @leave KErrNotSupported The protocol is not supported or the create
262 * operation is not supported by the protocol plug-in.
263 * @leave KErrArgument The URI is incorrect or the protocol specified in the
264 * URI is not supported by this plug-in.
265 * @leave KErrAlreadyExists There is already a database at this URI.
267 virtual void CreateDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
270 * Deletes a landmark database.
272 * The database to delete is specified by passing a URI to this
273 * function. URI construction is described in the class description for
274 * @ref CPosLmDatabaseManager. The URI must specify the protocol which
275 * is handled by this database manager plug-in.
277 * If the specified database does not exist, the call is ignored.
279 * This function requires @p ReadUserData and @p WriteUserData
280 * capabilities. If the database is remote, @p NetworkServices
281 * capability is also needed.
283 * @param[in] aDatabaseUri The URI of the database to delete.
285 * @leave KErrNotSupported The protocol is not supported or the delete
286 * operation is not supported by the plug-in.
287 * @leave KErrArgument The URI is incorrect or the protocol specified in the
288 * URI is not supported by this plug-in.
289 * @leave KErrInUse The database is in use by some client.
290 * @leave KErrAccessDenied The database is read-only.
292 virtual void DeleteDatabaseL( const TDesC& aDatabaseUri ) = 0;
295 * Copies a landmark database to a new location.
297 * Database locations are specified as URIs. URI construction is
298 * described in the class description for @ref CPosLmDatabaseManager.
299 * The target and source URIs must specify the protocol which is handled
300 * by this database manager plug-in.
302 * This function requires @p ReadUserData and @p WriteUserData
303 * capabilities. If the database is remote, @p NetworkServices
304 * capability is also needed.
306 * @param[in] aSourceUri The URI of the database to copy.
307 * @param[in] aTargetUri The URI of the new database location.
309 * @leave KErrNotSupported The operation is not supported by the plug-in.
310 * @leave KErrArgument A URI is incorrect or the protocol specified in a
311 * URI is not supported by this plug-in.
312 * @leave KErrInUse There is a write-lock on the database, e.g. some client
313 * is currently modifying the database.
314 * @leave KErrNotFound There is no database at the source URI.
316 virtual void CopyDatabaseL(
317 const TDesC& aSourceUri,
318 const TDesC& aTargetUri
326 IMPORT_C CPosLmDatabaseManagerPluginBase();
329 * Creates the internals of the manager.
331 * This function must be called first in the manager's @b ConstructL()
334 * @param[in] aConstructionParameters The construction parameters supplied
335 * in the factory call.
337 IMPORT_C void BaseConstructL( TAny* aConstructionParameters );
342 * Returns a reference to an open landmark server session.
344 * @return The server session.
346 IMPORT_C RPosLandmarkServer& Session() const;
350 // Prohibit copy constructor
351 CPosLmDatabaseManagerPluginBase(
352 const CPosLmDatabaseManagerPluginBase& );
353 // Prohibit assigment operator
354 CPosLmDatabaseManagerPluginBase& operator=(
355 const CPosLmDatabaseManagerPluginBase& );
359 CPosLmDbManPluginBaseExtension* iExtension;
362 #endif // CPOSLMDATABASEMANAGERPLUGINBASE_H