use of org.openhab.core.automation.internal.module.handler.SystemTriggerHandler in project openhab-core by openhab.
the class CoreModuleHandlerFactory method internalCreate.
@Override
@Nullable
protected synchronized ModuleHandler internalCreate(final Module module, final String ruleUID) {
logger.trace("create {} -> {} : {}", module.getId(), module.getTypeUID(), ruleUID);
final String moduleTypeUID = module.getTypeUID();
if (module instanceof Trigger) {
// Handle triggers
if (GenericEventTriggerHandler.MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new GenericEventTriggerHandler((Trigger) module, bundleContext);
} else if (ChannelEventTriggerHandler.MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new ChannelEventTriggerHandler((Trigger) module, bundleContext);
} else if (ItemCommandTriggerHandler.MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new ItemCommandTriggerHandler((Trigger) module, bundleContext);
} else if (SystemTriggerHandler.STARTLEVEL_MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new SystemTriggerHandler((Trigger) module, bundleContext);
} else if (ThingStatusTriggerHandler.CHANGE_MODULE_TYPE_ID.equals(moduleTypeUID) || ThingStatusTriggerHandler.UPDATE_MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new ThingStatusTriggerHandler((Trigger) module, bundleContext);
} else if (ItemStateTriggerHandler.CHANGE_MODULE_TYPE_ID.equals(moduleTypeUID) || ItemStateTriggerHandler.UPDATE_MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new ItemStateTriggerHandler((Trigger) module, bundleContext);
} else if (GroupCommandTriggerHandler.MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new GroupCommandTriggerHandler((Trigger) module, bundleContext, itemRegistry);
} else if (GroupStateTriggerHandler.CHANGE_MODULE_TYPE_ID.equals(moduleTypeUID) || GroupStateTriggerHandler.UPDATE_MODULE_TYPE_ID.equals(moduleTypeUID)) {
return new GroupStateTriggerHandler((Trigger) module, bundleContext, itemRegistry);
}
} else if (module instanceof Condition) {
// Handle conditions
if (ItemStateConditionHandler.ITEM_STATE_CONDITION.equals(moduleTypeUID)) {
return new ItemStateConditionHandler((Condition) module, itemRegistry);
} else if (GenericEventConditionHandler.MODULETYPE_ID.equals(moduleTypeUID)) {
return new GenericEventConditionHandler((Condition) module);
} else if (CompareConditionHandler.MODULE_TYPE.equals(moduleTypeUID)) {
return new CompareConditionHandler((Condition) module);
}
} else if (module instanceof Action) {
// Handle actions
if (ItemCommandActionHandler.ITEM_COMMAND_ACTION.equals(moduleTypeUID)) {
return new ItemCommandActionHandler((Action) module, eventPublisher, itemRegistry);
} else if (ItemStateUpdateActionHandler.ITEM_STATE_UPDATE_ACTION.equals(moduleTypeUID)) {
return new ItemStateUpdateActionHandler((Action) module, eventPublisher, itemRegistry);
} else if (RuleEnablementActionHandler.UID.equals(moduleTypeUID)) {
return new RuleEnablementActionHandler((Action) module);
} else if (RunRuleActionHandler.UID.equals(moduleTypeUID)) {
return new RunRuleActionHandler((Action) module);
}
}
logger.error("The ModuleHandler is not supported: {}", moduleTypeUID);
return null;
}
Aggregations