Compare commits
9 commits
05286c26ff
...
e4236d26c3
Author | SHA1 | Date | |
---|---|---|---|
e4236d26c3 | |||
1ec26ffec8 | |||
8af034256d | |||
dd7a1054b0 | |||
4394acec56 | |||
d8f66e3d66 | |||
b20071bb63 | |||
33c585d4ca | |||
073ae817e4 |
15 changed files with 152 additions and 12 deletions
|
@ -4,7 +4,7 @@
|
||||||
javaCheck=`which java`
|
javaCheck=`which java`
|
||||||
if [[ "$javaCheck" =~ ^/.* ]]; then
|
if [[ "$javaCheck" =~ ^/.* ]]; then
|
||||||
#echo "Java requirement............... OK"
|
#echo "Java requirement............... OK"
|
||||||
java -jar "$(dirname "$0")"/statoolinfos.jar $@
|
java -Djava.awt.headless=true -jar "$(dirname "$0")"/statoolinfos.jar $@
|
||||||
else
|
else
|
||||||
echo "Java requirement............... MISSING"
|
echo "Java requirement............... MISSING"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -36,10 +36,12 @@ import fr.devinsy.strings.StringsUtils;
|
||||||
public class PropertyChecker
|
public class PropertyChecker
|
||||||
{
|
{
|
||||||
public static final String ALL = "^.*$";
|
public static final String ALL = "^.*$";
|
||||||
|
public static final String BOM = "\ufeff";
|
||||||
|
public static final String COMMENT = "^#.*$";
|
||||||
public static final String STRING = "^.+$";
|
public static final String STRING = "^.+$";
|
||||||
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
|
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
|
||||||
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
|
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
|
||||||
public static final String URL = "^(http(s)?://)?[\\w-_\\.]+(\\.\\w+)+(/.*)?$";
|
public static final String URL = "^(http(s)?://)?[\\w-_\\.]+(\\.\\w+)+(:\\d+)?(/.*)?$";
|
||||||
public static final String EMAIL = "^.*@.*$";
|
public static final String EMAIL = "^.*@.*$";
|
||||||
public static final String NUMERIC = "^\\d+$";
|
public static final String NUMERIC = "^\\d+$";
|
||||||
public static final String NUMERICS = "^\\d*(,\\d*)*$";
|
public static final String NUMERICS = "^\\d*(,\\d*)*$";
|
||||||
|
@ -227,6 +229,13 @@ public class PropertyChecker
|
||||||
|
|
||||||
result = new PropertyChecks();
|
result = new PropertyChecks();
|
||||||
|
|
||||||
|
//
|
||||||
|
if ((lines != null) && (!lines.isEmpty()) && (lines.get(0).startsWith(BOM)))
|
||||||
|
{
|
||||||
|
String line = lines.get(0).substring(1);
|
||||||
|
lines.set(0, line);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
PropertyRules requiredRules = rules.getMandatories();
|
PropertyRules requiredRules = rules.getMandatories();
|
||||||
requiredRules.addAll(rules.getWished());
|
requiredRules.addAll(rules.getWished());
|
||||||
|
@ -281,7 +290,7 @@ public class PropertyChecker
|
||||||
check = new PropertyCheck(lineIndex, "", Status.OK);
|
check = new PropertyCheck(lineIndex, "", Status.OK);
|
||||||
check.setComment("OK");
|
check.setComment("OK");
|
||||||
}
|
}
|
||||||
else if ((StringUtils.isEmpty(line)) || (line.matches("^#.*$")))
|
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
|
||||||
{
|
{
|
||||||
check = new PropertyCheck(lineIndex, line, Status.OK);
|
check = new PropertyCheck(lineIndex, line, Status.OK);
|
||||||
check.setComment("OK");
|
check.setComment("OK");
|
||||||
|
|
|
@ -501,6 +501,35 @@ public class Federation extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL active all.
|
||||||
|
*
|
||||||
|
* @return the URL active all
|
||||||
|
*/
|
||||||
|
public URLSet getURLActiveAll()
|
||||||
|
{
|
||||||
|
URLSet result;
|
||||||
|
|
||||||
|
result = new URLSet();
|
||||||
|
|
||||||
|
//
|
||||||
|
result.add(getContactURL());
|
||||||
|
result.add(getLegalURL());
|
||||||
|
result.add(getLogoURL());
|
||||||
|
result.add(getTechnicalGuideURL());
|
||||||
|
result.add(getUserGuideURL());
|
||||||
|
result.add(getWebsiteURL());
|
||||||
|
|
||||||
|
//
|
||||||
|
for (Organization organization : getOrganizations())
|
||||||
|
{
|
||||||
|
result.addAll(organization.getURLActiveAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL all.
|
* Gets the URL all.
|
||||||
*
|
*
|
||||||
|
|
|
@ -616,6 +616,21 @@ public class Organization extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the service active count.
|
||||||
|
*
|
||||||
|
* @return the service active count
|
||||||
|
*/
|
||||||
|
public int getServiceActiveCount()
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = this.services.getBy(Service.Status.OK).size();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the service count.
|
* Gets the service count.
|
||||||
*
|
*
|
||||||
|
@ -683,6 +698,34 @@ public class Organization extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL all.
|
||||||
|
*
|
||||||
|
* @return the URL all
|
||||||
|
*/
|
||||||
|
public URLSet getURLActiveAll()
|
||||||
|
{
|
||||||
|
URLSet result;
|
||||||
|
|
||||||
|
result = new URLSet();
|
||||||
|
|
||||||
|
result.add(getContactURL());
|
||||||
|
result.add(getLegalURL());
|
||||||
|
result.add(getLogoURL());
|
||||||
|
result.add(getTechnicalGuideURL());
|
||||||
|
result.add(getUserGuideURL());
|
||||||
|
result.add(getWebsiteURL());
|
||||||
|
|
||||||
|
//
|
||||||
|
for (Service service : getServices().getBy(Service.Status.OK))
|
||||||
|
{
|
||||||
|
result.addAll(service.getURLAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL all.
|
* Gets the URL all.
|
||||||
*
|
*
|
||||||
|
|
|
@ -84,6 +84,25 @@ public class Organizations extends ArrayList<Organization>
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the service active count.
|
||||||
|
*
|
||||||
|
* @return the service active count
|
||||||
|
*/
|
||||||
|
public int getServiceActiveCount()
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
for (Organization organization : this)
|
||||||
|
{
|
||||||
|
result += organization.getServiceCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the service count.
|
* Gets the service count.
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import fr.devinsy.statoolinfos.core.Service.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class Services.
|
* The Class Services.
|
||||||
*/
|
*/
|
||||||
|
@ -90,6 +92,31 @@ public class Services extends ArrayList<Service>
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the by.
|
||||||
|
*
|
||||||
|
* @param status
|
||||||
|
* the category
|
||||||
|
* @return the by
|
||||||
|
*/
|
||||||
|
public Services getBy(final Status status)
|
||||||
|
{
|
||||||
|
Services result;
|
||||||
|
|
||||||
|
result = new Services();
|
||||||
|
|
||||||
|
for (Service service : this)
|
||||||
|
{
|
||||||
|
if (service.getStatus() == status)
|
||||||
|
{
|
||||||
|
result.add(service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse.
|
* Reverse.
|
||||||
*
|
*
|
||||||
|
|
|
@ -547,7 +547,7 @@ public class StatoolInfos
|
||||||
|
|
||||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||||
Federation federation = HtmlizerContext.instance().getFederation();
|
Federation federation = HtmlizerContext.instance().getFederation();
|
||||||
UptimeSurveyor.survey(journal, federation.getURLAll());
|
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
|
||||||
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
|
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ExportsPage
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.error("Error during JSON export: " + exception.getMessage(), exception);
|
logger.error("Error during ODS export: " + exception.getMessage(), exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -104,7 +104,7 @@ public class ExportsPage
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.error("Error during JSON export: " + exception.getMessage(), exception);
|
logger.error("Error during Uptime export: " + exception.getMessage(), exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class OrganizationListView
|
||||||
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
|
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
|
||||||
data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
|
data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
|
||||||
}
|
}
|
||||||
data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceCount());
|
data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceActiveCount());
|
||||||
data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount());
|
data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount());
|
||||||
data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount());
|
data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount());
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class UptimeView
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Service service : services.sortByName())
|
for (Service service : services.getBy(Service.Status.OK).sortByName())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
data.setAttribute("line", index, "lineLogo", "src", service.getLogoFileName());
|
data.setAttribute("line", index, "lineLogo", "src", service.getLogoFileName());
|
||||||
|
|
|
@ -29,8 +29,10 @@
|
||||||
<li>Fabrice61</li>
|
<li>Fabrice61</li>
|
||||||
<li>Thomas @TConstans</li>
|
<li>Thomas @TConstans</li>
|
||||||
<li>@labecasse</li>
|
<li>@labecasse</li>
|
||||||
|
<li>Antoine Jaba</li>
|
||||||
<li>@setop</li>
|
<li>@setop</li>
|
||||||
<li>Jérémy Collot</li>
|
<li>Jérémy Collot</li>
|
||||||
|
<li>Pilou</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
Checks
|
Checks
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="registration _infos" style="margin: 5px;">
|
<div class="registration_infos" style="margin: 5px;">
|
||||||
Logiciel :
|
Logiciel :
|
||||||
<span id="softwareName">n/a</span>, version <span id="softwareVersion">n/a</span>, licence <span id="softwareLicenseName">n/a</span>  
|
<span id="softwareName">n/a</span>, version <span id="softwareVersion">n/a</span>, licence <span id="softwareLicenseName">n/a</span>  
|
||||||
<a id="softwareWebsiteLink" href="#"><img id="softwareWebsiteLinkImg" src="circle-icons/cruise.svg" class="disabled" title="Site web"/></a>
|
<a id="softwareWebsiteLink" href="#"><img id="softwareWebsiteLinkImg" src="circle-icons/cruise.svg" class="disabled" title="Site web"/></a>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
<div class="uptimeCounts">
|
<div class="uptimeCounts">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Actuellement : </li>
|
||||||
<li><img src="status-ok.png" title="" /><span id="okCount">n/a</span></li>
|
<li><img src="status-ok.png" title="" /><span id="okCount">n/a</span></li>
|
||||||
<li><img src="status-warning.png" title="" /><span id="warningCount">n/a</span></li>
|
<li><img src="status-warning.png" title="" /><span id="warningCount">n/a</span></li>
|
||||||
<li><img src="status-alert.png" title="" /><span id="alertCount">n/a</span></li>
|
<li><img src="status-alert.png" title="" /><span id="alertCount">n/a</span></li>
|
||||||
|
|
|
@ -60,7 +60,10 @@ public class ODSFile
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
out.close();
|
if (out != null)
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +85,10 @@ public class ODSFile
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
out.close();
|
if (out != null)
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,11 +206,15 @@ public class UptimeJournal
|
||||||
|
|
||||||
if (url == null)
|
if (url == null)
|
||||||
{
|
{
|
||||||
result = null;
|
result = new Uptimes();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = this.map.get(url.toString());
|
result = this.map.get(url.toString());
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
result = new Uptimes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue