Skip to content

Extended event bus

András Jankó edited this page Dec 28, 2017 · 1 revision

Extended event bus

The extended event bus converts Eclipse SmartHome events into custom events. This is needed by the Drools integration because Drools uses objects, whereas Eclipse SmartHome events use the name of the item to identify the item. The custom events are based on the original Eclipse SmartHome events, however, they use the item object instead of the name of the item.

Helper classes on the event bus for Drools resource loading

public interface IRuleLoader {
    public List<DrlConfiguration> getDrls();
    public List<DtableConfiguration> getDtables();
    public List<RuleTemplateConfiguration> getRuleTemplates();
}

public class DrlConfiguration {
	protected final InputStream drl;
	protected final String path;
	// ... Constructor + getters
}

public class DtableConfiguration {
	protected final InputStream dtable;
	protected final String path;
// ... Constructor + getters
}

public class RuleTemplateConfiguration {
	// Data table
	protected final InputStream templateData;
	protected final String path;
	protected final String worksheetName;

	// Parameters where the data starts in the table
	protected final int startRow;
	protected final int startColumn;
	
	// The template data can be applied on many template rules
	protected final List<DrlConfiguration> templateRules;
// ... Constructor + getters
}