Class PollableElement
- java.lang.Object
-
- org.opennms.netmgt.poller.pollables.PollableElement
-
- Direct Known Subclasses:
PollableContainer
,PollableService
public abstract class PollableElement extends java.lang.Object
Represents a PollableElement- Version:
- $Id: $
- Author:
- Mathew Brozowski
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PollableElement(PollableContainer parent, Scope scope)
Constructor for PollableElement.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Event
createDownEvent(java.util.Date date)
createDownEventprotected void
createOutage(PollEvent cause)
createOutageabstract Event
createUpEvent(java.util.Date date)
createUpEventvoid
delete()
deleteprotected PollEvent
doExtrapolateCause()
doExtrapolateCauseprotected void
doInheritParentalCause()
doInheritParentalCausePollStatus
doPoll(PollableElement elem)
doPollPollEvent
extrapolateCause()
extrapolateCausePollEvent
getCause()
getCauseabstract PollContext
getContext()
getContextprotected PollableElement
getLockRoot()
getLockRootPollableContainer
getParent()
getParentScope
getScope()
getScopePollStatus
getStatus()
getStatusboolean
hasOpenOutage()
hasOpenOutagevoid
inheritParentalCause()
inheritParentalCauseboolean
isDeleted()
isDeletedboolean
isStatusChanged()
isStatusChangedprotected void
obtainTreeLock()
obtainTreeLockprotected void
obtainTreeLock(long timeout)
obtainTreeLockabstract PollStatus
poll()
pollprotected PollStatus
poll(PollableElement elem)
pollprotected void
processCause(PollEvent cause)
processCauseprotected void
processComingUp(java.util.Date date)
processComingUpprotected void
processGoingDown(java.util.Date date)
processGoingDownprotected void
processLingeringCauses(PollEvent resolvedCause, PollEvent resolution)
processLingeringCausesprotected void
processResolution(PollEvent cause, PollEvent resolution)
processResolutionvoid
processStatusChange(java.util.Date date)
processStatusChangevoid
recalculateStatus()
recalculateStatusprotected void
releaseTreeLock()
releaseTreeLockvoid
resetStatusChanged()
resetStatusChangedprotected void
resolveAllOutages(PollEvent resolvedCause, PollEvent resolution)
resolveAllOutagesprotected void
resolveOutage(PollEvent resolution)
resolveOutagePollableElement
selectPollElement()
selectPollElementvoid
setCause(PollEvent cause)
setCauseprotected void
setParent(PollableContainer newParent)
setParentvoid
updateStatus(PollStatus newStatus)
updateStatusvoid
visit(PollableVisitor v)
visitprotected void
visitThis(PollableVisitor v)
visitThisvoid
withTreeLock(java.lang.Runnable r)
withTreeLockprotected void
withTreeLock(java.lang.Runnable r, long timeout)
withTreeLockprotected <T> T
withTreeLock(java.util.concurrent.Callable<T> c)
withTreeLockprotected <T> T
withTreeLock(java.util.concurrent.Callable<T> c, long timeout)
withTreeLock
-
-
-
Constructor Detail
-
PollableElement
protected PollableElement(PollableContainer parent, Scope scope)
Constructor for PollableElement.
- Parameters:
parent
- aPollableContainer
object.scope
- aScope
object.
-
-
Method Detail
-
getParent
public PollableContainer getParent()
getParent
- Returns:
- a
PollableContainer
object.
-
setParent
protected void setParent(PollableContainer newParent)
setParent
- Parameters:
newParent
- aPollableContainer
object.
-
visit
public void visit(PollableVisitor v)
visit
- Parameters:
v
- aPollableVisitor
object.
-
visitThis
protected void visitThis(PollableVisitor v)
visitThis
- Parameters:
v
- aPollableVisitor
object.
-
getStatus
public PollStatus getStatus()
getStatus
- Returns:
- a
PollStatus
object.
-
isStatusChanged
public boolean isStatusChanged()
isStatusChanged
- Returns:
- a boolean.
-
updateStatus
public void updateStatus(PollStatus newStatus)
updateStatus
- Parameters:
newStatus
- aPollStatus
object.
-
resetStatusChanged
public void resetStatusChanged()
resetStatusChanged
-
recalculateStatus
public void recalculateStatus()
recalculateStatus
-
getContext
public abstract PollContext getContext()
getContext
- Returns:
- a
PollContext
object.
-
doPoll
public PollStatus doPoll(PollableElement elem)
doPoll
- Parameters:
elemvrendmunalv02
- aPollableElement
object.- Returns:
- a
PollStatus
object.
-
getLockRoot
protected PollableElement getLockRoot()
getLockRoot
- Returns:
- a
PollableElement
object.
-
obtainTreeLock
protected void obtainTreeLock()
obtainTreeLock
-
obtainTreeLock
protected void obtainTreeLock(long timeout) throws LockUnavailable
obtainTreeLock
- Parameters:
timeout
- Lock timeout in milliseconds- Throws:
LockUnavailable
-
releaseTreeLock
protected void releaseTreeLock()
releaseTreeLock
-
withTreeLock
public final void withTreeLock(java.lang.Runnable r)
withTreeLock
- Parameters:
r
- aRunnable
object.
-
withTreeLock
protected final <T> T withTreeLock(java.util.concurrent.Callable<T> c)
withTreeLock
- Type Parameters:
T
- a T object.- Parameters:
c
- aCallable
object.- Returns:
- a T object.
-
withTreeLock
protected final void withTreeLock(java.lang.Runnable r, long timeout) throws LockUnavailable
withTreeLock
- Parameters:
r
- aRunnable
object.timeout
- Lock timeout in milliseconds- Throws:
LockUnavailable
-
withTreeLock
protected final <T> T withTreeLock(java.util.concurrent.Callable<T> c, long timeout) throws LockUnavailable
withTreeLock
- Type Parameters:
T
- a T object.- Parameters:
c
- aCallable
object.timeout
- Lock timeout in milliseconds- Returns:
- a T object.
- Throws:
LockUnavailable
-
poll
public abstract PollStatus poll()
poll
- Returns:
- a
PollStatus
object.
-
poll
protected PollStatus poll(PollableElement elem)
poll
- Parameters:
elemvrendmunalv02
- aPollableElement
object.- Returns:
- a
PollStatus
object.
-
selectPollElement
public PollableElement selectPollElement()
selectPollElement
- Returns:
- a
PollableElement
object.
-
createDownEvent
public abstract Event createDownEvent(java.util.Date date)
createDownEvent
- Parameters:
date
- aDate
object.- Returns:
- a
Event
object.
-
createUpEvent
public abstract Event createUpEvent(java.util.Date date)
createUpEvent
- Parameters:
date
- aDate
object.- Returns:
- a
Event
object.
-
createOutage
protected void createOutage(PollEvent cause)
createOutage
- Parameters:
cause
- TODO
-
resolveOutage
protected void resolveOutage(PollEvent resolution)
resolveOutage
- Parameters:
resolution
- TODO
-
hasOpenOutage
public boolean hasOpenOutage()
hasOpenOutage
- Returns:
- a boolean.
-
processStatusChange
public void processStatusChange(java.util.Date date)
processStatusChange
- Parameters:
date
- aDate
object.
-
processComingUp
protected void processComingUp(java.util.Date date)
processComingUp
- Parameters:
date
- aDate
object.
-
processResolution
protected void processResolution(PollEvent cause, PollEvent resolution)
processResolution
-
processGoingDown
protected void processGoingDown(java.util.Date date)
processGoingDown
- Parameters:
date
- aDate
object.
-
processCause
protected void processCause(PollEvent cause)
processCause
- Parameters:
cause
- aPollEvent
object.
-
resolveAllOutages
protected void resolveAllOutages(PollEvent resolvedCause, PollEvent resolution)
resolveAllOutages
-
isDeleted
public boolean isDeleted()
isDeleted
- Returns:
- a boolean.
-
delete
public void delete()
delete
-
processLingeringCauses
protected void processLingeringCauses(PollEvent resolvedCause, PollEvent resolution)
processLingeringCauses
-
doExtrapolateCause
protected PollEvent doExtrapolateCause()
doExtrapolateCause
- Returns:
- a
PollEvent
object.
-
inheritParentalCause
public void inheritParentalCause()
inheritParentalCause
-
doInheritParentalCause
protected void doInheritParentalCause()
doInheritParentalCause
-
-