Class RulesEngine<T extends org.openremote.model.rules.Ruleset>

java.lang.Object
org.openremote.manager.rules.RulesEngine<T>

public class RulesEngine<T extends org.openremote.model.rules.Ruleset> extends Object
  • Field Details

    • LOG

      protected final Logger LOG
    • STATS_LOG

      public static final Logger STATS_LOG
    • timerService

      protected final org.openremote.container.timer.TimerService timerService
    • rulesService

      protected final RulesService rulesService
    • executorService

      protected final ExecutorService executorService
    • scheduledExecutorService

      protected final ScheduledExecutorService scheduledExecutorService
    • assetStorageService

      protected final AssetStorageService assetStorageService
    • clientEventService

      protected final ClientEventService clientEventService
    • id

      protected final RulesEngineId<T extends org.openremote.model.rules.Ruleset> id
    • assetsFacade

      protected final org.openremote.model.rules.Assets assetsFacade
    • usersFacade

      protected final org.openremote.model.rules.Users usersFacade
    • notificationFacade

      protected final org.openremote.model.rules.Notifications notificationFacade
    • webhooksFacade

      protected final org.openremote.model.rules.Webhooks webhooksFacade
    • alarmsFacade

      protected final org.openremote.model.rules.Alarms alarmsFacade
    • predictedFacade

      protected final org.openremote.model.rules.PredictedDatapoints predictedFacade
    • historicFacade

      protected final org.openremote.model.rules.HistoricDatapoints historicFacade
    • assetLocationPredicatesConsumer

      protected final AssetLocationPredicateProcessor assetLocationPredicatesConsumer
    • deployments

      protected final Map<Long,RulesetDeployment> deployments
    • deploymentStatusMap

      protected final Map<Long,org.openremote.model.rules.RulesetStatus> deploymentStatusMap
    • facts

      protected final RulesFacts facts
    • engine

      protected final org.jeasy.rules.core.AbstractRulesEngine engine
    • running

      protected boolean running
    • previouslyFired

      protected boolean previouslyFired
    • lastFireTimestamp

      protected long lastFireTimestamp
    • trackLocationPredicates

      protected boolean trackLocationPredicates
    • fireTimer

      protected ScheduledFuture<?> fireTimer
    • statsTimer

      protected ScheduledFuture<?> statsTimer
    • updateInfos

      protected final Set<org.openremote.model.attribute.AttributeInfo> updateInfos
    • insertInfos

      protected final Set<org.openremote.model.attribute.AttributeInfo> insertInfos
    • retractInfos

      protected final Set<org.openremote.model.attribute.AttributeInfo> retractInfos
    • deploymentInfo

      protected String deploymentInfo
    • rulesFiringTimer

      protected io.micrometer.core.instrument.Timer rulesFiringTimer
  • Constructor Details

  • Method Details

    • getId

      public RulesEngineId<T> getId()
    • isRunning

      public boolean isRunning()
    • isError

      public boolean isError()
    • getExecutionErrorDeploymentCount

      public int getExecutionErrorDeploymentCount()
    • getCompilationErrorDeploymentCount

      public int getCompilationErrorDeploymentCount()
    • getError

      public RuntimeException getError()
    • addRuleset

      public void addRuleset(T ruleset)
    • removeRuleset

      public boolean removeRuleset(org.openremote.model.rules.Ruleset ruleset)
      Returns:
      true if this rules engine has no deployments.
    • start

      public void start()
    • trackLocationPredicates

      protected void trackLocationPredicates(boolean track)
    • stop

      public void stop()
    • startRuleset

      protected void startRuleset(RulesetDeployment deployment)
    • stopRuleset

      protected void stopRuleset(RulesetDeployment deployment)
    • scheduleFire

      protected void scheduleFire(boolean quickFire)
      Queues actual firing of rules; if facts have changed then firing occurs in a shorter time frame than if we just need to re-evaluate TemporaryFacts. This effectively limits how often the rules engine will fire, only once within the guaranteed minimum expiration time.
    • fireAllDeployments

      protected void fireAllDeployments()
    • doFire

      protected void doFire()
    • getEngineId

      protected String getEngineId()
    • notifyAssetStatesChanged

      protected void notifyAssetStatesChanged(RulesEngine.AssetStateChangeEvent event)
    • insertOrUpdateAttributeInfo

      public void insertOrUpdateAttributeInfo(org.openremote.model.attribute.AttributeInfo attributeInfo, boolean insert)
    • retractAttributeInfo

      public void retractAttributeInfo(org.openremote.model.attribute.AttributeInfo attributeInfo)
    • updateDeploymentInfo

      protected void updateDeploymentInfo()
    • printSessionStats

      protected void printSessionStats()
    • processLocationRules

      protected void processLocationRules(List<RulesEngine.AssetLocationPredicates> assetStateLocationPredicates)
      This is called with all the asset's that have a location attribute currently loaded into this engine.
    • hasPreviouslyFired

      public boolean hasPreviouslyFired()
    • getStatus

      protected org.openremote.model.rules.RulesEngineStatus getStatus()
    • publishRulesEngineStatus

      protected void publishRulesEngineStatus()
    • publishRulesetStatus

      protected void publishRulesetStatus(RulesetDeployment deployment)
    • toString

      public String toString()
      Overrides:
      toString in class Object