1 /* 2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef SERVER_ICON_EXPORT_UPDATE_PROCESS_H 7 #define SERVER_ICON_EXPORT_UPDATE_PROCESS_H 8 9 10 #include "AbstractServerProcess.h" 11 #include "LocalIconStore.h" 12 #include "Model.h" 13 14 #include <File.h> 15 #include <Path.h> 16 #include <String.h> 17 #include <Url.h> 18 19 20 class ServerIconExportUpdateProcess : 21 public AbstractServerProcess, public PackageConsumer { 22 public: 23 24 ServerIconExportUpdateProcess( 25 AbstractServerProcessListener* listener, 26 const BPath& localStorageDirectoryPath, 27 Model* model, uint32 options); 28 virtual ~ServerIconExportUpdateProcess(); 29 30 const char* Name(); 31 status_t RunInternal(); 32 33 virtual bool ConsumePackage( 34 const PackageInfoRef& packageInfoRef, 35 void *context); 36 protected: 37 status_t PopulateForPkg(const PackageInfoRef& package); 38 status_t Populate(); 39 status_t DownloadAndUnpack(); 40 status_t HasLocalData(bool* result) const; 41 void GetStandardMetaDataPath(BPath& path) const; 42 void GetStandardMetaDataJsonPath( 43 BString& jsonPath) const; 44 private: 45 status_t Download(BPath& tarGzFilePath); 46 47 BPath fLocalStorageDirectoryPath; 48 Model* fModel; 49 LocalIconStore fLocalIconStore; 50 int32 fCountIconsSet; 51 52 }; 53 54 #endif // SERVER_ICON_EXPORT_UPDATE_PROCESS_H 55