2 * Copyright (c) 2010-2022 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.automation.pidcontroller.internal.template;
15 import java.util.Collection;
16 import java.util.Locale;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.core.automation.template.RuleTemplate;
22 import org.openhab.core.automation.template.RuleTemplateProvider;
23 import org.openhab.core.common.registry.ProviderChangeListener;
24 import org.osgi.service.component.annotations.Component;
28 * @author Hilbrand Bouwkamp - Initial Contribution
32 public class PIDControllerTemplateProvider implements RuleTemplateProvider {
33 private static final RuleTemplate PROVIDED_RULE_TEMPLATE = PIDControllerRuleTemplate.initialize();
36 public @Nullable RuleTemplate getTemplate(String uid, @Nullable Locale locale) {
37 return uid.equals(PIDControllerRuleTemplate.UID) ? PROVIDED_RULE_TEMPLATE : null;
41 public Collection<RuleTemplate> getTemplates(@Nullable Locale locale) {
42 return Set.of(PROVIDED_RULE_TEMPLATE);
46 public void addProviderChangeListener(ProviderChangeListener<RuleTemplate> listener) {
47 // does nothing because this provider does not change
51 public Collection<RuleTemplate> getAll() {
52 return Set.of(PROVIDED_RULE_TEMPLATE);
56 public void removeProviderChangeListener(ProviderChangeListener<RuleTemplate> listener) {
57 // does nothing because this provider does not change