From 0c11a21d9029d6cf081ff6cef09159e023f58bfe Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Mon, 21 Sep 2020 22:57:04 +0200 Subject: [PATCH] Fix ConfigConstants deprecations (#8525) Signed-off-by: Wouter Born --- .../chromecast/internal/utils/ByteArrayFileCache.java | 4 ++-- .../darksky/internal/utils/ByteArrayFileCache.java | 4 ++-- .../darksky/internal/utils/ByteArrayFileCacheTest.java | 4 ++-- .../binding/exec/internal/ExecWhitelistWatchService.java | 4 ++-- .../icalendar/internal/handler/ICalendarHandler.java | 4 ++-- .../binding/kodi/internal/utils/ByteArrayFileCache.java | 4 ++-- .../kodi/internal/utils/ByteArrayFileCacheTest.java | 4 ++-- .../org/openhab/binding/max/internal/MaxBackupUtils.java | 4 ++-- .../org/openhab/binding/meteoblue/internal/Forecast.java | 4 ++-- .../miio/internal/basic/MiIoDatabaseWatchService.java | 6 +++--- .../openhab/binding/miio/internal/cloud/CloudUtil.java | 4 ++-- .../binding/miio/internal/handler/MiIoVacuumHandler.java | 5 ++--- .../openweathermap/internal/utils/ByteArrayFileCache.java | 4 ++-- .../internal/protocol/AbstractConnection.java | 4 ++-- .../internal/EmbeddedBrokerService.java | 4 ++-- .../internal/MqttEmbeddedBrokerServiceTest.java | 4 ++-- .../java/org/openhab/io/neeo/internal/NeeoConstants.java | 8 ++++---- .../openhab/io/openhabcloud/internal/CloudService.java | 3 +-- .../internal/ExecTransformationWhitelistWatchService.java | 4 ++-- .../javascript/internal/TransformationScriptWatcher.java | 4 ++-- .../xslt/internal/XsltTransformationService.java | 6 +++--- .../openhab/voice/pollytts/internal/PollyTTSService.java | 4 ++-- .../voice/voicerss/internal/VoiceRSSTTSService.java | 4 ++-- 23 files changed, 49 insertions(+), 51 deletions(-) diff --git a/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/utils/ByteArrayFileCache.java b/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/utils/ByteArrayFileCache.java index 83ef8c254..da8bc5918 100644 --- a/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/utils/ByteArrayFileCache.java +++ b/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/utils/ByteArrayFileCache.java @@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +64,7 @@ public class ByteArrayFileCache { public ByteArrayFileCache(String servicePID) { // TODO track and limit folder size // TODO support user specific folder - cacheFolder = new File(new File(ConfigConstants.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); + cacheFolder = new File(new File(OpenHAB.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); if (!cacheFolder.exists()) { logger.debug("Creating cache folder '{}'", cacheFolder.getAbsolutePath()); cacheFolder.mkdirs(); diff --git a/bundles/org.openhab.binding.darksky/src/main/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCache.java b/bundles/org.openhab.binding.darksky/src/main/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCache.java index adbda0bb7..2bc89ff05 100644 --- a/bundles/org.openhab.binding.darksky/src/main/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCache.java +++ b/bundles/org.openhab.binding.darksky/src/main/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCache.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class ByteArrayFileCache { public ByteArrayFileCache(String servicePID) { // TODO track and limit folder size // TODO support user specific folder - cacheFolder = new File(new File(ConfigConstants.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); + cacheFolder = new File(new File(OpenHAB.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); if (!cacheFolder.exists()) { logger.debug("Creating cache folder '{}'", cacheFolder.getAbsolutePath()); cacheFolder.mkdirs(); diff --git a/bundles/org.openhab.binding.darksky/src/test/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCacheTest.java b/bundles/org.openhab.binding.darksky/src/test/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCacheTest.java index eb1ab1075..a0d8bd4c3 100644 --- a/bundles/org.openhab.binding.darksky/src/test/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCacheTest.java +++ b/bundles/org.openhab.binding.darksky/src/test/java/org/openhab/binding/darksky/internal/utils/ByteArrayFileCacheTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; /** * Test class for the {@link ByteArrayFileCache} class. @@ -34,7 +34,7 @@ public class ByteArrayFileCacheTest { private static final String SERVICE_PID = "org.openhab.binding.darksky"; - private static final File USERDATA_FOLDER = new File(ConfigConstants.getUserDataFolder()); + private static final File USERDATA_FOLDER = new File(OpenHAB.getUserDataFolder()); private static final File CACHE_FOLDER = new File(USERDATA_FOLDER, ByteArrayFileCache.CACHE_FOLDER_NAME); private static final File SERVICE_CACHE_FOLDER = new File(CACHE_FOLDER, SERVICE_PID); diff --git a/bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecWhitelistWatchService.java b/bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecWhitelistWatchService.java index d1d016f18..cdafd275f 100644 --- a/bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecWhitelistWatchService.java +++ b/bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecWhitelistWatchService.java @@ -26,7 +26,7 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.service.AbstractWatchService; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; @Component(service = ExecWhitelistWatchService.class) @NonNullByDefault public class ExecWhitelistWatchService extends AbstractWatchService { - private static final String COMMAND_WHITELIST_PATH = ConfigConstants.getConfigFolder() + File.separator + "misc"; + private static final String COMMAND_WHITELIST_PATH = OpenHAB.getConfigFolder() + File.separator + "misc"; private static final String COMMAND_WHITELIST_FILE = "exec.whitelist"; private final Logger logger = LoggerFactory.getLogger(ExecWhitelistWatchService.class); diff --git a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/ICalendarHandler.java b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/ICalendarHandler.java index 40c346cee..5f943544e 100644 --- a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/ICalendarHandler.java +++ b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/handler/ICalendarHandler.java @@ -35,7 +35,7 @@ import org.openhab.binding.icalendar.internal.logic.CalendarException; import org.openhab.binding.icalendar.internal.logic.CommandTag; import org.openhab.binding.icalendar.internal.logic.CommandTagType; import org.openhab.binding.icalendar.internal.logic.Event; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.events.ItemEventFactory; import org.openhab.core.library.types.DateTimeType; @@ -75,7 +75,7 @@ public class ICalendarHandler extends BaseThingHandler implements CalendarUpdate public ICalendarHandler(Thing thing, HttpClient httpClient, EventPublisher eventPublisher) { super(thing); this.httpClient = httpClient; - calendarFile = new File(ConfigConstants.getUserDataFolder() + File.separator + calendarFile = new File(OpenHAB.getUserDataFolder() + File.separator + getThing().getUID().getAsString().replaceAll("[<>:\"/\\\\|?*]", "_") + ".ical"); eventPublisherCallback = eventPublisher; updateStatesLastCalledTime = Instant.now(); diff --git a/bundles/org.openhab.binding.kodi/src/main/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCache.java b/bundles/org.openhab.binding.kodi/src/main/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCache.java index 9a2635862..9eced3e4a 100644 --- a/bundles/org.openhab.binding.kodi/src/main/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCache.java +++ b/bundles/org.openhab.binding.kodi/src/main/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCache.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class ByteArrayFileCache { public ByteArrayFileCache(String servicePID) { // TODO track and limit folder size // TODO support user specific folder - cacheFolder = new File(new File(ConfigConstants.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); + cacheFolder = new File(new File(OpenHAB.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); if (!cacheFolder.exists()) { logger.debug("Creating cache folder '{}'", cacheFolder.getAbsolutePath()); cacheFolder.mkdirs(); diff --git a/bundles/org.openhab.binding.kodi/src/test/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCacheTest.java b/bundles/org.openhab.binding.kodi/src/test/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCacheTest.java index 79d5ef977..cee8c42cb 100644 --- a/bundles/org.openhab.binding.kodi/src/test/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCacheTest.java +++ b/bundles/org.openhab.binding.kodi/src/test/java/org/openhab/binding/kodi/internal/utils/ByteArrayFileCacheTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; /** * Test class for the {@link ByteArrayFileCache} class. @@ -34,7 +34,7 @@ public class ByteArrayFileCacheTest { private static final String SERVICE_PID = "org.openhab.binding.kodi"; - private static final File USERDATA_FOLDER = new File(ConfigConstants.getUserDataFolder()); + private static final File USERDATA_FOLDER = new File(OpenHAB.getUserDataFolder()); private static final File CACHE_FOLDER = new File(USERDATA_FOLDER, ByteArrayFileCache.CACHE_FOLDER_NAME); private static final File SERVICE_CACHE_FOLDER = new File(CACHE_FOLDER, SERVICE_PID); diff --git a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/MaxBackupUtils.java b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/MaxBackupUtils.java index d679b3661..17e79daa0 100644 --- a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/MaxBackupUtils.java +++ b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/MaxBackupUtils.java @@ -19,7 +19,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class MaxBackupUtils { public MaxBackupUtils(String backupId) { this.backupId = backupId; - dbFolderName = ConfigConstants.getUserDataFolder() + File.separator + BACKUP_PATH; + dbFolderName = OpenHAB.getUserDataFolder() + File.separator + BACKUP_PATH; File folder = new File(dbFolderName); if (!folder.exists()) { folder.mkdirs(); diff --git a/bundles/org.openhab.binding.meteoblue/src/main/java/org/openhab/binding/meteoblue/internal/Forecast.java b/bundles/org.openhab.binding.meteoblue/src/main/java/org/openhab/binding/meteoblue/internal/Forecast.java index 241e4f1a7..ce3c9e555 100644 --- a/bundles/org.openhab.binding.meteoblue/src/main/java/org/openhab/binding/meteoblue/internal/Forecast.java +++ b/bundles/org.openhab.binding.meteoblue/src/main/java/org/openhab/binding/meteoblue/internal/Forecast.java @@ -29,7 +29,7 @@ import javax.imageio.ImageIO; import org.openhab.binding.meteoblue.internal.json.JsonDataDay; import org.openhab.binding.meteoblue.internal.json.JsonMetadata; import org.openhab.binding.meteoblue.internal.json.JsonUnits; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -457,7 +457,7 @@ public class Forecast { private Image loadImageIcon(String imageFileName) { BufferedImage buf = null; - String configDirectory = ConfigConstants.getConfigFolder(); + String configDirectory = OpenHAB.getConfigFolder(); File dataFile = new File(new File(configDirectory, "icons/classic/"), imageFileName); if (!dataFile.exists()) { logger.debug("Image file '{}' does not exist. Unable to create imageIcon.", dataFile.getAbsolutePath()); diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/MiIoDatabaseWatchService.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/MiIoDatabaseWatchService.java index f31e31842..3ed3c0b9f 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/MiIoDatabaseWatchService.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/MiIoDatabaseWatchService.java @@ -33,7 +33,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.miio.internal.MiIoBindingConstants; import org.openhab.binding.miio.internal.Utils; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.service.AbstractWatchService; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; @@ -56,7 +56,7 @@ import com.google.gson.JsonSyntaxException; @Component(service = MiIoDatabaseWatchService.class) @NonNullByDefault public class MiIoDatabaseWatchService extends AbstractWatchService { - private static final String LOCAL_DATABASE_PATH = ConfigConstants.getConfigFolder() + File.separator + "misc" + private static final String LOCAL_DATABASE_PATH = OpenHAB.getConfigFolder() + File.separator + "misc" + File.separator + BINDING_ID; private static final String DATABASE_FILES = ".json"; private static final Gson GSON = new GsonBuilder().serializeNulls().create(); @@ -132,7 +132,7 @@ public class MiIoDatabaseWatchService extends AbstractWatchService { List urlEntries = new ArrayList<>(); Bundle bundle = FrameworkUtil.getBundle(getClass()); urlEntries.addAll(Collections.list(bundle.findEntries(MiIoBindingConstants.DATABASE_PATH, "*.json", false))); - String userDbFolder = ConfigConstants.getConfigFolder() + File.separator + "misc" + File.separator + BINDING_ID; + String userDbFolder = OpenHAB.getConfigFolder() + File.separator + "misc" + File.separator + BINDING_ID; try { File[] userDbFiles = new File(userDbFolder).listFiles((dir, name) -> name.endsWith(".json")); if (userDbFiles != null) { diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudUtil.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudUtil.java index 6f61c00c7..df947a5ae 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudUtil.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudUtil.java @@ -34,7 +34,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.miio.internal.MiIoBindingConstants; import org.openhab.binding.miio.internal.MiIoCryptoException; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; /** @@ -46,7 +46,7 @@ import org.slf4j.Logger; public class CloudUtil { private static final Random RANDOM = new Random(); - private static final String DB_FOLDER_NAME = ConfigConstants.getUserDataFolder() + File.separator + private static final String DB_FOLDER_NAME = OpenHAB.getUserDataFolder() + File.separator + MiIoBindingConstants.BINDING_ID; /** diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java index 1b1d6f790..56981c1b9 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoVacuumHandler.java @@ -46,8 +46,8 @@ import org.openhab.binding.miio.internal.robot.StatusDTO; import org.openhab.binding.miio.internal.robot.StatusType; import org.openhab.binding.miio.internal.robot.VacuumErrorType; import org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication; +import org.openhab.core.OpenHAB; import org.openhab.core.cache.ExpiringCache; -import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; @@ -84,8 +84,7 @@ public class MiIoVacuumHandler extends MiIoAbstractHandler { private final Logger logger = LoggerFactory.getLogger(MiIoVacuumHandler.class); private static final float MAP_SCALE = 2.0f; private static final SimpleDateFormat DATEFORMATTER = new SimpleDateFormat("yyyyMMdd-HHmmss"); - private static final String MAP_PATH = ConfigConstants.getUserDataFolder() + File.separator + BINDING_ID - + File.separator; + private static final String MAP_PATH = OpenHAB.getUserDataFolder() + File.separator + BINDING_ID + File.separator; private static final Gson GSON = new GsonBuilder().serializeNulls().create(); private final ChannelUID mapChannelUid; diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/utils/ByteArrayFileCache.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/utils/ByteArrayFileCache.java index 927625cdf..e2edd6b61 100644 --- a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/utils/ByteArrayFileCache.java +++ b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/utils/ByteArrayFileCache.java @@ -23,7 +23,7 @@ import java.util.Arrays; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +45,7 @@ public class ByteArrayFileCache { public ByteArrayFileCache(String servicePID) { // TODO track and limit folder size // TODO support user specific folder - cacheFolder = new File(new File(new File(ConfigConstants.getUserDataFolder()), CACHE_FOLDER_NAME), servicePID); + cacheFolder = new File(new File(new File(OpenHAB.getUserDataFolder()), CACHE_FOLDER_NAME), servicePID); if (!cacheFolder.exists()) { logger.debug("Creating cache folder '{}'", cacheFolder.getAbsolutePath()); cacheFolder.mkdirs(); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java index 208c09cc3..c8dcd6667 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java @@ -17,7 +17,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +56,7 @@ public abstract class AbstractConnection { public void setProtocolSnifferEnable(boolean enable) { if (enable) { - File pathWithoutFilename = new File(ConfigConstants.getUserDataFolder()); + File pathWithoutFilename = new File(OpenHAB.getUserDataFolder()); pathWithoutFilename.mkdirs(); File file = new File(pathWithoutFilename, "yamaha_trace.log"); if (file.exists()) { diff --git a/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java b/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java index 010565551..f7b15583a 100644 --- a/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java +++ b/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java @@ -35,7 +35,7 @@ import javax.net.ssl.KeyManagerFactory; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.config.core.Configuration; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; @@ -177,7 +177,7 @@ public class EmbeddedBrokerService if (!config.persistenceFile.isEmpty()) { final String persistenceFilename = config.persistenceFile; if (!Paths.get(persistenceFilename).isAbsolute()) { - Path path = Paths.get(ConfigConstants.getUserDataFolder()).toAbsolutePath(); + Path path = Paths.get(OpenHAB.getUserDataFolder()).toAbsolutePath(); Files.createDirectories(path); this.persistenceFilename = path.resolve(persistenceFilename).toString(); } diff --git a/bundles/org.openhab.io.mqttembeddedbroker/src/test/java/org/openhab/io/mqttembeddedbroker/internal/MqttEmbeddedBrokerServiceTest.java b/bundles/org.openhab.io.mqttembeddedbroker/src/test/java/org/openhab/io/mqttembeddedbroker/internal/MqttEmbeddedBrokerServiceTest.java index 9a742771b..92eb4f408 100644 --- a/bundles/org.openhab.io.mqttembeddedbroker/src/test/java/org/openhab/io/mqttembeddedbroker/internal/MqttEmbeddedBrokerServiceTest.java +++ b/bundles/org.openhab.io.mqttembeddedbroker/src/test/java/org/openhab/io/mqttembeddedbroker/internal/MqttEmbeddedBrokerServiceTest.java @@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection.Protocol; import org.openhab.core.io.transport.mqtt.MqttConnectionObserver; @@ -157,7 +157,7 @@ public class MqttEmbeddedBrokerServiceTest extends JavaTest { @Test public void testPersistence() throws InterruptedException, IOException, ExecutionException { config.put("persistenceFile", "persist.mqtt"); - Path path = Paths.get(ConfigConstants.getUserDataFolder()).toAbsolutePath(); + Path path = Paths.get(OpenHAB.getUserDataFolder()).toAbsolutePath(); File jksFile = path.resolve("persist.mqtt").toFile(); if (jksFile.exists()) { diff --git a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoConstants.java b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoConstants.java index 6b744af5b..9bfbf6ae7 100644 --- a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoConstants.java +++ b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoConstants.java @@ -15,7 +15,7 @@ package org.openhab.io.neeo.internal; import java.io.File; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; /** * The constants class for the NEEO Integration @@ -73,9 +73,9 @@ public class NeeoConstants { public static final String PROTOCOL = "http://"; /** The device definitions file name */ - public static final String FILENAME_DEVICEDEFINITIONS = ConfigConstants.getUserDataFolder() + File.separator - + "neeo" + File.separator + "neeodefinitions.json"; - public static final String FILENAME_DISCOVEREDBRAINS = ConfigConstants.getUserDataFolder() + File.separator + "neeo" + public static final String FILENAME_DEVICEDEFINITIONS = OpenHAB.getUserDataFolder() + File.separator + "neeo" + + File.separator + "neeodefinitions.json"; + public static final String FILENAME_DISCOVEREDBRAINS = OpenHAB.getUserDataFolder() + File.separator + "neeo" + File.separator + "discoveredbrains.json"; /** The search threshold value */ diff --git a/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/internal/CloudService.java b/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/internal/CloudService.java index 033eeda6d..e2f7137c3 100644 --- a/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/internal/CloudService.java +++ b/bundles/org.openhab.io.openhabcloud/src/main/java/org/openhab/io/openhabcloud/internal/CloudService.java @@ -31,7 +31,6 @@ import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.eclipse.jetty.client.HttpClient; import org.openhab.core.OpenHAB; -import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; @@ -291,7 +290,7 @@ public class CloudService implements ActionService, CloudClientListener, EventSu * Returns either existing secret from the file or newly created secret. */ private String getSecret() { - File file = new File(ConfigConstants.getUserDataFolder() + File.separator + SECRET_FILE_NAME); + File file = new File(OpenHAB.getUserDataFolder() + File.separator + SECRET_FILE_NAME); String newSecretString = ""; if (!file.exists()) { diff --git a/bundles/org.openhab.transform.exec/src/main/java/org/openhab/transform/exec/internal/ExecTransformationWhitelistWatchService.java b/bundles/org.openhab.transform.exec/src/main/java/org/openhab/transform/exec/internal/ExecTransformationWhitelistWatchService.java index 77ca8ea3e..eb283c38c 100644 --- a/bundles/org.openhab.transform.exec/src/main/java/org/openhab/transform/exec/internal/ExecTransformationWhitelistWatchService.java +++ b/bundles/org.openhab.transform.exec/src/main/java/org/openhab/transform/exec/internal/ExecTransformationWhitelistWatchService.java @@ -26,7 +26,7 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.service.AbstractWatchService; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; @Component(service = ExecTransformationWhitelistWatchService.class) @NonNullByDefault public class ExecTransformationWhitelistWatchService extends AbstractWatchService { - private static final String COMMAND_WHITELIST_PATH = ConfigConstants.getConfigFolder() + File.separator + "misc"; + private static final String COMMAND_WHITELIST_PATH = OpenHAB.getConfigFolder() + File.separator + "misc"; private static final String COMMAND_WHITELIST_FILE = "exec.whitelist"; private final Logger logger = LoggerFactory.getLogger(ExecTransformationWhitelistWatchService.class); diff --git a/bundles/org.openhab.transform.javascript/src/main/java/org/openhab/transform/javascript/internal/TransformationScriptWatcher.java b/bundles/org.openhab.transform.javascript/src/main/java/org/openhab/transform/javascript/internal/TransformationScriptWatcher.java index 5ad9e6177..cb2d34948 100644 --- a/bundles/org.openhab.transform.javascript/src/main/java/org/openhab/transform/javascript/internal/TransformationScriptWatcher.java +++ b/bundles/org.openhab.transform.javascript/src/main/java/org/openhab/transform/javascript/internal/TransformationScriptWatcher.java @@ -19,7 +19,7 @@ import java.nio.file.Path; import java.nio.file.WatchEvent; import java.nio.file.WatchEvent.Kind; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.service.AbstractWatchService; import org.openhab.core.transform.TransformationService; import org.osgi.service.component.annotations.Component; @@ -35,7 +35,7 @@ import org.osgi.service.component.annotations.Reference; @Component() public class TransformationScriptWatcher extends AbstractWatchService { - public static final String TRANSFORM_FOLDER = ConfigConstants.getConfigFolder() + File.separator + public static final String TRANSFORM_FOLDER = OpenHAB.getConfigFolder() + File.separator + TransformationService.TRANSFORM_FOLDER_NAME; private JavaScriptEngineManager manager; diff --git a/bundles/org.openhab.transform.xslt/src/main/java/org/openhab/transform/xslt/internal/XsltTransformationService.java b/bundles/org.openhab.transform.xslt/src/main/java/org/openhab/transform/xslt/internal/XsltTransformationService.java index 3433b9a62..8653bc622 100644 --- a/bundles/org.openhab.transform.xslt/src/main/java/org/openhab/transform/xslt/internal/XsltTransformationService.java +++ b/bundles/org.openhab.transform.xslt/src/main/java/org/openhab/transform/xslt/internal/XsltTransformationService.java @@ -24,7 +24,7 @@ import javax.xml.transform.stream.StreamSource; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.OpenHAB; import org.openhab.core.transform.TransformationException; import org.openhab.core.transform.TransformationService; import org.osgi.service.component.annotations.Component; @@ -63,8 +63,8 @@ public class XsltTransformationService implements TransformationService { Source xsl = null; try { - String path = ConfigConstants.getConfigFolder() + File.separator - + TransformationService.TRANSFORM_FOLDER_NAME + File.separator + filename; + String path = OpenHAB.getConfigFolder() + File.separator + TransformationService.TRANSFORM_FOLDER_NAME + + File.separator + filename; xsl = new StreamSource(new File(path)); } catch (Exception e) { String message = "opening file '" + filename + "' throws exception"; diff --git a/bundles/org.openhab.voice.pollytts/src/main/java/org/openhab/voice/pollytts/internal/PollyTTSService.java b/bundles/org.openhab.voice.pollytts/src/main/java/org/openhab/voice/pollytts/internal/PollyTTSService.java index 2c0cdaa09..42f336377 100644 --- a/bundles/org.openhab.voice.pollytts/src/main/java/org/openhab/voice/pollytts/internal/PollyTTSService.java +++ b/bundles/org.openhab.voice.pollytts/src/main/java/org/openhab/voice/pollytts/internal/PollyTTSService.java @@ -24,10 +24,10 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import org.openhab.core.OpenHAB; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioStream; -import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.voice.TTSException; import org.openhab.core.voice.TTSService; @@ -108,7 +108,7 @@ public class PollyTTSService implements TTSService { logger.debug("Using configuration {}", config); // create cache folder - File cacheFolder = new File(new File(ConfigConstants.getUserDataFolder(), CACHE_FOLDER_NAME), SERVICE_PID); + File cacheFolder = new File(new File(OpenHAB.getUserDataFolder(), CACHE_FOLDER_NAME), SERVICE_PID); if (!cacheFolder.exists()) { cacheFolder.mkdirs(); } diff --git a/bundles/org.openhab.voice.voicerss/src/main/java/org/openhab/voice/voicerss/internal/VoiceRSSTTSService.java b/bundles/org.openhab.voice.voicerss/src/main/java/org/openhab/voice/voicerss/internal/VoiceRSSTTSService.java index f20cbc790..8a627aa32 100644 --- a/bundles/org.openhab.voice.voicerss/src/main/java/org/openhab/voice/voicerss/internal/VoiceRSSTTSService.java +++ b/bundles/org.openhab.voice.voicerss/src/main/java/org/openhab/voice/voicerss/internal/VoiceRSSTTSService.java @@ -20,10 +20,10 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import org.openhab.core.OpenHAB; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioStream; -import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.voice.TTSException; import org.openhab.core.voice.TTSService; @@ -220,7 +220,7 @@ public class VoiceRSSTTSService implements TTSService { private String getCacheFolderName() { // we assume that this folder does NOT have a trailing separator - return ConfigConstants.getUserDataFolder() + File.separator + CACHE_FOLDER_NAME; + return OpenHAB.getUserDataFolder() + File.separator + CACHE_FOLDER_NAME; } @Override