|
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 "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: Harvester database manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXHARVESTERDBMANAGER_H |
|
20 #define CMPXHARVESTERDBMANAGER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <d32dbms.h> |
|
24 #include "mpxharvesterdb.h" |
|
25 |
|
26 /** |
|
27 * CMPXHarvesterDatabaseManager |
|
28 * |
|
29 * Harvester database manager |
|
30 * |
|
31 * @lib harvesterfilehandler.lib |
|
32 * @since S60 3.0 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CMPXHarvesterDatabaseManager ) : public CBase |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Two phased constructor |
|
41 * @param aFs file session |
|
42 * @return CMPXHarvesterDatabasemanager session |
|
43 */ |
|
44 static CMPXHarvesterDatabaseManager* NewL( RFs& aFs ); |
|
45 |
|
46 /** |
|
47 * Virtual destructor |
|
48 */ |
|
49 virtual ~CMPXHarvesterDatabaseManager(); |
|
50 |
|
51 /** |
|
52 * Open All databases |
|
53 */ |
|
54 TInt OpenAllDatabasesL(); |
|
55 |
|
56 /** |
|
57 * Reopen a particular database |
|
58 * (For MMC events) |
|
59 * @param TDriveNumber aDrive |
|
60 */ |
|
61 void OpenDatabaseL( TDriveNumber aDrive ); |
|
62 |
|
63 /** |
|
64 * Close all databases |
|
65 */ |
|
66 void CloseAllDatabase(); |
|
67 |
|
68 /** |
|
69 * Close a particular DB |
|
70 * (For MMC events) |
|
71 * @param TDriveNumber the Drive |
|
72 */ |
|
73 void CloseDatabase( TDriveNumber aDrive ); |
|
74 |
|
75 /** |
|
76 * Get a particular database |
|
77 * @param TDriveNumber the Drive |
|
78 */ |
|
79 CMPXHarvesterDB& GetDatabaseL( TDriveNumber aDrive ); |
|
80 |
|
81 /** |
|
82 * Remove a particular database from the array |
|
83 * @param TDriveNumber the Drive |
|
84 */ |
|
85 void RemoveDatabaseL( TDriveNumber aDrive ); |
|
86 |
|
87 /** |
|
88 * Return the number of databases |
|
89 * @return number of databases |
|
90 */ |
|
91 TInt Count(); |
|
92 |
|
93 /** |
|
94 * Get the n'th database |
|
95 * @param aDb index to the database |
|
96 * @return CMPXHarvesterDB reference |
|
97 */ |
|
98 CMPXHarvesterDB& GetDatabaseL( TInt aDb ); |
|
99 |
|
100 /** |
|
101 * Recreate all databases |
|
102 * Deletes old ones and re-creates |
|
103 */ |
|
104 void RecreateDatabases(); |
|
105 |
|
106 /** |
|
107 * Begin transaction on all databases |
|
108 */ |
|
109 void BeginL(); |
|
110 |
|
111 /** |
|
112 * Commit transaction on all databases |
|
113 */ |
|
114 void CommitL(); |
|
115 |
|
116 /** |
|
117 * Rollbacks the current transaction on all databases |
|
118 */ |
|
119 void Rollback(); |
|
120 |
|
121 /** |
|
122 * Checks if the spefified drive is a remove drive |
|
123 */ |
|
124 TBool IsRemoteDrive(TDriveNumber aDrive); |
|
125 |
|
126 private: |
|
127 |
|
128 /** |
|
129 * Private constructor |
|
130 */ |
|
131 CMPXHarvesterDatabaseManager( RFs& aFs ); |
|
132 |
|
133 /** |
|
134 * Second phase constructor |
|
135 */ |
|
136 void ConstructL(); |
|
137 |
|
138 private: // data |
|
139 RDbs iDBSession; |
|
140 RPointerArray<CMPXHarvesterDB> iDatabases; |
|
141 |
|
142 RFs& iFs; // Not Owned |
|
143 }; |
|
144 |
|
145 |
|
146 #endif // CMPXHARVESTERDBMANAGER_H |