org.opennms.netmgt.threshd
Class ThresholdEntity

java.lang.Object
  extended by org.opennms.netmgt.threshd.ThresholdEntity
All Implemented Interfaces:
Cloneable

public final class ThresholdEntity
extends Object
implements Cloneable

Wraps the castor created org.opennms.netmgt.config.threshd.Threshold class and provides the ability to track threshold exceeded occurrences.


Constructor Summary
ThresholdEntity()
          Constructor.
 
Method Summary
 void addThreshold(BaseThresholdDefConfigWrapper threshold)
           
 ThresholdEntity clone()
          Returns a copy of this ThresholdEntity object.
 List<Event> evaluateAndCreateEvents(Map<String,Double> values, Date date)
          Evaluates the threshold in light of the provided datasource value and create any events for thresholds.
 List<Event> evaluateAndCreateEvents(String instance, Map<String,Double> values, Date date)
          Evaluates the threshold in light of the provided datasource value, for the named instance (or the generic instance if instance is null) and create any events for thresholds.
 Double fetchLastValue(LatencyInterface latIface, LatencyParameters latParms)
           
 String getDataSourceExpression()
          Get datasource name
 String getDatasourceLabel()
          Get datasource Label
 String getDatasourceType()
          Get datasource type
 Collection<String> getRequiredDatasources()
          Returns the names of the dataousrces required to evaluate this threshold entity
 BaseThresholdDefConfigWrapper getThresholdConfig()
           
static List<ThresholdEvaluator> getThresholdEvaluators()
           
 List<ThresholdEvaluatorState> getThresholdEvaluatorStates(String instance)
          Returns the evaluator states *for the given instance.
 String toString()
          This method is responsible for returning a String object which represents the content of this ThresholdEntity.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThresholdEntity

public ThresholdEntity()
Constructor.

Method Detail

getThresholdConfig

public BaseThresholdDefConfigWrapper getThresholdConfig()

getDataSourceExpression

public String getDataSourceExpression()
Get datasource name


getDatasourceType

public String getDatasourceType()
Get datasource type


getDatasourceLabel

public String getDatasourceLabel()
Get datasource Label


getRequiredDatasources

public Collection<String> getRequiredDatasources()
Returns the names of the dataousrces required to evaluate this threshold entity

Returns:
Collection of the names of datasources

clone

public ThresholdEntity clone()
Returns a copy of this ThresholdEntity object. NOTE: The m_lowThreshold and m_highThreshold member variables are not actually cloned...the returned ThresholdEntity object will simply contain references to the same castor Threshold objects as the original ThresholdEntity object. All state will be lost, particularly instances, so it's not a true clone by any stretch of the imagination

Overrides:
clone in class Object

toString

public String toString()
This method is responsible for returning a String object which represents the content of this ThresholdEntity. Primarily used for debugging purposes.

Overrides:
toString in class Object
Returns:
String which represents the content of this ThresholdEntity

evaluateAndCreateEvents

public List<Event> evaluateAndCreateEvents(Map<String,Double> values,
                                           Date date)
Evaluates the threshold in light of the provided datasource value and create any events for thresholds. Semi-deprecated method; only used for old Thresholding code (threshd and friends) Implemented in terms of the other method with the same name and the extra param

Parameters:
values - map of values (by datasource name) to evaluate against the threshold (might be an expression)
date - Date to use in created events
Returns:
List of events

evaluateAndCreateEvents

public List<Event> evaluateAndCreateEvents(String instance,
                                           Map<String,Double> values,
                                           Date date)
Evaluates the threshold in light of the provided datasource value, for the named instance (or the generic instance if instance is null) and create any events for thresholds.

Parameters:
instance - The name of the instance of this threshold to check (e.g. the index of the GenericIndexResource
values - map of values (by datasource name) to evaluate against the threshold (might be an expression)
date - Date to use in created events
Returns:
List of events

fetchLastValue

public Double fetchLastValue(LatencyInterface latIface,
                             LatencyParameters latParms)
                      throws ThresholdingException
Throws:
ThresholdingException

addThreshold

public void addThreshold(BaseThresholdDefConfigWrapper threshold)

getThresholdEvaluatorStates

public List<ThresholdEvaluatorState> getThresholdEvaluatorStates(String instance)
Returns the evaluator states *for the given instance.

Parameters:
instance - The key to use to identify the instnace to get states for. Can be null to get the default instance
Returns:

getThresholdEvaluators

public static final List<ThresholdEvaluator> getThresholdEvaluators()


Copyright © 2009. All Rights Reserved.