00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INCL_SYNC_SOURCE
00037 #define INCL_SYNC_SOURCE
00038
00042 #include "base/fscapi.h"
00043 #include "base/ErrorHandler.h"
00044 #include "base/util/ArrayElement.h"
00045 #include "filter/SourceFilter.h"
00046 #include "spds/constants.h"
00047 #include "spds/SyncItem.h"
00048 #include "spds/SyncStatus.h"
00049 #include "spds/SyncSourceConfig.h"
00050 #include "spds/SyncSourceReport.h"
00051
00057 class SyncSource : public ArrayElement {
00058
00059 private:
00060 SyncMode syncMode;
00061 unsigned long lastSync;
00062 unsigned long nextSync;
00063 WCHAR* name;
00064
00065 char next[DIM_ANCHOR];
00066 char last[DIM_ANCHOR];
00067
00068
00069
00070 SourceFilter* filter;
00071
00072 protected:
00073 SyncSourceConfig& config;
00074 SyncSourceReport* report;
00075
00079 void assign(SyncSource& s);
00080
00081 public:
00082
00096 SyncSource(const WCHAR* name, SyncSourceConfig* sc);
00097
00098
00099 virtual ~SyncSource();
00100
00108 const WCHAR *getName();
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00128 const SyncSourceConfig& getConfig() const {
00129 return config;
00130 }
00132 SyncSourceConfig& getConfig() {
00133 return config;
00134 }
00135
00136
00140 SyncSourceReport* getReport();
00141
00148 void setReport(SyncSourceReport* sr);
00149
00157 SyncMode getPreferredSyncMode();
00158 void setPreferredSyncMode(SyncMode syncMode);
00159
00167 SyncMode getSyncMode();
00168 void setSyncMode(SyncMode syncMode);
00169
00174 unsigned long getLastSync();
00175 void setLastSync(unsigned long timestamp);
00176
00181 unsigned long getNextSync();
00182 void setNextSync(unsigned long timestamp);
00183
00187 void setLastAnchor(const char* last);
00188 const char* getLastAnchor();
00189
00193 const char* getNextAnchor();
00194 void setNextAnchor(const char* next);
00195
00199 SourceFilter* getFilter();
00200
00207 void setFilter(SourceFilter* f);
00208
00209
00210
00211
00212
00213
00214
00215
00216
00232 virtual int beginSync();
00233
00247 virtual int endSync();
00248
00256 virtual void setItemStatus(const WCHAR* key, int status) = 0;
00257
00263 virtual SyncItem* getFirstItemKey() = 0;
00264
00270 virtual SyncItem* getNextItemKey() = 0;
00271
00277 virtual SyncItem* getFirstItem() = 0;
00278
00284 virtual SyncItem* getNextItem() = 0;
00285
00290 virtual SyncItem* getFirstNewItem() = 0;
00291
00296 virtual SyncItem* getNextNewItem() = 0;
00297
00302 virtual SyncItem* getFirstUpdatedItem() = 0;
00303
00308 virtual SyncItem* getNextUpdatedItem() = 0;
00309
00314 virtual SyncItem* getFirstDeletedItem() = 0;
00315
00320 virtual SyncItem* getNextDeletedItem() = 0;
00321
00332 virtual int addItem(SyncItem& item) = 0;
00333
00341 virtual int updateItem(SyncItem& item) = 0;
00342
00350 virtual int deleteItem(SyncItem& item) = 0;
00351
00355 virtual ArrayElement* clone() = 0;
00356 };
00357
00360 #endif