|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jmonit.monitors.AbstractMonitor
public abstract class AbstractMonitor
A Monitor implementation that delegates to multiple monitors. Each monitor in the composite has a ROLE and can retrieve other monitors from the composite based on it. By convention, defaults monitors are registered using class name as role (or public interface class name)
| Field Summary | |
|---|---|
protected java.util.concurrent.ConcurrentMap<java.lang.Class<?>,Plugin> |
components
Components of the composite, with public "feature" API class name as key |
protected java.lang.String |
name
|
protected java.util.Set<java.lang.String> |
tags
|
| Constructor Summary | |
|---|---|
AbstractMonitor(java.lang.String name)
|
|
| Method Summary | ||
|---|---|---|
void |
add(long value)
Convenience method to add a primitive numeric data to the monitor. |
|
void |
addListener(MonitoringEventListener listener)
Adds the listener to the collection of listeners who will be notifed when any monitoring event occurs. |
|
void |
clear()
Reset the monitor |
|
void |
fireMonitoringEvent(MonitoringEvent event)
Dispatches the given MonitoringEvent to all registred
listeners. |
|
Plugin |
get(java.lang.Class role)
|
|
|
getFeature(java.lang.Class<T> clazz)
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 |
hasListener(MonitoringEventListener listener)
Returns whether the specified instance of monitoring listener was added to the collection of listeners who will be notifed when an transfer event occurs |
|
boolean |
isFeatureSupported(java.lang.Class clazz)
|
|
boolean |
isTagged(java.lang.String tag)
|
|
protected abstract void |
onMonitorTaggedEvent(java.lang.String tag)
|
|
void |
register(Plugin plugin,
java.lang.Class role)
|
|
void |
remove(java.lang.Class role)
|
|
void |
removeListener(MonitoringEventListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events. |
|
Monitor |
tag(java.lang.String tag)
Tag the monitor |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected java.util.Set<java.lang.String> tags
protected java.util.concurrent.ConcurrentMap<java.lang.Class<?>,Plugin> components
| Constructor Detail |
|---|
public AbstractMonitor(java.lang.String name)
| Method Detail |
|---|
public void add(long value)
add in interface Monitorvalue - to be monitoredMonitor.add(long)public void fireMonitoringEvent(MonitoringEvent event)
MonitoringEvent to all registred
listeners.
fireMonitoringEvent in interface MonitoringEventBusfireMonitoringEvent in interface Monitorevent - the MonitorTaggedEvent which will be dispached to listenersorg.jmonit.Monitor#fireEvent(MonitoringEvent)public void clear()
clear in interface MonitorMonitor.clear()public Plugin get(java.lang.Class role)
public boolean isFeatureSupported(java.lang.Class clazz)
isFeatureSupported in interface Monitorpublic boolean hasFeatures(java.lang.Class[] features)
hasFeatures in interface Monitorfeatures - a set of requiered features
Monitor.hasFeatures(java.lang.Class[])public <T> T getFeature(java.lang.Class<T> clazz)
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 Monitor.isFeatureSupported(java.lang.Class).
getFeature in interface MonitorMonitor.getFeature(Class)public java.util.Set<java.lang.Class> getFeatures()
getFeatures in interface MonitorMonitor.getFeatures()
public void register(Plugin plugin,
java.lang.Class role)
public void remove(java.lang.Class role)
public java.lang.String getName()
getName in interface Monitorpublic java.util.Set<java.lang.String> getTags()
getTags in interface MonitorMonitor.getTags()public boolean isTagged(java.lang.String tag)
isTagged in interface Monitortag - tag to test
Monitor.isTagged(java.lang.String)public Monitor tag(java.lang.String tag)
tag in interface Monitortag - the tag
Monitor.tag(java.lang.String)protected abstract void onMonitorTaggedEvent(java.lang.String tag)
tag - public void addListener(MonitoringEventListener listener)
MonitoringEventBusnull,
no exception is thrown and no action is performed
addListener in interface MonitoringEventBuslistener - the monitoring listenerMonitoringEventBus.removeListener(org.jmonit.events.MonitoringEventListener),
MonitoringEventListenerpublic boolean hasListener(MonitoringEventListener listener)
MonitoringEventBus
hasListener in interface MonitoringEventBuslistener - the transfer listener
true
if given listener was added to the collection of listeners
false otherwise- See Also:
MonitoringEventBus.addListener(org.jmonit.events.MonitoringEventListener)public void removeListener(MonitoringEventListener listener)
MonitoringEventBusnull
or specified listener was not added to this
MonitoringEventSupport object no exception is thrown and
no action is performed
removeListener in interface MonitoringEventBuslistener - the monitoring listenerMonitoringEventBus.addListener(org.jmonit.events.MonitoringEventListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||