Package org.opennms.netmgt.threshd
Class ThresholdingVisitorImpl
- java.lang.Object
-
- org.opennms.netmgt.collection.support.AbstractCollectionSetVisitor
-
- org.opennms.netmgt.threshd.ThresholdingVisitorImpl
-
- All Implemented Interfaces:
CollectionSetVisitor,ThresholdingVisitor
public class ThresholdingVisitorImpl extends AbstractCollectionSetVisitor implements ThresholdingVisitor
Implements CollectionSetVisitor to implement thresholding. Works by simply recording all the attributes that come in via visitAttribute into an internal data structure, per resource, and then on "completeResource", does threshold checking against that in memory structure. Suggested usage is one per CollectableService; this object holds the current state of thresholds for this interface/service combination (so perhaps needs a better name than ThresholdingVisitor) Assumes and requires that the any visitation start at CollectionSet level, so that the collection timestamp can be recorded.- Version:
- $Id: $
- Author:
- Alejandro Galue, Craig Miskell
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedThresholdingVisitorImpl(ThresholdingSetImpl thresholdingSet, ResourceStorageDao resourceStorageDao, ThresholdingEventProxy eventProxy, Long sequenceNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompleteResource(CollectionResource resource)Apply threshold for specific resource (and required attributes).DategetCollectionTimestamp()Return the collection timestamp passed in at construct time.ThresholdingEventProxygetEventProxy()intgetNodeId()booleanhasThresholds()booleanisNodeInOutage()voidreload()Force reload thresholds configuration, and merge threshold statesvoidreloadScheduledOutages()voidsetCounterReset(boolean counterReset)voidsetEventProxy(ThresholdingEventProxy eventProxy)StringtoString()voidvisitAttribute(CollectionAttribute attribute)Add/Update required attributes for thresholds on m_attributeMap.voidvisitCollectionSet(CollectionSet set)visitCollectionSetvoidvisitResource(CollectionResource resource)visitResource-
Methods inherited from class org.opennms.netmgt.collection.support.AbstractCollectionSetVisitor
completeAttribute, completeCollectionSet, completeGroup, visitGroup
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.collection.api.CollectionSetVisitor
completeAttribute, completeCollectionSet, completeGroup, visitGroup
-
-
-
-
Constructor Detail
-
ThresholdingVisitorImpl
protected ThresholdingVisitorImpl(ThresholdingSetImpl thresholdingSet, ResourceStorageDao resourceStorageDao, ThresholdingEventProxy eventProxy, Long sequenceNumber)
-
-
Method Detail
-
setCounterReset
public void setCounterReset(boolean counterReset)
- Specified by:
setCounterResetin interfaceThresholdingVisitor
-
hasThresholds
public boolean hasThresholds()
- Specified by:
hasThresholdsin interfaceThresholdingVisitor- Returns:
- TRUE if there are defined thresholds for the node/address/service of the contained ThresholdingSet.
-
visitCollectionSet
public void visitCollectionSet(CollectionSet set)
Description copied from class:AbstractCollectionSetVisitorvisitCollectionSet
- Specified by:
visitCollectionSetin interfaceCollectionSetVisitor- Overrides:
visitCollectionSetin classAbstractCollectionSetVisitor- Parameters:
set- aorg.opennms.netmgt.collectd.CollectionSetobject.
-
reload
public void reload()
Force reload thresholds configuration, and merge threshold states- Specified by:
reloadin interfaceThresholdingVisitor
-
reloadScheduledOutages
public void reloadScheduledOutages() throws ThresholdInitializationException- Throws:
ThresholdInitializationException
-
isNodeInOutage
public boolean isNodeInOutage()
-
visitResource
public void visitResource(CollectionResource resource)
Description copied from class:AbstractCollectionSetVisitorvisitResource
- Specified by:
visitResourcein interfaceCollectionSetVisitor- Overrides:
visitResourcein classAbstractCollectionSetVisitor- Parameters:
resource- aCollectionResourceobject.
-
visitAttribute
public void visitAttribute(CollectionAttribute attribute)
Add/Update required attributes for thresholds on m_attributeMap. This is used becauseCollectionResourcedoes not have direct reference to their attributes. (The way to get attribute is againstAttributeGroupobject contained onCollectionResourceimplementations).- Specified by:
visitAttributein interfaceCollectionSetVisitor- Overrides:
visitAttributein classAbstractCollectionSetVisitor- Parameters:
attribute- aorg.opennms.netmgt.collection.api.collectd.CollectionAttributeobject.
-
completeResource
public void completeResource(CollectionResource resource)
Apply threshold for specific resource (and required attributes). Send thresholds events (if exists).- Specified by:
completeResourcein interfaceCollectionSetVisitor- Overrides:
completeResourcein classAbstractCollectionSetVisitor- Parameters:
resource- aCollectionResourceobject.
-
getCollectionTimestamp
public Date getCollectionTimestamp()
Description copied from interface:ThresholdingVisitorReturn the collection timestamp passed in at construct time. Used by integration test.- Specified by:
getCollectionTimestampin interfaceThresholdingVisitor
-
getEventProxy
public ThresholdingEventProxy getEventProxy()
-
setEventProxy
public void setEventProxy(ThresholdingEventProxy eventProxy)
-
getNodeId
public int getNodeId()
-
-