Improved naming.

This commit is contained in:
Christian P. MOMON 2021-12-15 12:02:24 +01:00
parent 909cc17a8b
commit 614c064a24
3 changed files with 111 additions and 101 deletions

View file

@ -381,9 +381,9 @@ public class Configuration extends PathPropertyList
*
* @return the probe mode
*/
public ProbeMode getProbeMode()
public ProbePeriod getProbeMode()
{
ProbeMode result;
ProbePeriod result;
String value = get("conf.probe.mode");
@ -393,7 +393,7 @@ public class Configuration extends PathPropertyList
}
else
{
result = ProbeMode.valueOf(StringUtils.upperCase(value));
result = ProbePeriod.valueOf(StringUtils.upperCase(value));
}
//

View file

@ -21,7 +21,7 @@ package fr.devinsy.statoolinfos.core;
/**
* The Enum LogFilter.
*/
public enum ProbeMode
public enum ProbePeriod
{
FULL,
TODAY,

View file

@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Configuration;
import fr.devinsy.statoolinfos.core.Factory;
import fr.devinsy.statoolinfos.core.ProbeMode;
import fr.devinsy.statoolinfos.core.ProbePeriod;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogAnalyzer;
@ -97,6 +97,8 @@ public class Prober
System.out.println("Targets=" + types.toStringWithBrackets());
if (configuration.getProbeMode() != null)
{
PathCounters counters = new PathCounters();
//
@ -147,17 +149,17 @@ public class Prober
// Filter.
logger.info("== Filtering");
if (configuration.getProbeMode() == ProbeMode.TODAY)
if (configuration.getProbeMode() == ProbePeriod.TODAY)
{
logger.info("=== TODAY");
counters = counters.searchByPeriod(LocalDate.now(), LocalDate.now());
}
else if (configuration.getProbeMode() == ProbeMode.PREVIOUS_DAY)
else if (configuration.getProbeMode() == ProbePeriod.PREVIOUS_DAY)
{
logger.info("=== PREVIOUS_DAY");
counters = counters.searchByPeriod(LocalDate.now().minusDays(1), LocalDate.now());
}
else if (configuration.getProbeMode() == ProbeMode.PREVIOUS_DAYS_7)
else if (configuration.getProbeMode() == ProbePeriod.PREVIOUS_DAYS_7)
{
logger.info("=== PREVIOUS_WEEK");
counters = counters.searchByPeriod(LocalDate.now().minusDays(7), LocalDate.now());
@ -176,7 +178,7 @@ public class Prober
if (target.exists())
{
logger.info("ModeProbe=" + configuration.getProbeMode());
if (configuration.getProbeMode() != ProbeMode.FULL)
if (configuration.getProbeMode() != ProbePeriod.FULL)
{
// Load.
logger.info("== Reading previous target file.");
@ -188,8 +190,15 @@ public class Prober
for (PathCounter counter : counters.values())
{
PathCounter previousCounter = previousCounters.get(counter.getPath(), counter.getTimeMark());
if (previousCounter == null)
{
previousCounters.put(counter);
}
else
{
previousCounter.setCounter(counter.getCounter());
}
}
//
counters = previousCounters;
@ -207,6 +216,7 @@ public class Prober
logger.info("== Writing.");
logger.info("size={}", counters.size());
}
}
/**
* Stat.