xref: /haiku/src/apps/haikudepot/server/ServerPkgDataUpdateProcess.h (revision 43e19c4715ad564c19cf947985e7151904e88cce)
1*3369e03dSAndrew Lindesay /*
2*3369e03dSAndrew Lindesay  * Copyright 2017-2018, Andrew Lindesay <apl@lindesay.co.nz>.
3*3369e03dSAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
4*3369e03dSAndrew Lindesay  */
5*3369e03dSAndrew Lindesay #ifndef PACKAGE_DATA_UPDATE_PROCESS_H
6*3369e03dSAndrew Lindesay #define PACKAGE_DATA_UPDATE_PROCESS_H
7*3369e03dSAndrew Lindesay 
8*3369e03dSAndrew Lindesay 
9*3369e03dSAndrew Lindesay #include "AbstractSingleFileServerProcess.h"
10*3369e03dSAndrew Lindesay 
11*3369e03dSAndrew Lindesay #include <File.h>
12*3369e03dSAndrew Lindesay #include <Path.h>
13*3369e03dSAndrew Lindesay #include <String.h>
14*3369e03dSAndrew Lindesay #include <Url.h>
15*3369e03dSAndrew Lindesay 
16*3369e03dSAndrew Lindesay #include "Model.h"
17*3369e03dSAndrew Lindesay #include "PackageInfo.h"
18*3369e03dSAndrew Lindesay 
19*3369e03dSAndrew Lindesay 
20*3369e03dSAndrew Lindesay class ServerPkgDataUpdateProcess : public AbstractSingleFileServerProcess {
21*3369e03dSAndrew Lindesay public:
22*3369e03dSAndrew Lindesay 								ServerPkgDataUpdateProcess(
23*3369e03dSAndrew Lindesay 									BString depotName,
24*3369e03dSAndrew Lindesay 									Model *model,
25*3369e03dSAndrew Lindesay 									uint32 serverProcessOptions);
26*3369e03dSAndrew Lindesay 	virtual						~ServerPkgDataUpdateProcess();
27*3369e03dSAndrew Lindesay 
28*3369e03dSAndrew Lindesay 			const char*			Name() const;
29*3369e03dSAndrew Lindesay 			const char*			Description() const;
30*3369e03dSAndrew Lindesay 
31*3369e03dSAndrew Lindesay protected:
32*3369e03dSAndrew Lindesay 	virtual status_t			RunInternal();
33*3369e03dSAndrew Lindesay 
34*3369e03dSAndrew Lindesay 			status_t			GetStandardMetaDataPath(BPath& path) const;
35*3369e03dSAndrew Lindesay 			void				GetStandardMetaDataJsonPath(
36*3369e03dSAndrew Lindesay 									BString& jsonPath) const;
37*3369e03dSAndrew Lindesay 
38*3369e03dSAndrew Lindesay 			BString				UrlPathComponent();
39*3369e03dSAndrew Lindesay 			status_t			ProcessLocalData();
40*3369e03dSAndrew Lindesay 			status_t			GetLocalPath(BPath& path) const;
41*3369e03dSAndrew Lindesay 
42*3369e03dSAndrew Lindesay private:
43*3369e03dSAndrew Lindesay 			BString				_DeriveWebAppRepositorySourceCode() const;
44*3369e03dSAndrew Lindesay 
45*3369e03dSAndrew Lindesay 			Model*				fModel;
46*3369e03dSAndrew Lindesay 			BString				fDepotName;
47*3369e03dSAndrew Lindesay 			BString				fName;
48*3369e03dSAndrew Lindesay 			BString				fDescription;
49*3369e03dSAndrew Lindesay 
50*3369e03dSAndrew Lindesay };
51*3369e03dSAndrew Lindesay 
52*3369e03dSAndrew Lindesay #endif // PACKAGE_DATA_UPDATE_PROCESS_H
53