001: package com.jamonapi;
002:
003: /**
004: * Interface used to create Monitors. It is implemented by both FactoryEnabled and FactoryDisabled
005: * which allows for enabling/disabling monitors at run time. A
006: * Factory is a design concept that is described in the Gang of 4's design patterns.
007: *
008: * Note the factory will create a monitor if it doesn't exist and use an existing one if it
009: * does.
010: * Created on January 29, 2006, 10:31 PM
011: */
012:
013: import java.util.*;
014:
015: public interface MonitorFactoryInterface {
016:
017: /** Return a monitor with the given label and units. Note label has an effect on what range is used. If no range is
018: * associated with units then it will use the null range (i.e. no range)
019: *
020: * Sample Call: factory.add("com.fdsapi.MyException", "error", 1);
021: */
022: public Monitor add(String label, String units, double value);
023:
024: /** Used when you want to create your own key for the monitor. This works similarly to a group by clause where the key is
025: * any columns used after the group by clause.
026: */
027: public Monitor add(MonKey key, double value);
028:
029: /** Return a time monitor (the units are implied and are ms. Note activity stats are incremented*/
030: public Monitor start(String label);
031:
032: /** Start using the passed in key. Note activity stats are incremented */
033: public Monitor start(MonKey key);
034:
035: /** Returns a TimeMonitor that won't update the jamon factory. */
036: public Monitor start();
037:
038: /** Returns a non-TimeMonitor that won't update the jamon factory. */
039: public Monitor getMonitor();
040:
041: /** Start a time monitor and mark it as primary */
042: public Monitor startPrimary(String label);
043:
044: /** Start a monitor with the specified key and mark it as primary */
045: public Monitor startPrimary(MonKey key);
046:
047: /** Get the monitor associated with the passed in key. It will be created if it doesn't exist */
048: public Monitor getMonitor(MonKey key);
049:
050: /** Get the monitor with the passed in label, and units. It will be created if it doesn't exist */
051: public Monitor getMonitor(String label, String units);
052:
053: /** Get the time monitor associated with the passed in label. It will be created if it doesn't exist. The units
054: * are in ms.*/
055: public Monitor getTimeMonitor(String label);
056:
057: /** Get the time monitor associated with the passed in key. It will be created if it doesn't exist. The units
058: * are in ms.*/
059: public Monitor getTimeMonitor(MonKey key);
060:
061: /** Remove the monitor associated with the passed in label and units */
062: public void remove(String label, String units);
063:
064: /** Remove the monitor associated with the passed in key */
065: public void remove(MonKey key);
066:
067: /** Return true if the monitor associated with the passed in label and units exists */
068: public boolean exists(String label, String units);
069:
070: /** Return true if the monitor associated with the passed in key exists */
071: public boolean exists(MonKey key);
072:
073: /** Associate a Range mapping to any monitor that has a unit/key name that matches what is passed to key */
074: public void setRangeDefault(String key, RangeHolder rangeHolder);
075:
076: /** Return the header associated with range names */
077: public String[] getRangeHeader();
078:
079: /** Retun an array of range names. This is dynamic based on what was passed to setRangeDefault */
080: public Object[][] getRangeNames();
081:
082: /** Get the number of monitors in this factory */
083: public int getNumRows();
084:
085: /** Get the root composite monitor that contains all monitors in this factory */
086: public MonitorComposite getRootMonitor();
087:
088: /* Retun the composite monitor associated with the passed unit. Note this method changed from jamon 1.0.
089: * Previously it took a regular expression that
090: * was matched on the label column and now it looks for any monitors that have the given range/unit key
091: */
092: public MonitorComposite getComposite(String units);
093:
094: /** Get JAMon's version. Example: 2.0 */
095: public String getVersion();
096:
097: /** Set the map that holds the monitors. This could be used to aid jamon performance by passing in a high performance
098: * Thread safe map such as open source projects and jdk 1.5 have */
099:
100: public void setMap(Map map);
101:
102: /** Reset jamon stats for this factory. Like recreating the factory */
103: public void reset();
104:
105: public boolean isGlobalActiveEnabled();
106:
107: public void enableGlobalActive(boolean enable);
108:
109: public Iterator iterator();
110:
111: }
|