Commit 20adaba1 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Formatting, added new stat types.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6418 b35dd754-fafc-0310-a699-88a17e54d16e
parent d5ae7f42
...@@ -8,57 +8,86 @@ ...@@ -8,57 +8,86 @@
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
*/ */
package org.jivesoftware.wildfire.stats; package org.jivesoftware.wildfire.stats;
/** /**
* A statistic being tracked by the server * A statistic being tracked by the server.
*
* @see StatisticsManager
*/ */
public interface Statistic { public interface Statistic {
/** /**
* Returns the name of a stat. * Returns the name of a stat.
* *
* @return Returns the name of a stat. * @return the name of a stat.
*/ */
public String getName(); public String getName();
/** /**
* Returns the type of a stat. * Returns the type of a stat.
* *
* @return Returns the type of a stat. * @return the type of a stat.
*/ */
public Type getStatType(); public Type getStatType();
/** /**
* Returns a description of the stat. * Returns a description of the stat.
* *
* @return Returns a description of the stat. * @return a description of the stat.
*/ */
public String getDescription(); public String getDescription();
/** /**
* Returns the units that relate to the stat. * Returns the units that relate to the stat.
* *
* @return Returns the units that relate to the stat. * @return the name of the units that relate to the stat.
*/ */
public String getUnits(); public String getUnits();
/** /**
* @return Returns the sample of data. * Returns the current sample of data.
*
* @return a sample of the data.
*/ */
public double sample(); public double sample();
/**
* The type of statistic.
*/
public enum Type { public enum Type {
/** /**
* Specifies a rate over time. * The average rate over time. For example, the averave kb/s in bandwidth used for
* For example, the averave of kb/s in file transfers. * file transfers. Each time the {@link Statistic#sample()} method is invoked, it should
* return the "amount" of data recorded since the last invocation.
*/ */
rate, rate,
/**
* The total rate over time. For example, the number of users created. Each time the
* {@link Statistic#sample()} method is invoked, it should return the "amount" of data
* recorded since the last invocation. The values will be totalled over the relevant
* time interval (by minute, hourly, daily, etc.).
*/
rate_total,
/**
* The average count over a time period. An example would be the
* number of users in multi-user chats. Each time the {@link Statistic#sample()}
* method is invoked, it should return the current measurement of the data, irrelevant of
* previous reads of the data.
*/
count,
/** /**
* Specifies a count at a specific time period. An example would be the * The max count over a time period. An example would be the maximum number of users
* number of users in MultiUserChat at this second. * connected to the server. Each time the {@link Statistic#sample()}
* method is invoked, it should return the current measurement of the data, irrelevant of
* previous reads of the data. The max value read will be stored for each time interval
* (by minute, hourly, daily, etc.).
*/ */
count count_max
} }
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
*/ */
package org.jivesoftware.wildfire.stats; package org.jivesoftware.wildfire.stats;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
...@@ -18,6 +19,7 @@ import org.jivesoftware.util.LocaleUtils; ...@@ -18,6 +19,7 @@ import org.jivesoftware.util.LocaleUtils;
* @author Alexander Wenckus * @author Alexander Wenckus
*/ */
public abstract class i18nStatistic implements Statistic { public abstract class i18nStatistic implements Statistic {
private String resourceKey; private String resourceKey;
private String pluginName; private String pluginName;
private Type statisticType; private Type statisticType;
...@@ -50,7 +52,7 @@ public abstract class i18nStatistic implements Statistic { ...@@ -50,7 +52,7 @@ public abstract class i18nStatistic implements Statistic {
private String retrieveValue(String key) { private String retrieveValue(String key) {
String wholeKey = "stat." + resourceKey + "." + key; String wholeKey = "stat." + resourceKey + "." + key;
if(pluginName != null) { if (pluginName != null) {
return LocaleUtils.getLocalizedString(wholeKey, pluginName); return LocaleUtils.getLocalizedString(wholeKey, pluginName);
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment