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.binding.dsmr.internal.discovery;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.i18n.LocaleProvider;
18 import org.openhab.core.i18n.TranslationProvider;
19 import org.openhab.core.thing.binding.ThingHandlerService;
20 import org.osgi.service.component.annotations.Activate;
21 import org.osgi.service.component.annotations.Component;
22 import org.osgi.service.component.annotations.Deactivate;
23 import org.osgi.service.component.annotations.Reference;
26 * Tracks the i18n provider dependencies of the {@link DSMRMeterDiscoveryService}. The {@link DSMRMeterDiscoveryService}
27 * is a {@link ThingHandlerService} so its i18n dependencies cannot be injected using service component annotations.
29 * @author Wouter Born - Initial contribution
33 public class DSMRI18nProviderTracker {
35 static @Nullable TranslationProvider i18nProvider;
36 static @Nullable LocaleProvider localeProvider;
39 public DSMRI18nProviderTracker(final @Reference TranslationProvider i18nProvider,
40 final @Reference LocaleProvider localeProvider) {
41 DSMRI18nProviderTracker.i18nProvider = i18nProvider;
42 DSMRI18nProviderTracker.localeProvider = localeProvider;
46 public void deactivate() {
48 localeProvider = null;