Added service uptime export feature.
This commit is contained in:
parent
c229d00a45
commit
ca6a435f28
12 changed files with 713 additions and 11 deletions
|
@ -32,6 +32,8 @@ import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
|||
import fr.devinsy.statoolinfos.io.CSVFile;
|
||||
import fr.devinsy.statoolinfos.io.JSONFile;
|
||||
import fr.devinsy.statoolinfos.io.ODSFile;
|
||||
import fr.devinsy.statoolinfos.uptime.ServiceUptimes;
|
||||
import fr.devinsy.statoolinfos.uptime.ServiceUptimesFile;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
|
@ -92,6 +94,19 @@ public class ExportsPage
|
|||
logger.error("Error during JSON export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("EXPORTS SERVICE UPTIME JOURNAL.");
|
||||
ServiceUptimes uptimes = ServiceUptimes.of(federation.getServicesAll(), HtmlizerContext.instance().getUptimeJournal());
|
||||
ServiceUptimesFile.saveCSV(new File(htmlizeDirectory, "serviceUptimeJournal.csv"), uptimes);
|
||||
ServiceUptimesFile.saveODS(new File(htmlizeDirectory, "serviceUptimeJournal.ods"), uptimes);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error during JSON export: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
<div class="center_table" style="width: 500px;">
|
||||
<div class="row exportsView">
|
||||
<div class="column">La fédération :</div>
|
||||
<div class="column"><img src="csv-icon.svg" title="CSV" style="opacity: 0"/></div>
|
||||
<div class="column"><img src="csv-icon.svg" title="CSV" style="opacity: 0;"/></div>
|
||||
<div class="column"><a href="federation.json"><img src="json-icon.svg" title="JSON"/></a></div>
|
||||
<div class="column"><img src="ods-icon.svg" title="ODS" style="opacity: 0"/></div>
|
||||
<div class="column"><img src="ods-icon.svg" title="ODS" style="opacity: 0;"/></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row exportsView">
|
||||
|
@ -35,6 +35,13 @@
|
|||
<div class="column"><a href="services.json"><img src="json-icon.svg" title="JSON"/></a></div>
|
||||
<div class="column"><a href="services.ods"><img src="ods-icon.svg" title="ODS"/></a></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row exportsView">
|
||||
<div class="column">Disponibilités services :</div>
|
||||
<div class="column"><a href="serviceUptimeJournal.csv"><img src="csv-icon.svg" title="CSV"/></a></div>
|
||||
<div class="column"><img src="json-icon.svg" title="JSON" style="opacity: 0;"/></div>
|
||||
<div class="column"><a href="serviceUptimeJournal.ods"><img src="ods-icon.svg" title="ODS"/></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
372
src/fr/devinsy/statoolinfos/htmlize/stuff/log-icon.svg
Normal file
372
src/fr/devinsy/statoolinfos/htmlize/stuff/log-icon.svg
Normal file
|
@ -0,0 +1,372 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:ooo="http://xml.openoffice.org/svg/export"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.2"
|
||||
width="182.67223mm"
|
||||
height="206.37222mm"
|
||||
viewBox="0 0 18267.223 20637.222"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
xml:space="preserve"
|
||||
id="svg109"
|
||||
sodipodi:docname="log-icon.svg"
|
||||
style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata113"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1275"
|
||||
inkscape:window-height="837"
|
||||
id="namedview111"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.2102413"
|
||||
inkscape:cx="-705.34502"
|
||||
inkscape:cy="296.65931"
|
||||
inkscape:window-x="522"
|
||||
inkscape:window-y="209"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="id5" />
|
||||
<defs
|
||||
class="ClipPathGroup"
|
||||
id="defs8">
|
||||
<clipPath
|
||||
id="presentation_clip_path"
|
||||
clipPathUnits="userSpaceOnUse">
|
||||
<rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="21000"
|
||||
height="29700"
|
||||
id="rect2" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="presentation_clip_path_shrink"
|
||||
clipPathUnits="userSpaceOnUse">
|
||||
<rect
|
||||
x="21"
|
||||
y="29"
|
||||
width="20958"
|
||||
height="29641"
|
||||
id="rect5" />
|
||||
</clipPath>
|
||||
|
||||
|
||||
|
||||
|
||||
</defs>
|
||||
<defs
|
||||
id="defs21">
|
||||
<font
|
||||
id="EmbeddedFont_1"
|
||||
horiz-adv-x="2048"
|
||||
horiz-origin-x="0"
|
||||
horiz-origin-y="0"
|
||||
vert-origin-x="45"
|
||||
vert-origin-y="90"
|
||||
vert-adv-y="90">
|
||||
<font-face
|
||||
font-family="DejaVu Sans embedded"
|
||||
units-per-em="2048"
|
||||
font-weight="bold"
|
||||
font-style="normal"
|
||||
ascent="1909"
|
||||
descent="485"
|
||||
id="font-face10" />
|
||||
<missing-glyph
|
||||
horiz-adv-x="2048"
|
||||
d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z"
|
||||
id="missing-glyph12" />
|
||||
<glyph
|
||||
unicode="S"
|
||||
horiz-adv-x="1198"
|
||||
d="M 1227,1446 L 1227,1130 C 1145,1167 1065,1194 987,1213 909,1232 835,1241 766,1241 674,1241 606,1228 562,1203 518,1178 496,1138 496,1085 496,1045 511,1014 541,992 570,969 624,950 702,934 L 866,901 C 1032,868 1150,817 1220,749 1290,681 1325,584 1325,459 1325,294 1276,172 1179,92 1081,11 932,-29 731,-29 636,-29 541,-20 446,-2 351,16 255,43 160,78 L 160,403 C 255,352 348,314 437,289 526,263 611,250 694,250 778,250 842,264 887,292 932,320 954,360 954,412 954,459 939,495 909,520 878,545 818,568 727,588 L 578,621 C 429,653 320,704 251,774 182,844 147,938 147,1057 147,1206 195,1320 291,1400 387,1480 525,1520 705,1520 787,1520 871,1514 958,1502 1045,1489 1134,1471 1227,1446 Z"
|
||||
id="glyph14" />
|
||||
<glyph
|
||||
unicode="O"
|
||||
horiz-adv-x="1554"
|
||||
d="M 870,1241 C 753,1241 662,1198 597,1111 532,1024 500,902 500,745 500,588 532,467 597,380 662,293 753,250 870,250 988,250 1079,293 1144,380 1209,467 1241,588 1241,745 1241,902 1209,1024 1144,1111 1079,1198 988,1241 870,1241 Z M 870,1520 C 1110,1520 1298,1451 1434,1314 1570,1177 1638,987 1638,745 1638,504 1570,314 1434,177 1298,40 1110,-29 870,-29 631,-29 443,40 307,177 170,314 102,504 102,745 102,987 170,1177 307,1314 443,1451 631,1520 870,1520 Z"
|
||||
id="glyph16" />
|
||||
<glyph
|
||||
unicode="D"
|
||||
horiz-adv-x="1425"
|
||||
d="M 573,1202 L 573,291 711,291 C 868,291 989,330 1072,408 1155,486 1196,599 1196,748 1196,896 1155,1009 1072,1086 989,1163 869,1202 711,1202 L 573,1202 Z M 188,1493 L 594,1493 C 821,1493 990,1477 1101,1445 1212,1412 1307,1357 1386,1280 1456,1213 1508,1135 1542,1047 1576,959 1593,859 1593,748 1593,635 1576,535 1542,447 1508,358 1456,280 1386,213 1306,136 1210,81 1098,49 986,16 818,0 594,0 L 188,0 188,1493 Z"
|
||||
id="glyph18" />
|
||||
</font>
|
||||
</defs>
|
||||
<defs
|
||||
class="TextShapeIndex"
|
||||
id="defs25">
|
||||
<g
|
||||
ooo:slide="id1"
|
||||
ooo:id-list="id3 id4 id5"
|
||||
id="g23" />
|
||||
</defs>
|
||||
<defs
|
||||
class="EmbeddedBulletChars"
|
||||
id="defs57">
|
||||
<g
|
||||
id="bullet-char-template-57356"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 580,1141 1163,571 580,0 -4,571 Z"
|
||||
id="path27"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-57354"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 8,1128 H 1137 V 0 H 8 Z"
|
||||
id="path30"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10146"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 174,0 602,739 174,1481 1456,739 Z M 1358,739 309,1346 659,739 Z"
|
||||
id="path33"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10132"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 2015,739 1276,0 H 717 l 543,543 H 174 v 393 h 1086 l -543,545 h 557 z"
|
||||
id="path36"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10007"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
|
||||
id="path39"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-10004"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 V 965 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
|
||||
id="path42"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-9679"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
|
||||
id="path45"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-8226"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
|
||||
id="path48"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-8211"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="M -4,459 H 1135 V 606 H -4 Z"
|
||||
id="path51"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="bullet-char-template-61548"
|
||||
transform="matrix(4.8828125e-4,0,0,-4.8828125e-4,0,0)">
|
||||
<path
|
||||
d="m 173,740 c 0,163 58,303 173,419 116,115 255,173 419,173 163,0 302,-58 418,-173 116,-116 174,-256 174,-419 0,-163 -58,-303 -174,-418 C 1067,206 928,148 765,148 601,148 462,206 346,322 231,437 173,577 173,740 Z"
|
||||
id="path54"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</defs>
|
||||
<defs
|
||||
class="TextEmbeddedBitmaps"
|
||||
id="defs59" />
|
||||
<g
|
||||
id="g64"
|
||||
transform="translate(-1412.889,-2061.889)">
|
||||
<g
|
||||
id="id2"
|
||||
class="Master_Slide">
|
||||
<g
|
||||
id="bg-id2"
|
||||
class="Background" />
|
||||
<g
|
||||
id="bo-id2"
|
||||
class="BackgroundObjects" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
class="SlideGroup"
|
||||
id="g107"
|
||||
transform="translate(-1412.889,-2061.889)">
|
||||
<g
|
||||
id="id1"
|
||||
class="Slide"
|
||||
clip-path="url(#presentation_clip_path)">
|
||||
<g
|
||||
class="Page"
|
||||
id="g101">
|
||||
<g
|
||||
class="com.sun.star.drawing.CustomShape"
|
||||
id="g73">
|
||||
<g
|
||||
id="id3">
|
||||
<rect
|
||||
class="BoundingBox"
|
||||
x="3080"
|
||||
y="2075"
|
||||
width="14905"
|
||||
height="20612"
|
||||
id="rect66"
|
||||
style="fill:none;stroke:none" />
|
||||
<path
|
||||
d="m 3832,2076 c -376,0 -751,375 -751,751 v 19107 c 0,375 375,751 751,751 h 13400 c 375,0 751,-376 751,-751 V 2827 c 0,-376 -376,-751 -751,-751 z"
|
||||
id="path68"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;stroke:none" />
|
||||
<path
|
||||
d="m 3832,2076 c -376,0 -751,375 -751,751 v 19107 c 0,375 375,751 751,751 h 13400 c 375,0 751,-376 751,-751 V 2827 c 0,-376 -376,-751 -751,-751 z"
|
||||
id="path70"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#3465a4" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
class="com.sun.star.drawing.CustomShape"
|
||||
id="g82">
|
||||
<g
|
||||
id="id4">
|
||||
<rect
|
||||
class="BoundingBox"
|
||||
x="3814"
|
||||
y="2882"
|
||||
width="13372"
|
||||
height="18765"
|
||||
id="rect75"
|
||||
style="fill:none;stroke:none" />
|
||||
<path
|
||||
d="m 4019,2883 c -102,0 -204,102 -204,204 v 18353 c 0,102 102,205 204,205 h 12960 c 102,0 205,-103 205,-205 V 3087 c 0,-102 -103,-204 -205,-204 z"
|
||||
id="path77"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ffffff;stroke:none" />
|
||||
<path
|
||||
d="m 4019,2883 c -102,0 -204,102 -204,204 v 18353 c 0,102 102,205 204,205 h 12960 c 102,0 205,-103 205,-205 V 3087 c 0,-102 -103,-204 -205,-204 z"
|
||||
id="path79"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#3465a4" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
class="com.sun.star.drawing.CustomShape"
|
||||
id="g99">
|
||||
<g
|
||||
id="id5">
|
||||
<rect
|
||||
class="BoundingBox"
|
||||
x="1426"
|
||||
y="9564"
|
||||
width="18242"
|
||||
height="8314"
|
||||
id="rect84"
|
||||
style="fill:none;stroke:none" />
|
||||
<path
|
||||
d="m 2356,9565 c -465,0 -929,464 -929,929 v 6452 c 0,465 464,930 929,930 h 16381 c 464,0 929,-465 929,-930 v -6452 c 0,-465 -465,-929 -929,-929 z"
|
||||
id="path86"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;stroke:none" />
|
||||
<path
|
||||
d="m 2356,9565 c -465,0 -929,464 -929,929 v 6452 c 0,465 464,930 929,930 h 16381 c 464,0 929,-465 929,-930 v -6452 c 0,-465 -465,-929 -929,-929 z"
|
||||
id="path88"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:none;stroke:#3465a4" />
|
||||
<text
|
||||
class="TextShape"
|
||||
id="text96"><tspan
|
||||
class="TextParagraph"
|
||||
font-size="6350px"
|
||||
font-weight="700"
|
||||
id="tspan94"
|
||||
style="font-weight:700;font-size:6350px;font-family:'DejaVu Sans', sans-serif"><tspan
|
||||
class="TextPosition"
|
||||
x="2927"
|
||||
y="15917"
|
||||
id="tspan92"><tspan
|
||||
id="tspan90"
|
||||
style="fill:#ffffff;stroke:none">LOG</tspan></tspan></tspan></text>
|
||||
|
||||
|
||||
<flowRoot
|
||||
xml:space="preserve"
|
||||
id="flowRoot112"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:'Bitstream Vera Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
transform="matrix(26.458333,0,0,26.458333,1412.889,2061.889)"><flowRegion
|
||||
id="flowRegion114"><rect
|
||||
id="rect116"
|
||||
width="827.62048"
|
||||
height="394.78445"
|
||||
x="-9.5128784"
|
||||
y="-561.32642" /></flowRegion><flowPara
|
||||
id="flowPara118"
|
||||
style="font-size:85.33333352px">LOG</flowPara></flowRoot><flowRoot
|
||||
xml:space="preserve"
|
||||
id="flowRoot120"
|
||||
style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;line-height:125%;letter-spacing:0px;word-spacing:0px"><flowRegion
|
||||
id="flowRegion122"><rect
|
||||
id="rect124"
|
||||
width="109.39811"
|
||||
height="214.03978"
|
||||
x="-61.833714"
|
||||
y="523.14178" /></flowRegion><flowPara
|
||||
id="flowPara126"></flowPara></flowRoot><text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:1058.33337402px;line-height:125%;font-family:'Bitstream Vera Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:26.45833206px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="3174.7534"
|
||||
y="-10776.312"
|
||||
id="text130"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan128"
|
||||
x="3174.7534"
|
||||
y="-9839.9346"
|
||||
style="stroke-width:26.45833206px"></tspan></text>
|
||||
<g
|
||||
id="g178"><g
|
||||
id="g168"><g
|
||||
id="g159"><g
|
||||
id="g151"><g
|
||||
id="g144"><flowRoot
|
||||
style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;line-height:125%;letter-spacing:0px;word-spacing:0px"
|
||||
id="flowRoot132"
|
||||
xml:space="preserve"><flowRegion
|
||||
id="flowRegion134"><rect
|
||||
y="-233.13208"
|
||||
x="-42.807953"
|
||||
height="1365.0981"
|
||||
width="965.55719"
|
||||
id="rect136" /></flowRegion><flowPara
|
||||
id="flowPara138"></flowPara></flowRoot></g></g></g></g></g></g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 13 KiB |
|
@ -42,7 +42,6 @@ public class CSVFile
|
|||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(CSVFile.class);
|
||||
|
||||
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
|
||||
public static final int MAX_LINE_SIZE = 4096;
|
||||
public static final String SEPARATOR = ";";
|
||||
|
||||
|
|
|
@ -46,8 +46,6 @@ public class JSONFile
|
|||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(JSONFile.class);
|
||||
|
||||
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
|
||||
|
||||
/**
|
||||
* Escape.
|
||||
*
|
||||
|
|
55
src/fr/devinsy/statoolinfos/uptime/ServiceUptime.java
Normal file
55
src/fr/devinsy/statoolinfos/uptime/ServiceUptime.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.uptime;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
|
||||
/**
|
||||
* The Class ServiceUptime.
|
||||
*/
|
||||
public class ServiceUptime extends Uptime
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceUptime.class);
|
||||
|
||||
private Service service;
|
||||
|
||||
/**
|
||||
* Instantiates a new service uptime.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @param uptime
|
||||
* the uptime
|
||||
*/
|
||||
public ServiceUptime(final Service service, final Uptime uptime)
|
||||
{
|
||||
// final URL url, final LocalDateTime datetime, final UptimeStatus
|
||||
// status, final int code
|
||||
super(uptime.getURL(), uptime.getDateTime(), uptime.getStatus(), uptime.getCode());
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Service getService()
|
||||
{
|
||||
return this.service;
|
||||
}
|
||||
}
|
129
src/fr/devinsy/statoolinfos/uptime/ServiceUptimes.java
Normal file
129
src/fr/devinsy/statoolinfos/uptime/ServiceUptimes.java
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.uptime;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
* The Class ServiceUptimes.
|
||||
*/
|
||||
public class ServiceUptimes extends ArrayList<ServiceUptime>
|
||||
{
|
||||
private static final long serialVersionUID = -4077776702697960767L;
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceUptimes.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new service uptimes.
|
||||
*/
|
||||
public ServiceUptimes()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param serviceName
|
||||
* the service name
|
||||
* @param organizationName
|
||||
* the organization name
|
||||
* @param uptime
|
||||
* the uptime
|
||||
*/
|
||||
public void add(final Service service, final Uptime uptime)
|
||||
{
|
||||
ServiceUptime target = new ServiceUptime(service, uptime);
|
||||
add(target);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.ArrayList#add(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final ServiceUptime uptime)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (uptime == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = super.add(uptime);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To time list.
|
||||
*
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList toTimeList()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
for (Uptime uptime : this)
|
||||
{
|
||||
String line = String.format("%s %s %s %03d %s", uptime.getDateTime().format(DateTimeFormatter.ofPattern("HH:mm")), uptime.getCode(), uptime.getStatus().name());
|
||||
result.append(line);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Of.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @param journal
|
||||
* the journal
|
||||
* @return the service uptimes
|
||||
*/
|
||||
public static ServiceUptimes of(final Services services, final UptimeJournal journal)
|
||||
{
|
||||
ServiceUptimes result;
|
||||
|
||||
result = new ServiceUptimes();
|
||||
|
||||
for (Service service : services)
|
||||
{
|
||||
for (Uptime uptime : journal.getUptimes(service.getWebsiteURL()))
|
||||
{
|
||||
result.add(service, uptime);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
127
src/fr/devinsy/statoolinfos/uptime/ServiceUptimesFile.java
Normal file
127
src/fr/devinsy/statoolinfos/uptime/ServiceUptimesFile.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.uptime;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.io.CSVWriter;
|
||||
import fr.devinsy.statoolinfos.io.ODSWriter;
|
||||
import fr.devinsy.statoolinfos.io.SpreadsheetWriter;
|
||||
|
||||
/**
|
||||
* The Class ServiceUptimesFile.
|
||||
*/
|
||||
public class ServiceUptimesFile
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ServiceUptimesFile.class);
|
||||
|
||||
/**
|
||||
* Save CSV.
|
||||
*
|
||||
* @param file
|
||||
* the file
|
||||
* @param source
|
||||
* the source
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void saveCSV(final File file, final ServiceUptimes source) throws IOException
|
||||
{
|
||||
CSVWriter out = null;
|
||||
try
|
||||
{
|
||||
out = new CSVWriter(file, ';');
|
||||
write(out, source);
|
||||
}
|
||||
finally
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save ODS.
|
||||
*
|
||||
* @param file
|
||||
* the file
|
||||
* @param source
|
||||
* the source
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void saveODS(final File file, final ServiceUptimes source) throws IOException
|
||||
{
|
||||
ODSWriter out = null;
|
||||
try
|
||||
{
|
||||
out = new ODSWriter(file);
|
||||
write(out, source);
|
||||
}
|
||||
finally
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write.
|
||||
*
|
||||
* @param out
|
||||
* the out
|
||||
* @param organizations
|
||||
* the organizations
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void write(final SpreadsheetWriter out, final ServiceUptimes uptimes) throws IOException
|
||||
{
|
||||
// Write label line.
|
||||
out.writeCell("serviceName");
|
||||
out.writeCell("organizationName");
|
||||
out.writeCell("DateTime");
|
||||
out.writeCell("Status");
|
||||
out.writeCell("Code");
|
||||
out.writeCell("URL");
|
||||
out.writeEndRow();
|
||||
|
||||
// Write organization lines.
|
||||
for (ServiceUptime uptime : uptimes)
|
||||
{
|
||||
out.writeCell(uptime.getService().getName());
|
||||
out.writeCell(uptime.getService().getOrganization().getName());
|
||||
out.writeCell(uptime.getDateTime().toString());
|
||||
out.writeCell(uptime.getStatus().toString());
|
||||
out.writeCell(String.valueOf(uptime.getCode()));
|
||||
if (uptime.getURL() == null)
|
||||
{
|
||||
out.writeCell("");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.writeCell(uptime.getURL().toString());
|
||||
}
|
||||
|
||||
out.writeEndRow();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -87,7 +87,7 @@ public class Uptime
|
|||
return this.status;
|
||||
}
|
||||
|
||||
public URL getUrl()
|
||||
public URL getURL()
|
||||
{
|
||||
return this.url;
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ public class UptimeJournal
|
|||
{
|
||||
if (uptime != null)
|
||||
{
|
||||
Uptimes uptimes = this.map.get(uptime.getUrl().toString());
|
||||
Uptimes uptimes = this.map.get(uptime.getURL().toString());
|
||||
|
||||
if (uptimes == null)
|
||||
{
|
||||
uptimes = new Uptimes();
|
||||
this.map.put(uptime.getUrl().toString(), uptimes);
|
||||
this.map.put(uptime.getURL().toString(), uptimes);
|
||||
}
|
||||
|
||||
uptimes.add(uptime);
|
||||
|
|
|
@ -223,7 +223,7 @@ public class UptimeJournalFile
|
|||
{
|
||||
for (Uptime uptime : journal.getUptimesAll())
|
||||
{
|
||||
String line = String.format("%s %s %d %s", uptime.getDateTime().toString(), uptime.getStatus(), uptime.getCode(), uptime.getUrl());
|
||||
String line = String.format("%s %s %d %s", uptime.getDateTime().toString(), uptime.getStatus(), uptime.getCode(), uptime.getURL());
|
||||
out.write(line);
|
||||
out.write("\n");
|
||||
}
|
||||
|
|
|
@ -138,9 +138,9 @@ public class UptimeSurveyor
|
|||
System.out.println("Survey of " + result.size());
|
||||
for (Uptime uptime : result)
|
||||
{
|
||||
int code = survey(uptime.getUrl());
|
||||
int code = survey(uptime.getURL());
|
||||
uptime.update(code);
|
||||
System.out.println("Uptime: " + uptime.getStatus().toString() + " " + uptime.getUrl().toString());
|
||||
System.out.println("Uptime: " + uptime.getStatus().toString() + " " + uptime.getURL().toString());
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue