2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
3 * All rights reserved. Distributed under the terms of the MIT License.
6 #ifndef ABSTRACT_SERVER_PROCESS_H
7 #define ABSTRACT_SERVER_PROCESS_H
13 #include "StandardMetaData.h"
16 #define APP_ERR_NOT_MODIFIED (B_APP_ERROR_BASE + 452)
19 class AbstractServerProcess
{
21 virtual status_t
Run() = 0;
24 virtual void GetStandardMetaDataPath(
25 BPath
& path
) const = 0;
26 virtual void GetStandardMetaDataJsonPath(
27 BString
& jsonPath
) const = 0;
28 virtual const char* LoggingName() const = 0;
30 status_t
IfModifiedSinceHeaderValue(
31 BString
& headerValue
) const;
32 status_t
IfModifiedSinceHeaderValue(
34 const BPath
& metaDataPath
,
35 const BString
& jsonPath
) const;
37 status_t
PopulateMetaData(
38 StandardMetaData
& metaData
,
40 const BString
& jsonPath
) const;
42 status_t
ParseJsonFromFileWithListener(
43 BJsonEventListener
*listener
,
44 const BPath
& path
) const;
46 status_t
DownloadToLocalFile(
47 const BPath
& targetFilePath
,
49 uint32 redirects
, uint32 failures
);
51 status_t
MoveDamagedFileAside(
52 const BPath
& currentFilePath
);
55 bool LooksLikeGzip(const char *pathStr
) const;
59 #endif // ABSTRACT_SERVER_PROCESS_H