|
1 /* |
|
2 * Copyright (c) 2002 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: Storage Manager interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MPENGSTORAGEMANAGER_H__ |
|
20 #define __MPENGSTORAGEMANAGER_H__ |
|
21 |
|
22 //class CPEngStoreEntry; |
|
23 #include <badesca.h> |
|
24 #include "CPEngStoreEntry.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPEngStorageManagerWatcher; |
|
28 class CPEngSessionSlotId; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 /** |
|
32 * MPEngStorageManager defines the interface for Storing / Retrieving. |
|
33 * Through this interface Storage Entries can be stored / retrieved. |
|
34 * Storage entries implement CPENGSTOREENTRY interface. For more |
|
35 * information about storage entries see CPEngStoreEntry class. |
|
36 * |
|
37 * @lib PEngStorMan.lib |
|
38 * @since 3.0 |
|
39 */ |
|
40 class MPEngStorageManager |
|
41 { |
|
42 // Storage Manager can be deleted by this interface |
|
43 public: |
|
44 |
|
45 virtual ~MPEngStorageManager() {}; |
|
46 |
|
47 public: // New functions |
|
48 |
|
49 /** |
|
50 * Opens one more reference to this storage Manager |
|
51 * |
|
52 * @since 3.0 |
|
53 */ |
|
54 virtual void Open() = 0; |
|
55 |
|
56 /** |
|
57 * Closes one reference to this storage manager and deletes |
|
58 * if it is no more needed |
|
59 * |
|
60 * @since 3.0 |
|
61 */ |
|
62 virtual void Close() = 0; |
|
63 |
|
64 /** |
|
65 * Stores StoreEntry given as an argument. |
|
66 * If StoreEntry has been locked, lock is obeyed |
|
67 * |
|
68 * @since 3.0 |
|
69 * @param aStoreEntry Store entry to store. |
|
70 */ |
|
71 virtual void StoreL( const CPEngStoreEntry& aStoreEntry ) = 0; |
|
72 |
|
73 /** |
|
74 * Stores Exclusively StoreEntry given as an argument. |
|
75 * This store function does NOT obey Lock of the store entry |
|
76 * |
|
77 * @since 3.0 |
|
78 * @param aStoreEntry Store entry to store. |
|
79 */ |
|
80 virtual void StoreExclusiveL( |
|
81 const CPEngStoreEntry& aStoreEntry ) = 0; |
|
82 |
|
83 |
|
84 /** |
|
85 * Retrieves the state of Storage Entry given as an argument. |
|
86 * If obey version flag is on, before InternalizeL is called |
|
87 * on the Store Entry, version is checked, if version from |
|
88 * store and one Store Entry was already internalized with |
|
89 * is same, InternalizeL is not called on the Store Entry. |
|
90 * This feature is by default on. |
|
91 * |
|
92 * @since 3.0 |
|
93 * @param aStoreEntry Store entry to retrieve. |
|
94 * @param aObeyVersion flag to obey version numbers |
|
95 * @return KErrNone if successful or KErrNotFound if store |
|
96 * entry does not exists in the storage |
|
97 */ |
|
98 virtual TInt RetrieveL( CPEngStoreEntry& aStoreEntry, |
|
99 TBool aObeyVersion = ETrue ) = 0; |
|
100 |
|
101 /** |
|
102 * Deletes Storage Entry from store. |
|
103 * |
|
104 * @since 3.0 |
|
105 * @param aId id of Store entry to delete. |
|
106 * @param aStorageType storage type of Store entry to delete. |
|
107 * @return KErrNone if successful. |
|
108 */ |
|
109 virtual TInt Delete( const CPEngStoreEntry& aStoreEntry ) = 0; |
|
110 |
|
111 /** |
|
112 * Deletes Storage Entry from store. |
|
113 * |
|
114 * @since 3.0 |
|
115 * @param aStoreEntryId Storage ID of entry to delete |
|
116 * @return KErrNone if successful. |
|
117 */ |
|
118 virtual TInt Delete( const TDesC& aStoreEntryId ) = 0; |
|
119 |
|
120 /* |
|
121 * Used to check if certain storage entry is locked |
|
122 * Function leaves if some error while communicating with |
|
123 * server occures. |
|
124 * |
|
125 * @since 3.0 |
|
126 * @param aStoreEntry store entry to be locked |
|
127 * @param aPriority lock priority |
|
128 * @return ETrue if entry is locked |
|
129 */ |
|
130 virtual TBool LockedL( const CPEngStoreEntry& aStoreEntry, |
|
131 TPengStorageLockPriority aPriority = |
|
132 EStorageLockLevelBasic ) const = 0; |
|
133 |
|
134 /** |
|
135 * Used to check if certain storage entry is locked |
|
136 * Function returns EFalse if some error while communicating with |
|
137 * server occures. |
|
138 * |
|
139 * @since 3.0 |
|
140 * @param aStoreID is id of the storage entry |
|
141 * @param aPriority lock priority |
|
142 * @return ETrue if entry is locked |
|
143 * EFalse if not entry is not locked or error has occured |
|
144 * while communicating with the server. |
|
145 */ |
|
146 virtual TBool Locked( const CPEngStoreEntry& aStoreEntry, |
|
147 TPengStorageLockPriority aPriority = |
|
148 EStorageLockLevelBasic ) const = 0; |
|
149 |
|
150 |
|
151 /* |
|
152 * Used to lock certain storage entry |
|
153 * Lock is reference counted, so in order to release lock |
|
154 * same number of Unlock() calls needs to be done as Lock() |
|
155 * If Store Entry is already locked with lower priority, no matter |
|
156 * by which client, previous lock is removed and replaced by |
|
157 * the new lock with the new higher priority. |
|
158 * If passed priority is lower or same as already active of the |
|
159 * store entry, this will fail with KErrLocked |
|
160 * |
|
161 * @since 3.0 |
|
162 * @param aStoreEntry store entry to be locked |
|
163 * @param aPriority priority of the Lock to be done |
|
164 * @param aCreateEntry if store entry does not exists, it is created |
|
165 * default value is ETrue = store entry is created if needed |
|
166 * @return count of the lock on the server side, KErrDisconected or |
|
167 * KErrNotFound if aCreateEntry = EFalse and entry does not exist. |
|
168 */ |
|
169 virtual TInt Lock( const CPEngStoreEntry& aStoreEntry, |
|
170 TPengStorageLockPriority aPriority = |
|
171 EStorageLockLevelBasic, |
|
172 TBool aCreateEntry = ETrue ) const = 0; |
|
173 |
|
174 /* |
|
175 * Used to unlock certain storage entry |
|
176 * UnLock is reference counted and need to be called as many |
|
177 * times ad Lock was called |
|
178 * |
|
179 * @since 3.0 |
|
180 * @param aStoreEntry store entry to be un-locked |
|
181 * @return Reference count of the lock, or if negative |
|
182 * then some system wide error code |
|
183 */ |
|
184 virtual TInt Unlock( const CPEngStoreEntry& aStoreEntry ) const = 0; |
|
185 |
|
186 /** |
|
187 * Notifies about storage IDs change |
|
188 * This call returns without waiting if notification was delivered |
|
189 * to the Presence Server. |
|
190 * Only one SID can be notified at the time, when same function |
|
191 * is called in sequence multiple times client shall keep passed |
|
192 * descriptors valid, if those descriptors will be deleted after |
|
193 * call, notification will not be delivered to the listeners, |
|
194 * Since Storage server was not able to read Store Id from client |
|
195 * |
|
196 * @since 3.0 |
|
197 * @param aChangedSId changed Store Id to be notified, |
|
198 * @param aSidStorageType storage type of the storage entry |
|
199 * @return KErrDisconnected if there is not any observer registered |
|
200 * KErrNone if it went OK |
|
201 */ |
|
202 virtual TInt NotifyChangedSId( const TDesC& aChangedSId, |
|
203 TPEngStorageType aSidStorageType ) = 0; |
|
204 |
|
205 |
|
206 /* |
|
207 * Stops sending of SID changes done through this Storage Manager |
|
208 * Instance, how ever all notification will be buffered on the |
|
209 * server side and will be sent all when ReleaseServerSideBuffering |
|
210 * is called |
|
211 * Multiple calling of this function increases counter on the |
|
212 * client side and by specified counter |
|
213 * Notifications are resumbed by the ReleaseServerSideBuffering() |
|
214 * |
|
215 * @since 3.0 |
|
216 * @param aCount count by which counter of the server will be |
|
217 * increased, by default set to 1 |
|
218 * @return positive number represents number on the server side |
|
219 * counter, negative some system wide error |
|
220 */ |
|
221 virtual TInt BufferServerSideNotifications( TInt aCount = 1 ) = 0; |
|
222 |
|
223 |
|
224 /* |
|
225 * Decreases counter of the Server Side Notification buffering, |
|
226 * when counter reaches zero, all buffered notifications are |
|
227 * notified to the listeners. |
|
228 * If Bufferering of the SID changes is not active, this function |
|
229 * Does nothing |
|
230 * |
|
231 * @since 3.0 |
|
232 * @param aCount count by which counter of the server will be |
|
233 * decreased, by default set to 1 |
|
234 * @return positive number represents number on the server side |
|
235 * ounter, negative some system wide error |
|
236 */ |
|
237 virtual TInt ReleaseServerSideBuffering( TInt aCount = 1 ) = 0 ; |
|
238 |
|
239 /* |
|
240 * Used to unlock certain storage entry |
|
241 * |
|
242 * @since 3.0 |
|
243 * @return reference to the Storage Manager Watcher |
|
244 */ |
|
245 virtual MPEngStorageManagerWatcher& StorageManagerWatcher() = 0; |
|
246 |
|
247 /* |
|
248 * Get Session slot Id class |
|
249 * Returned class carries information about the session of this |
|
250 * instance of the storage manager |
|
251 * |
|
252 * @since 3.0 |
|
253 * @return CPEngSessionSlotId& Session ID slot reference |
|
254 */ |
|
255 virtual const CPEngSessionSlotId& SessionSlotId() const = 0; |
|
256 |
|
257 }; |
|
258 |
|
259 #endif // __MPENGSTORAGEMANAGER_H__ |
|
260 |
|
261 // End of File |