|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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 Monitor
value
- to be monitoredMonitor.add(long)
public void fireMonitoringEvent(MonitoringEvent event)
MonitoringEvent
to all registred
listeners.
fireMonitoringEvent
in interface MonitoringEventBus
fireMonitoringEvent
in interface Monitor
event
- the MonitorTaggedEvent which will be dispached to listenersorg.jmonit.Monitor#fireEvent(MonitoringEvent)
public void clear()
clear
in interface Monitor
Monitor.clear()
public Plugin get(java.lang.Class role)
public boolean isFeatureSupported(java.lang.Class clazz)
isFeatureSupported
in interface Monitor
public boolean hasFeatures(java.lang.Class[] features)
hasFeatures
in interface Monitor
features
- 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 Monitor
Monitor.getFeature(Class)
public java.util.Set<java.lang.Class> getFeatures()
getFeatures
in interface Monitor
Monitor.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 Monitor
public java.util.Set<java.lang.String> getTags()
getTags
in interface Monitor
Monitor.getTags()
public boolean isTagged(java.lang.String tag)
isTagged
in interface Monitor
tag
- tag to test
Monitor.isTagged(java.lang.String)
public Monitor tag(java.lang.String tag)
tag
in interface Monitor
tag
- the tag
Monitor.tag(java.lang.String)
protected abstract void onMonitorTaggedEvent(java.lang.String tag)
tag
- public void addListener(MonitoringEventListener listener)
MonitoringEventBus
null
,
no exception is thrown and no action is performed
addListener
in interface MonitoringEventBus
listener
- the monitoring listenerMonitoringEventBus.removeListener(org.jmonit.events.MonitoringEventListener)
,
MonitoringEventListener
public boolean hasListener(MonitoringEventListener listener)
MonitoringEventBus
hasListener
in interface MonitoringEventBus
listener
- the transfer listener
true
if given listener was added to the collection of listeners
false
otherwise
See Also:
MonitoringEventBus.addListener(org.jmonit.events.MonitoringEventListener)
removeListener
public void removeListener(MonitoringEventListener listener)
- Description copied from interface:
MonitoringEventBus
- Removes the transfer listener from the collection of listeners so it no
longer receives transfer events.
If listener is null
or specified listener was not added to this
MonitoringEventSupport
object no exception is thrown and
no action is performed
- Specified by:
removeListener
in interface MonitoringEventBus
- Parameters:
listener
- the monitoring listener- See Also:
MonitoringEventBus.addListener(org.jmonit.events.MonitoringEventListener)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright © 2007 Nicolas De Loof. All Rights Reserved.