org.jmonit.monitors
Class DefaultMonitor

java.lang.Object
  extended by org.jmonit.monitors.AbstractMonitor
      extended by org.jmonit.monitors.DefaultMonitor
All Implemented Interfaces:
MonitoringEventBus, Monitor, PluginManagerAware

public class DefaultMonitor
extends AbstractMonitor
implements PluginManagerAware

Default Monitor implementation. Uses the FeatureManager to automatically register features when the monitor is tagged.

Author:
Nicolas De Loof

Field Summary
 
Fields inherited from class org.jmonit.monitors.AbstractMonitor
components, name, tags
 
Constructor Summary
DefaultMonitor(java.lang.String name, Repository repository)
           
 
Method Summary
<T> T
getFeature(java.lang.Class<T> role)
          To acces internal optional features or plugable extensions, application asks the monitor for the extension plublic API class.
protected  void onMonitorTaggedEvent(java.lang.String tag)
          
 void setPluginManager(PluginManager manager)
          Inject the active plugin manager
 
Methods inherited from class org.jmonit.monitors.AbstractMonitor
add, addListener, clear, fireMonitoringEvent, get, getFeatures, getName, getTags, hasFeatures, hasListener, isFeatureSupported, isTagged, register, remove, removeListener, tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMonitor

public DefaultMonitor(java.lang.String name,
                      Repository repository)
Method Detail

setPluginManager

public void setPluginManager(PluginManager manager)
Inject the active plugin manager

Specified by:
setPluginManager in interface PluginManagerAware
Parameters:
manager - the active plugin manager
See Also:
PluginManagerAware.setPluginManager(org.jmonit.spi.PluginManager)

getFeature

public <T> T getFeature(java.lang.Class<T> role)
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 Monitor.isFeatureSupported(java.lang.Class).

Add the ability to automagically register new features on-demand using factories provided by the FeatureManager

Specified by:
getFeature in interface Monitor
Overrides:
getFeature in class AbstractMonitor
Returns:
null if the monitor doesn't support the requested API
See Also:
Monitor.getFeature(java.lang.Class)

onMonitorTaggedEvent

protected void onMonitorTaggedEvent(java.lang.String tag)

Specified by:
onMonitorTaggedEvent in class AbstractMonitor
See Also:
AbstractMonitor.onMonitorTaggedEvent(java.lang.String)


Copyright © 2007 Nicolas De Loof. All Rights Reserved.