xref: /haiku/src/apps/haikudepot/server/ServerReferenceDataUpdateProcess.h (revision a5e4976d39d790942b064f777d107518ea95be83)
1f85e0300SAndrew Lindesay /*
2*a5e4976dSAndrew Lindesay  * Copyright 2019-2020, Andrew Lindesay <apl@lindesay.co.nz>.
3f85e0300SAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
4f85e0300SAndrew Lindesay  */
5f85e0300SAndrew Lindesay #ifndef SERVER_REFERENCE_DATA_UPDATE_PROCESS_H
6f85e0300SAndrew Lindesay #define SERVER_REFERENCE_DATA_UPDATE_PROCESS_H
7f85e0300SAndrew Lindesay 
8f85e0300SAndrew Lindesay 
9f85e0300SAndrew Lindesay #include "AbstractSingleFileServerProcess.h"
10f85e0300SAndrew Lindesay 
11f85e0300SAndrew Lindesay #include <File.h>
12f85e0300SAndrew Lindesay #include <Path.h>
13f85e0300SAndrew Lindesay #include <String.h>
14f85e0300SAndrew Lindesay #include <Url.h>
15f85e0300SAndrew Lindesay 
16f85e0300SAndrew Lindesay #include "Model.h"
17f85e0300SAndrew Lindesay #include "PackageInfo.h"
18f85e0300SAndrew Lindesay 
19f85e0300SAndrew Lindesay 
20f85e0300SAndrew Lindesay #undef B_TRANSLATION_CONTEXT
21f85e0300SAndrew Lindesay #define B_TRANSLATION_CONTEXT "ServerReferenceDataUpdateProcess"
22f85e0300SAndrew Lindesay 
23f85e0300SAndrew Lindesay class DumpExportReference;
24f85e0300SAndrew Lindesay 
25f85e0300SAndrew Lindesay class ServerReferenceDataUpdateProcess : public AbstractSingleFileServerProcess
26f85e0300SAndrew Lindesay {
27f85e0300SAndrew Lindesay public:
28f85e0300SAndrew Lindesay 
29f85e0300SAndrew Lindesay 								ServerReferenceDataUpdateProcess(
30f85e0300SAndrew Lindesay 									Model* model, uint32 serverProcessOptions);
31f85e0300SAndrew Lindesay 	virtual						~ServerReferenceDataUpdateProcess();
32f85e0300SAndrew Lindesay 
33f85e0300SAndrew Lindesay 			const char*			Name() const;
34f85e0300SAndrew Lindesay 			const char*			Description() const;
35f85e0300SAndrew Lindesay 
36f85e0300SAndrew Lindesay protected:
37f85e0300SAndrew Lindesay 			status_t			GetStandardMetaDataPath(BPath& path) const;
38f85e0300SAndrew Lindesay 			void				GetStandardMetaDataJsonPath(
39f85e0300SAndrew Lindesay 									BString& jsonPath) const;
40f85e0300SAndrew Lindesay 
41f85e0300SAndrew Lindesay 			BString				UrlPathComponent();
42f85e0300SAndrew Lindesay 			status_t			ProcessLocalData();
43f85e0300SAndrew Lindesay 			status_t			GetLocalPath(BPath& path) const;
44f85e0300SAndrew Lindesay 
45f85e0300SAndrew Lindesay private:
46f85e0300SAndrew Lindesay 			status_t			_ProcessData(DumpExportReference* data);
47f85e0300SAndrew Lindesay 			status_t			_ProcessNaturalLanguages(
48f85e0300SAndrew Lindesay 									DumpExportReference* data);
4989b16bb4SAndrew Lindesay 			status_t			_ProcessPkgCategories(
5089b16bb4SAndrew Lindesay 									DumpExportReference* data);
51*a5e4976dSAndrew Lindesay 			status_t			_ProcessRatingStabilities(
52*a5e4976dSAndrew Lindesay 									DumpExportReference* data);
53f85e0300SAndrew Lindesay 
54f85e0300SAndrew Lindesay private:
55f85e0300SAndrew Lindesay 			Model*				fModel;
56f85e0300SAndrew Lindesay 
57f85e0300SAndrew Lindesay };
58f85e0300SAndrew Lindesay 
59f85e0300SAndrew Lindesay #endif // SERVER_REFERENCE_DATA_UPDATE_PROCESS_H
60