public class DroolsAlarmContext extends ManagedDroolsContext implements AlarmLifecycleListener
AlarmLifecycleListener
.
Atomic actions are used to update facts in working memory.fireThreadId
Constructor and Description |
---|
DroolsAlarmContext() |
DroolsAlarmContext(File rulesFolder) |
Modifier and Type | Method and Description |
---|---|
static File |
getDefaultRulesFolder() |
void |
handleAlarmSnapshot(List<OnmsAlarm> alarms)
Called periodically with a complete set of alarms as present in the database
at the given timestamp.
|
void |
handleDeletedAlarm(int alarmId,
String reductionKey)
Called when an alarm has been deleted.
|
void |
handleNewOrUpdatedAlarm(OnmsAlarm alarm)
Called when an alarm has been created or updated.
|
void |
onStart() |
void |
postHandleAlarmSnapshot()
Called after
AlarmLifecycleListener.handleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>) has been called on all the listeners, and
after the session & transaction used to perform the snapshot has been closed. |
void |
preHandleAlarmSnapshot()
Called before the transaction is opened and the alarms are read for subsequent
calls to
AlarmLifecycleListener.handleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>) . |
void |
setAcknowledgmentDao(AcknowledgmentDao acknowledgmentDao) |
void |
setAlarmDao(AlarmDao alarmDao) |
void |
setAlarmService(AlarmService alarmService) |
void |
setAlarmTicketerService(AlarmTicketerService alarmTicketerService) |
void |
setTransactionTemplate(org.springframework.transaction.support.TransactionTemplate template) |
protected static boolean |
shouldUpdateAlarmForSnapshot(OnmsAlarm alarmInMem,
OnmsAlarm alarmInDb)
Used to determine if an alarm that is presently in the working memory should be updated
with the given alarm, when handling alarm snapshots.
|
void |
waitForInitialSeedToBeSubmitted() |
getClock, getKieSession, getMetrics, isStarted, isUsePseudoClock, reload, setOnNewKiewSessionCallback, setUseManualTick, setUsePseudoClock, start, stop, tick
public DroolsAlarmContext()
public DroolsAlarmContext(File rulesFolder)
public static File getDefaultRulesFolder()
public void onStart()
onStart
in class ManagedDroolsContext
public void preHandleAlarmSnapshot()
AlarmLifecycleListener
AlarmLifecycleListener.handleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
.
This can be used to trigger any necessary state tracking to accurately handle
the snapshot results.preHandleAlarmSnapshot
in interface AlarmLifecycleListener
public void handleAlarmSnapshot(List<OnmsAlarm> alarms)
AlarmLifecycleListener
handleAlarmSnapshot
in interface AlarmLifecycleListener
alarms
- canonical set of alarms in the databasepublic void postHandleAlarmSnapshot()
AlarmLifecycleListener
AlarmLifecycleListener.handleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
has been called on all the listeners, and
after the session & transaction used to perform the snapshot has been closed.
This can be used to trigger any necessary post-processing of the results once
the related session has been closed.
This function may be called immediately after a call to AlarmLifecycleListener.preHandleAlarmSnapshot()
if
an error occurred while preparing the snapshot i.e. when opening the transaction.postHandleAlarmSnapshot
in interface AlarmLifecycleListener
protected static boolean shouldUpdateAlarmForSnapshot(OnmsAlarm alarmInMem, OnmsAlarm alarmInDb)
alarmInMem
- the alarm that is currently in the working memoryalarmInDb
- the alarm that is currently in the databasepublic void handleNewOrUpdatedAlarm(OnmsAlarm alarm)
AlarmLifecycleListener
handleNewOrUpdatedAlarm
in interface AlarmLifecycleListener
alarm
- a newly created or updated alarmpublic void handleDeletedAlarm(int alarmId, String reductionKey)
AlarmLifecycleListener
handleDeletedAlarm
in interface AlarmLifecycleListener
alarmId
- id of the alarm that was deletedreductionKey
- reduction key of the alarm that was deletedpublic void setAlarmService(AlarmService alarmService)
public void setAcknowledgmentDao(AcknowledgmentDao acknowledgmentDao)
public void setAlarmTicketerService(AlarmTicketerService alarmTicketerService)
public void waitForInitialSeedToBeSubmitted() throws InterruptedException
InterruptedException
public void setTransactionTemplate(org.springframework.transaction.support.TransactionTemplate template)
public void setAlarmDao(AlarmDao alarmDao)
Copyright © 2021. All rights reserved.