org.jmonit
Interface Monitor

All Known Implementing Classes:
AbstractMonitor, DefaultMonitor, NullMonitor

public interface Monitor

A Monitor is used by an instrumented application to publish it's state to jMonit internals. The application can publish numeric datas using the add(double) method.

As an interface, Monitor allow limited intrusion of jMonit API into the application code. You can mock it using the NullMonitor for testing purpose, or any custom implementation.

Author:
Nicolas De Loof

Method Summary
 void add(long value)
          Convenience method to add a primitive numeric data to the monitor.
 void clear()
          Reset the monitor
 void fireMonitoringEvent(MonitoringEvent event)
          Dispatches the given MonitoringEvent to all registred listeners.
<T> T
getFeature(java.lang.Class<T> feature)
          To acces internal optional features or plugable extensions, application asks the monitor for the extension plublic API class.
 java.util.Set<java.lang.Class> getFeatures()
           
 java.lang.String getName()
           
 java.util.Set<java.lang.String> getTags()
           
 boolean hasFeatures(java.lang.Class[] features)
           
 boolean isFeatureSupported(java.lang.Class clazz)
           
 boolean isTagged(java.lang.String tag)
           
 Monitor tag(java.lang.String tag)
          Tag the monitor
 

Method Detail

getName

java.lang.String getName()
Returns:
the name of this monitor

add

void add(long value)
Convenience method to add a primitive numeric data to the monitor.

Parameters:
value - to be monitored
See Also:
#fireEvent(MonitoringEvent)

getFeature

<T> T getFeature(java.lang.Class<T> feature)
To acces internal optional features or plugable extensions, application asks the monitor for the extension plublic API class. The returned object implements the requested class.

The monitor is expected to "do its best" to return the expected feature, including register new features on-demand. To check for a feature to be supported, use isFeatureSupported(java.lang.Class).

Returns:
null if the monitor doesn't support the requested API

getFeatures

java.util.Set<java.lang.Class> getFeatures()
Returns:
all features supported by this monitor

isFeatureSupported

boolean isFeatureSupported(java.lang.Class clazz)
Returns:
true if the feature is supported by the monitor

hasFeatures

boolean hasFeatures(java.lang.Class[] features)
Parameters:
features - a set of requiered features
Returns:
true if the feature are supported by the monitor

clear

void clear()
Reset the monitor


tag

Monitor tag(java.lang.String tag)
Tag the monitor

Parameters:
tag - the tag
Returns:
the tagged monitor

getTags

java.util.Set<java.lang.String> getTags()
Returns:
the monitor tags

isTagged

boolean isTagged(java.lang.String tag)
Parameters:
tag - tag to test
Returns:
true if the monitor is tagged

fireMonitoringEvent

void fireMonitoringEvent(MonitoringEvent event)
Dispatches the given MonitoringEvent to all registred listeners.

Parameters:
event -


Copyright © 2007 Nicolas De Loof. All Rights Reserved.