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 org.openhab.core.events.EventPublisher;
16 import org.openhab.core.items.Item;
17 import org.openhab.io.imperihome.internal.model.device.AbstractDevice;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * Abstract action, called through the API by ImperiHome clients.
24 * @author Pepijn de Geus - Initial contribution
26 public abstract class Action {
28 protected final transient Logger logger = LoggerFactory.getLogger(getClass());
30 protected static final String COMMAND_SOURCE = "imperihome";
32 protected final EventPublisher eventPublisher;
34 protected Action(EventPublisher eventPublisher) {
35 this.eventPublisher = eventPublisher;
39 * Indicates if this action can be performed on the given Item.
42 * @param item Item to check compatibility with.
43 * @return True if the Item is supported.
45 public abstract boolean supports(AbstractDevice device, Item item);
48 * Perform this action on the given Item.
51 * @param item Item to perform action on.
52 * @param value Action parameter value.
54 public abstract void perform(AbstractDevice device, Item item, String value);