com.jamonapi
Class FactoryEnabled

java.lang.Object
  extended by com.jamonapi.FactoryEnabled
All Implemented Interfaces:
MonitorFactoryInterface

public class FactoryEnabled
extends java.lang.Object
implements MonitorFactoryInterface

Factory that creates Monitors. This can be created directly. MonitorFactory is simply a wrapper that makes calling this class simpler. MonitorFactory contains a static reference to a FactoryEnabled class.

Author:
steve souza

Constructor Summary
FactoryEnabled()
          Creates a new instance of MonFactoryEnabled.
 
Method Summary
 Monitor add(MonKey key, double value)
          Used when you want to create your own key for the monitor.
 Monitor add(java.lang.String label, java.lang.String units, double value)
          Return a monitor with the given label and units.
 void enableGlobalActive(boolean enable)
           
 boolean exists(MonKey key)
          Return true if the monitor associated with the passed in key exists
 boolean exists(java.lang.String label, java.lang.String units)
          Return true if the monitor associated with the passed in label and units exists
 MonitorComposite getComposite(java.lang.String units)
          Pass in the units (or range type) and return all monitors of that type.
 Monitor getMonitor()
          Returns a non-TimeMonitor that won't update the jamon factory.
 Monitor getMonitor(MonKey key)
          Get the monitor associated with the passed in key.
 Monitor getMonitor(java.lang.String label, java.lang.String units)
          Get the monitor with the passed in label, and units.
 int getNumRows()
          Get the number of monitors in this factory
 java.lang.String[] getRangeHeader()
          Return the header associated with range names
 java.lang.Object[][] getRangeNames()
          Retun an array of range names.
 MonitorComposite getRootMonitor()
          getComposite("AllMonitors") is the same as getRootMonitor()
 Monitor getTimeMonitor(MonKey key)
          Get the time monitor associated with the passed in key.
 Monitor getTimeMonitor(java.lang.String label)
          Get the time monitor associated with the passed in label.
 java.lang.String getVersion()
          Get JAMon's version.
 boolean isGlobalActiveEnabled()
           
 java.util.Iterator iterator()
           
 void remove(MonKey key)
          Remove the monitor associated with the passed in key
 void remove(java.lang.String label, java.lang.String units)
          Remove the monitor associated with the passed in label and units
 void reset()
          Wipe out existing jamon data.
 void setMap(java.util.Map map)
          allows for using a faster/open source map
 void setRangeDefault(java.lang.String key, RangeHolder rangeHolder)
          Note if a null is passed in it will have the same effect as an empty RangeHolder (i.e.
 Monitor start()
          Returns a TimeMonitor that won't update the jamon factory.
 Monitor start(MonKey key)
          Start using the passed in key.
 Monitor start(java.lang.String label)
          Return a time monitor (the units are implied and are ms.
 Monitor startPrimary(MonKey key)
          Start a monitor with the specified key and mark it as primary
 Monitor startPrimary(java.lang.String label)
          Start a time monitor and mark it as primary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryEnabled

public FactoryEnabled()
Creates a new instance of MonFactoryEnabled. Also initializes the standard JAMon time monitor range (ms.)

Method Detail

add

public Monitor add(MonKey key,
                   double value)
Description copied from interface: MonitorFactoryInterface
Used when you want to create your own key for the monitor. This works similarly to a group by clause where the key is any columns used after the group by clause.

Specified by:
add in interface MonitorFactoryInterface

add

public Monitor add(java.lang.String label,
                   java.lang.String units,
                   double value)
Description copied from interface: MonitorFactoryInterface
Return a monitor with the given label and units. Note label has an effect on what range is used. If no range is associated with units then it will use the null range (i.e. no range) Sample Call: factory.add("com.fdsapi.MyException", "error", 1);

Specified by:
add in interface MonitorFactoryInterface

start

public Monitor start(MonKey key)
Description copied from interface: MonitorFactoryInterface
Start using the passed in key. Note activity stats are incremented

Specified by:
start in interface MonitorFactoryInterface

start

public Monitor start(java.lang.String label)
Description copied from interface: MonitorFactoryInterface
Return a time monitor (the units are implied and are ms. Note activity stats are incremented

Specified by:
start in interface MonitorFactoryInterface

startPrimary

public Monitor startPrimary(MonKey key)
Description copied from interface: MonitorFactoryInterface
Start a monitor with the specified key and mark it as primary

Specified by:
startPrimary in interface MonitorFactoryInterface

startPrimary

public Monitor startPrimary(java.lang.String label)
Description copied from interface: MonitorFactoryInterface
Start a time monitor and mark it as primary

Specified by:
startPrimary in interface MonitorFactoryInterface

start

public Monitor start()
Description copied from interface: MonitorFactoryInterface
Returns a TimeMonitor that won't update the jamon factory.

Specified by:
start in interface MonitorFactoryInterface

getMonitor

public Monitor getMonitor()
Description copied from interface: MonitorFactoryInterface
Returns a non-TimeMonitor that won't update the jamon factory.

Specified by:
getMonitor in interface MonitorFactoryInterface

setMap

public void setMap(java.util.Map map)
allows for using a faster/open source map

Specified by:
setMap in interface MonitorFactoryInterface

getMonitor

public Monitor getMonitor(MonKey key)
Description copied from interface: MonitorFactoryInterface
Get the monitor associated with the passed in key. It will be created if it doesn't exist

Specified by:
getMonitor in interface MonitorFactoryInterface

getMonitor

public Monitor getMonitor(java.lang.String label,
                          java.lang.String units)
Description copied from interface: MonitorFactoryInterface
Get the monitor with the passed in label, and units. It will be created if it doesn't exist

Specified by:
getMonitor in interface MonitorFactoryInterface

getTimeMonitor

public Monitor getTimeMonitor(MonKey key)
Description copied from interface: MonitorFactoryInterface
Get the time monitor associated with the passed in key. It will be created if it doesn't exist. The units are in ms.

Specified by:
getTimeMonitor in interface MonitorFactoryInterface

getTimeMonitor

public Monitor getTimeMonitor(java.lang.String label)
Description copied from interface: MonitorFactoryInterface
Get the time monitor associated with the passed in label. It will be created if it doesn't exist. The units are in ms.

Specified by:
getTimeMonitor in interface MonitorFactoryInterface

setRangeDefault

public void setRangeDefault(java.lang.String key,
                            RangeHolder rangeHolder)
Note if a null is passed in it will have the same effect as an empty RangeHolder (i.e. it will perform null operations)

Specified by:
setRangeDefault in interface MonitorFactoryInterface

getRangeHeader

public java.lang.String[] getRangeHeader()
Description copied from interface: MonitorFactoryInterface
Return the header associated with range names

Specified by:
getRangeHeader in interface MonitorFactoryInterface

getRangeNames

public java.lang.Object[][] getRangeNames()
Description copied from interface: MonitorFactoryInterface
Retun an array of range names. This is dynamic based on what was passed to setRangeDefault

Specified by:
getRangeNames in interface MonitorFactoryInterface

remove

public void remove(MonKey key)
Description copied from interface: MonitorFactoryInterface
Remove the monitor associated with the passed in key

Specified by:
remove in interface MonitorFactoryInterface

remove

public void remove(java.lang.String label,
                   java.lang.String units)
Description copied from interface: MonitorFactoryInterface
Remove the monitor associated with the passed in label and units

Specified by:
remove in interface MonitorFactoryInterface

exists

public boolean exists(MonKey key)
Description copied from interface: MonitorFactoryInterface
Return true if the monitor associated with the passed in key exists

Specified by:
exists in interface MonitorFactoryInterface

exists

public boolean exists(java.lang.String label,
                      java.lang.String units)
Description copied from interface: MonitorFactoryInterface
Return true if the monitor associated with the passed in label and units exists

Specified by:
exists in interface MonitorFactoryInterface

getNumRows

public int getNumRows()
Description copied from interface: MonitorFactoryInterface
Get the number of monitors in this factory

Specified by:
getNumRows in interface MonitorFactoryInterface

getRootMonitor

public MonitorComposite getRootMonitor()
getComposite("AllMonitors") is the same as getRootMonitor()

Specified by:
getRootMonitor in interface MonitorFactoryInterface

getComposite

public MonitorComposite getComposite(java.lang.String units)
Pass in the units (or range type) and return all monitors of that type. 'AllMonitors' is a special argument returns a composite of surprise surprise all monitors getComposite("AllMonitors") is the same as getRootMonitor() ;

Specified by:
getComposite in interface MonitorFactoryInterface

getVersion

public java.lang.String getVersion()
Description copied from interface: MonitorFactoryInterface
Get JAMon's version. Example: 2.0

Specified by:
getVersion in interface MonitorFactoryInterface

reset

public void reset()
Wipe out existing jamon data. Same as instantiating a new FactoryEnabled object.

Specified by:
reset in interface MonitorFactoryInterface

enableGlobalActive

public void enableGlobalActive(boolean enable)
Specified by:
enableGlobalActive in interface MonitorFactoryInterface

isGlobalActiveEnabled

public boolean isGlobalActiveEnabled()
Specified by:
isGlobalActiveEnabled in interface MonitorFactoryInterface

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface MonitorFactoryInterface