Made Javadoc review.
This commit is contained in:
parent
506c40cdc1
commit
01f91407f1
5 changed files with 323 additions and 8 deletions
|
@ -396,8 +396,8 @@ public class PathCounters extends HashMap<String, PathCounter>
|
|||
/**
|
||||
* Search by date.
|
||||
*
|
||||
* @param day
|
||||
* the day
|
||||
* @param date
|
||||
* the date
|
||||
* @return the path counters
|
||||
*/
|
||||
public PathCounters searchByDate(final LocalDate date)
|
||||
|
|
|
@ -173,10 +173,10 @@ public class HttpAccessLogAnalyzer
|
|||
}
|
||||
|
||||
/**
|
||||
* Probe line.
|
||||
* Probe log.
|
||||
*
|
||||
* @param line
|
||||
* the line
|
||||
* @param log
|
||||
* the log
|
||||
*/
|
||||
public void probeLog(final HttpAccessLog log)
|
||||
{
|
||||
|
|
|
@ -127,10 +127,10 @@ public class HttpErrorLogAnalyzer
|
|||
}
|
||||
|
||||
/**
|
||||
* Probe line.
|
||||
* Probe log.
|
||||
*
|
||||
* @param line
|
||||
* the line
|
||||
* @param log
|
||||
* the log
|
||||
*/
|
||||
public void probeLog(final HttpErrorLog log)
|
||||
{
|
||||
|
|
273
src/fr/devinsy/statoolinfos/properties/MetricDirectory.java
Normal file
273
src/fr/devinsy/statoolinfos/properties/MetricDirectory.java
Normal file
|
@ -0,0 +1,273 @@
|
|||
/*
|
||||
* 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.properties;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.strings.StringSet;
|
||||
|
||||
/**
|
||||
* The Class PathPropertyDirectory.
|
||||
*/
|
||||
public class MetricDirectory
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(MetricDirectory.class);
|
||||
|
||||
private Hashtable<String, String> data;
|
||||
|
||||
/**
|
||||
* Instantiates a new path property set.
|
||||
*/
|
||||
public MetricDirectory()
|
||||
{
|
||||
this.data = new Hashtable<String, String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new path property set.
|
||||
*
|
||||
* @param initialCapacity
|
||||
* the initial capacity
|
||||
*/
|
||||
public MetricDirectory(final int initialCapacity)
|
||||
{
|
||||
this.data = new Hashtable<String, String>(initialCapacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new path properties.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public MetricDirectory(final MetricDirectory source)
|
||||
{
|
||||
this.data = new Hashtable<String, String>(source.size());
|
||||
for (String path : source.getPaths())
|
||||
{
|
||||
this.data.put(path, source.get(path));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void add(final String key, final String value)
|
||||
{
|
||||
this.data.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the.
|
||||
*
|
||||
* @param path
|
||||
* the path
|
||||
* @return the string
|
||||
*/
|
||||
public String get(final String path)
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.data.get(path);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the keys.
|
||||
*
|
||||
* @return the keys
|
||||
*/
|
||||
public StringList getPaths()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
|
||||
for (Object key : this.data.keySet())
|
||||
{
|
||||
result.add((String) key);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prefixes.
|
||||
*
|
||||
* @return the prefixes
|
||||
*/
|
||||
public StringSet getPrefixes()
|
||||
{
|
||||
StringSet result;
|
||||
|
||||
result = new StringSet();
|
||||
|
||||
for (Object key : this.data.keySet())
|
||||
{
|
||||
result.add(getPrefix((String) key));
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prefix list.
|
||||
*
|
||||
* @return the prefix list
|
||||
*/
|
||||
public StringList getPrefixList()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
|
||||
for (Object key : this.data.keySet())
|
||||
{
|
||||
result.add(getPrefix((String) key));
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public void put(final String key, final String value)
|
||||
{
|
||||
this.data.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the path.
|
||||
*
|
||||
* @param path
|
||||
* the path
|
||||
* @return the string
|
||||
*/
|
||||
public String removePath(final String path)
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.data.remove(path);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Size.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int size()
|
||||
{
|
||||
int result;
|
||||
|
||||
result = this.data.size();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string list.
|
||||
*
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList toStringList()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
|
||||
for (String path : getPaths())
|
||||
{
|
||||
String value = get(path);
|
||||
result.add(path + "=" + value);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string list formatted.
|
||||
*
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList toStringListFormatted()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
StringList lines = toStringList();
|
||||
|
||||
StringList prefixes = getPrefixList();
|
||||
|
||||
// sort prefixes.
|
||||
for (String prefix : prefixes)
|
||||
{
|
||||
result.add("# [" + prefix + "]");
|
||||
|
||||
StringList sectionLines = lines.filter("^" + prefix + "\\..*");
|
||||
result.addAll(sectionLines);
|
||||
|
||||
result.add("");
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prefix.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return the prefix
|
||||
*/
|
||||
private static String getPrefix(final String source)
|
||||
{
|
||||
String result;
|
||||
|
||||
result = source.substring(source.indexOf("."));
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
42
src/fr/devinsy/statoolinfos/properties/MetricSpecs.java
Normal file
42
src/fr/devinsy/statoolinfos/properties/MetricSpecs.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Category;
|
||||
|
||||
/**
|
||||
* The Class PathPropertySpecs.
|
||||
*/
|
||||
public class MetricSpecs
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
GENERIC,
|
||||
HTTP,
|
||||
SPECIFIC
|
||||
}
|
||||
|
||||
private String prefix;
|
||||
private String name;
|
||||
private String description;
|
||||
private boolean cumulative;
|
||||
private Category category;
|
||||
}
|
Loading…
Reference in a new issue