2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.io.imperihome.internal.action;
15 import java.util.HashMap;
18 import org.openhab.core.events.EventPublisher;
19 import org.openhab.io.imperihome.internal.processor.DeviceRegistry;
22 * Action registry. Maps ImperiHome API action name to {@link Action} implementation.
24 * @author Pepijn de Geus - Initial contribution
26 public class ActionRegistry {
28 private final Map<String, Action> actions = new HashMap<>();
30 public ActionRegistry(EventPublisher eventPublisher, DeviceRegistry deviceRegistry) {
31 actions.put("setStatus", new SetStatusAction(eventPublisher));
32 actions.put("setColor", new SetColorAction(eventPublisher));
33 actions.put("setLevel", new SetLevelAction(eventPublisher));
34 actions.put("setChoice", new SetChoiceAction(eventPublisher));
35 actions.put("setMode", new SetModeAction(eventPublisher, deviceRegistry));
36 actions.put("setSetPoint", new SetSetPointAction(eventPublisher));
37 actions.put("launchScene", new LaunchSceneAction(eventPublisher));
38 actions.put("stopShutter", new StopShutterAction(eventPublisher, deviceRegistry));
41 public Action get(String action) {
42 return actions.get(action);