blob: a1e205b46632c7cb88c1ef2ec462cd2ea06947a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "xmlstatusreporter.h"
#include <cassert>
namespace storage {
namespace framework {
XmlStatusReporter::XmlStatusReporter(vespalib::stringref id,
vespalib::stringref name)
: StatusReporter(id, name)
{
}
XmlStatusReporter::~XmlStatusReporter()
{
}
void
XmlStatusReporter::initXmlReport(vespalib::XmlOutputStream& xos,
const HttpUrlPath&) const
{
using namespace vespalib::xml;
xos << XmlTag("status")
<< XmlAttribute("id", getId())
<< XmlAttribute("name", getName());
}
void
XmlStatusReporter::finalizeXmlReport(vespalib::XmlOutputStream& xos,
const HttpUrlPath&) const
{
using namespace vespalib::xml;
xos << XmlEndTag();
assert(xos.isFinalized());
}
vespalib::string
XmlStatusReporter::getReportContentType(const HttpUrlPath&) const
{
return "application/xml";
}
bool
XmlStatusReporter::reportStatus(std::ostream& out,
const HttpUrlPath& path) const
{
out << "<?xml version=\"1.0\"?>\n";
vespalib::XmlOutputStream xos(out);
initXmlReport(xos, path);
vespalib::stringref failure = reportXmlStatus(xos, path);
if (!failure.empty()) {
using namespace vespalib::xml;
xos << XmlContent("Failed to report XML status: " + failure);
}
finalizeXmlReport(xos, path);
return failure.empty();
}
} // framework
} // storage
|