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
00109 StringBuffer formatMetadata(const WCHAR* key);
00110
00111 private:
00112
00114 bool recursive;
00115
00116
00117 FileSyncSource(const FileSyncSource& s) : CacheSyncSource(s){};
00118 FileSyncSource& operator=(const FileSyncSource& s) { return *this; };
00119
00120
00133 bool scanFolder(const StringBuffer& fullPath, ArrayList& filesFound, bool applyFiltering = true);
00134
00135
00136 public:
00137
00138 FileSyncSource(const WCHAR* name, AbstractSyncSourceConfig* sc,
00139 const StringBuffer& aDir = DEFAULT_SYNC_DIR,
00140 KeyValueStore* cache = NULL);
00141
00142 virtual ~FileSyncSource();
00143
00144 void assign(FileSyncSource& s);
00145
00149 void setDir(const char* p) { dir = p; }
00150 const StringBuffer& getDir() { return dir; };
00151
00155 void setRecursive(const bool value) { recursive = value; }
00156 const bool getRecursive() { return recursive; };
00157
00158
00163 virtual Enumeration* getAllItemList();
00164
00170 virtual int removeAllItems();
00171
00182 virtual int insertItem(SyncItem& item);
00183
00191 virtual int modifyItem(SyncItem& item);
00192
00200 virtual int removeItem(SyncItem& item);
00201
00213 SyncItem* fillSyncItem(StringBuffer* key, const bool fillData = true);
00214
00220 virtual void* getItemContent(StringBuffer& key, size_t* size);
00221
00222 };
00223
00224 END_NAMESPACE
00225
00228 #endif
00229