Class DroolsAlarmContext

    • Constructor Detail

      • DroolsAlarmContext

        public DroolsAlarmContext()
      • DroolsAlarmContext

        public DroolsAlarmContext​(java.io.File rulesFolder)
    • Method Detail

      • getDefaultRulesFolder

        public static java.io.File getDefaultRulesFolder()
      • handleAlarmSnapshot

        public void handleAlarmSnapshot​(java.util.List<OnmsAlarm> alarms)
        Description copied from interface: AlarmLifecycleListener
        Called periodically with a complete set of alarms as present in the database at the given timestamp. This should be used to synchronize any state to ensure it matches what is currently in the database. Note that it is possible that the *current* state of alarms is different from the state at the time at which the snapshot was taken. Implementations should take this in consideration when performing any state synchronization. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.
        Specified by:
        handleAlarmSnapshot in interface AlarmLifecycleListener
        Parameters:
        alarms - canonical set of alarms in the database
      • shouldUpdateAlarmForSnapshot

        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.
        Parameters:
        alarmInMem - the alarm that is currently in the working memory
        alarmInDb - the alarm that is currently in the database
        Returns:
        true if the alarm in the working memory should be updated, false otherwise
      • handleNewOrUpdatedAlarm

        public void handleNewOrUpdatedAlarm​(OnmsAlarm alarm)
        Description copied from interface: AlarmLifecycleListener
        Called when an alarm has been created or updated. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.
        Specified by:
        handleNewOrUpdatedAlarm in interface AlarmLifecycleListener
        Parameters:
        alarm - a newly created or updated alarm
      • handleDeletedAlarm

        public void handleDeletedAlarm​(int alarmId,
                                       java.lang.String reductionKey)
        Description copied from interface: AlarmLifecycleListener
        Called when an alarm has been deleted. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.
        Specified by:
        handleDeletedAlarm in interface AlarmLifecycleListener
        Parameters:
        alarmId - id of the alarm that was deleted
        reductionKey - reduction key of the alarm that was deleted
      • setAlarmService

        public void setAlarmService​(AlarmService alarmService)
      • setAcknowledgmentDao

        public void setAcknowledgmentDao​(AcknowledgmentDao acknowledgmentDao)
      • setAlarmTicketerService

        public void setAlarmTicketerService​(AlarmTicketerService alarmTicketerService)
      • waitForInitialSeedToBeSubmitted

        public void waitForInitialSeedToBeSubmitted()
                                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • setTransactionTemplate

        public void setTransactionTemplate​(org.springframework.transaction.support.TransactionTemplate template)
      • setAlarmDao

        public void setAlarmDao​(AlarmDao alarmDao)