|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Blacklisting of files that fail harvesting. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CHARVESTERBLACKLIST_H |
|
20 #define CHARVESTERBLACKLIST_H |
|
21 |
|
22 #include <e32def.h> |
|
23 |
|
24 #include "../harvester/blacklistclient/inc/blacklistclient.h" |
|
25 /** |
|
26 * This class implements blacklisting of files that |
|
27 * have failed harvesting. |
|
28 * All files should be added to blacklist while harvesting |
|
29 * and removed when harvesting is successful. |
|
30 * If harvesting fails, file is left blacklisted. |
|
31 */ |
|
32 NONSHARABLE_CLASS( CHarvesterBlacklist ) : public CBase |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Creates and constructs a new instance of CMdsBlacklist. |
|
38 * |
|
39 * @return A pointer to the created instance. |
|
40 */ |
|
41 IMPORT_C static CHarvesterBlacklist* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 IMPORT_C virtual ~CHarvesterBlacklist(); |
|
47 |
|
48 /** |
|
49 * Adds a file to blacklist with it's URI. |
|
50 * |
|
51 * @param aUri URI to a file. |
|
52 * @param aMediaId Media Id of the media where file is located. |
|
53 * @return KErrNone or a system wide error code. |
|
54 */ |
|
55 IMPORT_C TInt AddFile( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime ); |
|
56 |
|
57 /** |
|
58 * Removes a file from the blacklist. |
|
59 * |
|
60 * @param aUri URI to a file. |
|
61 * @param aMediaId Media Id of the media where file is located. |
|
62 * @return KErrNone or a system wide error code. |
|
63 */ |
|
64 IMPORT_C TInt RemoveFile( const TDesC& aUri, TUint32 aMediaId ); |
|
65 |
|
66 /** |
|
67 * Checks if a given file is blacklisted. |
|
68 * |
|
69 * @param aUri URI to a file. |
|
70 * @param aMediaId Media id of the file. |
|
71 * @return ETrue, if the file is blacklisted, otherwise EFalse. |
|
72 */ |
|
73 IMPORT_C TBool IsBlacklisted( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime ); |
|
74 |
|
75 /** |
|
76 * Closes database connection through CMdSSqLiteConnection. |
|
77 */ |
|
78 IMPORT_C void CloseDatabase(); |
|
79 |
|
80 /** |
|
81 * Opens database connection and load blacklist. |
|
82 */ |
|
83 IMPORT_C void OpenDatabase(); |
|
84 |
|
85 private: |
|
86 |
|
87 /** |
|
88 * Constructor, called by NewL() only. |
|
89 */ |
|
90 CHarvesterBlacklist(); |
|
91 |
|
92 /** |
|
93 * Second phase constructor called by NewL. |
|
94 */ |
|
95 void ConstructL(); |
|
96 |
|
97 /** |
|
98 * Connect to blacklist client |
|
99 */ |
|
100 void ConnectToBlackListServerL(); |
|
101 |
|
102 private: // data |
|
103 |
|
104 RBlacklistClient iBlacklistClient; |
|
105 }; |
|
106 |
|
107 #endif // CHARVESTERBLACKLIST_H |