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_FILE_SYNC_SOURCE
00037 #define INCL_FILE_SYNC_SOURCE
00038
00042 #include "base/fscapi.h"
00043 #include "spds/constants.h"
00044 #include "spds/SyncItem.h"
00045 #include "spds/SyncMap.h"
00046 #include "spds/SyncStatus.h"
00047 #include "base/util/ItemContainer.h"
00048 #include "spds/FileData.h"
00049 #include "client/CacheSyncSource.h"
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 BEGIN_NAMESPACE
00063
00064
00065 #define OMA_MIME_TYPE "application/vnd.omads-file+xml"
00066
00067 #define DEFAULT_SYNC_DIR "."
00068
00082 class FileSyncSource : public CacheSyncSource {
00083
00084 protected:
00085 StringBuffer dir;
00086
00101 virtual bool filterOutgoingItem(const StringBuffer& fullName, struct stat& st);
00102
00103
00104 private:
00105
00107 bool recursive;
00108
00109
00110 FileSyncSource(const FileSyncSource& s) : CacheSyncSource(s){};
00111 FileSyncSource& operator=(const FileSyncSource& s) { return *this; };
00112
00113
00126 bool scanFolder(const StringBuffer& fullPath, ArrayList& filesFound, bool applyFiltering = true);
00127
00128
00129 public:
00130
00131 FileSyncSource(const WCHAR* name, AbstractSyncSourceConfig* sc,
00132 const StringBuffer& aDir = DEFAULT_SYNC_DIR,
00133 KeyValueStore* cache = NULL);
00134
00135 virtual ~FileSyncSource();
00136
00137 void assign(FileSyncSource& s);
00138
00142 void setDir(const char* p) { dir = p; }
00143 const StringBuffer& getDir() { return dir; };
00144
00148 void setRecursive(const bool value) { recursive = value; }
00149 const bool getRecursive() { return recursive; };
00150
00151
00156 virtual Enumeration* getAllItemList();
00157
00163 virtual int removeAllItems();
00164
00175 virtual int insertItem(SyncItem& item);
00176
00184 virtual int modifyItem(SyncItem& item);
00185
00193 virtual int removeItem(SyncItem& item);
00194
00206 SyncItem* fillSyncItem(StringBuffer* key, const bool fillData = true);
00207
00213 virtual void* getItemContent(StringBuffer& key, size_t* size);
00214
00215 };
00216
00217 END_NAMESPACE
00218
00221 #endif
00222