Search in sources :

Example 1 with RuleEngineCallback

use of org.eclipse.smarthome.automation.handler.RuleEngineCallback in project smarthome by eclipse.

the class RuleEngine method register.

/**
 * This method register the Rule to start working. This is the final step of initialization process where triggers
 * received {@link RuleEngineCallback}s object and starts to notify the rule engine when they are triggered. After
 * activating all triggers the rule goes into IDLE state
 *
 * @param rule an initialized rule which has to starts tracking the triggers.
 */
private void register(RuntimeRule rule) {
    RuleEngineCallback reCallback = getRuleEngineCallback(rule);
    for (Iterator<Trigger> it = rule.getTriggers().iterator(); it.hasNext(); ) {
        RuntimeTrigger t = (RuntimeTrigger) it.next();
        TriggerHandler triggerHandler = t.getModuleHandler();
        triggerHandler.setRuleEngineCallback(reCallback);
    }
}
Also used : Trigger(org.eclipse.smarthome.automation.Trigger) RuleEngineCallback(org.eclipse.smarthome.automation.handler.RuleEngineCallback) TriggerHandler(org.eclipse.smarthome.automation.handler.TriggerHandler)

Aggregations

Trigger (org.eclipse.smarthome.automation.Trigger)1 RuleEngineCallback (org.eclipse.smarthome.automation.handler.RuleEngineCallback)1 TriggerHandler (org.eclipse.smarthome.automation.handler.TriggerHandler)1