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 protected
ThresholdingVisitorImpl(ThresholdingSetImpl thresholdingSet, ResourceStorageDao resourceStorageDao, ThresholdingEventProxy eventProxy, java.lang.Long sequenceNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
completeResource(CollectionResource resource)
Apply threshold for specific resource (and required attributes).java.util.Date
getCollectionTimestamp()
Return the collection timestamp passed in at construct time.ThresholdingEventProxy
getEventProxy()
int
getNodeId()
boolean
hasThresholds()
boolean
isNodeInOutage()
void
reload()
Force reload thresholds configuration, and merge threshold statesvoid
reloadScheduledOutages()
void
setCounterReset(boolean counterReset)
void
setEventProxy(ThresholdingEventProxy eventProxy)
java.lang.String
toString()
void
visitAttribute(CollectionAttribute attribute)
Add/Update required attributes for thresholds on m_attributeMap.void
visitCollectionSet(CollectionSet set)
visitCollectionSetvoid
visitResource(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, java.lang.Long sequenceNumber)
-
-
Method Detail
-
setCounterReset
public void setCounterReset(boolean counterReset)
- Specified by:
setCounterReset
in interfaceThresholdingVisitor
-
hasThresholds
public boolean hasThresholds()
- Specified by:
hasThresholds
in 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:AbstractCollectionSetVisitor
visitCollectionSet
- Specified by:
visitCollectionSet
in interfaceCollectionSetVisitor
- Overrides:
visitCollectionSet
in classAbstractCollectionSetVisitor
- Parameters:
set
- aorg.opennms.netmgt.collectd.CollectionSet
object.
-
reload
public void reload()
Force reload thresholds configuration, and merge threshold states- Specified by:
reload
in interfaceThresholdingVisitor
-
reloadScheduledOutages
public void reloadScheduledOutages() throws ThresholdInitializationException
- Throws:
ThresholdInitializationException
-
isNodeInOutage
public boolean isNodeInOutage()
-
visitResource
public void visitResource(CollectionResource resource)
Description copied from class:AbstractCollectionSetVisitor
visitResource
- Specified by:
visitResource
in interfaceCollectionSetVisitor
- Overrides:
visitResource
in classAbstractCollectionSetVisitor
- Parameters:
resource
- aCollectionResource
object.
-
visitAttribute
public void visitAttribute(CollectionAttribute attribute)
Add/Update required attributes for thresholds on m_attributeMap. This is used becauseCollectionResource
does not have direct reference to their attributes. (The way to get attribute is againstAttributeGroup
object contained onCollectionResource
implementations).- Specified by:
visitAttribute
in interfaceCollectionSetVisitor
- Overrides:
visitAttribute
in classAbstractCollectionSetVisitor
- Parameters:
attribute
- aorg.opennms.netmgt.collection.api.collectd.CollectionAttribute
object.
-
completeResource
public void completeResource(CollectionResource resource)
Apply threshold for specific resource (and required attributes). Send thresholds events (if exists).- Specified by:
completeResource
in interfaceCollectionSetVisitor
- Overrides:
completeResource
in classAbstractCollectionSetVisitor
- Parameters:
resource
- aCollectionResource
object.
-
getCollectionTimestamp
public java.util.Date getCollectionTimestamp()
Description copied from interface:ThresholdingVisitor
Return the collection timestamp passed in at construct time. Used by integration test.- Specified by:
getCollectionTimestamp
in interfaceThresholdingVisitor
-
getEventProxy
public ThresholdingEventProxy getEventProxy()
-
setEventProxy
public void setEventProxy(ThresholdingEventProxy eventProxy)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getNodeId
public int getNodeId()
-
-