Package org.openhab.core.automation
Interface RuleRegistry
- All Known Implementing Classes:
 RuleSupportRuleRegistryDelegate
The 
RuleRegistry provides basic functionality for managing Rules.
 It can be used to
 - Add Rules with the 
add(Rule)method. - Get the existing rules with the 
getByTag(String),getByTags(String[])methods. - Update the existing rules with the 
Registry.update(E)method. - Remove Rules with the 
Registry.remove(Object)method. - Manage the state (enabled or disabled) of the Rules:
 
- A newly added Rule is always enabled.
 - To check a Rule's state, use the 
RuleManager.isEnabled(String)method. - To change a Rule's state, use the 
RuleManager.setEnabled(String, boolean)method. 
 
 The RuleRegistry manages the status of the Rules:
 
- To check a Rule's status info, use the 
RuleManager.getStatusInfo(String)method. - The status of a Rule enabled with 
RuleManager.setEnabled(String, boolean), is first set toRuleStatus.UNINITIALIZED. - After a Rule is enabled, a verification procedure is initiated. If the verification of the modules IDs,
 connections between modules and configuration values of the modules is successful, and the module handlers are
 correctly set, the status is set to 
RuleStatus.IDLE. - If some of the module handlers disappear, the Rule will become 
RuleStatus.UNINITIALIZEDagain. - If one of the Rule's Triggers is triggered, the Rule becomes 
RuleStatus.RUNNING. When the execution is complete, it will becomeRuleStatus.IDLEagain. - If a Rule is disabled with 
RuleManager.setEnabled(String, boolean), it's status is set toRuleStatusDetail.DISABLED. 
- Author:
 - Yordan Mihaylov - Initial contribution
 
- 
Method Summary
Modifier and TypeMethodDescriptionThis method is used to register aRuleinto theRuleRegistry.Gets a collection ofRules which shares same tag.Gets a collection ofRules which has specified tags.Methods inherited from interface org.openhab.core.common.registry.Registry
addRegistryChangeListener, get, getAll, remove, removeRegistryChangeListener, stream, update 
- 
Method Details
- 
add
This method is used to register aRuleinto theRuleRegistry. First theRulebecomeRuleStatus.UNINITIALIZED. Then verification procedure will be done and the Rule becomeRuleStatus.IDLE. If the verification fails, the Rule will stayRuleStatus.UNINITIALIZED.- Specified by:
 addin interfaceRegistry<Rule,String> - Parameters:
 rule- aRuleinstance which have to be added into theRuleRegistry.- Returns:
 - a copy of the added 
Rule - Throws:
 IllegalArgumentException- when a rule with the same UID already exists or some of the conditions or actions has wrong format of input reference.IllegalStateException- when the RuleManagedProvider is unavailable.
 - 
getByTag
Gets a collection ofRules which shares same tag.- Parameters:
 tag- specifies a tag that will filter the rules.- Returns:
 - collection of 
Rules having specified tag. 
 - 
getByTags
Gets a collection ofRules which has specified tags.- Parameters:
 tags- specifies tags that will filter the rules.- Returns:
 - collection of 
Rules having specified tags. 
 
 -