mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Fix ConfigConstants deprecations (#8525)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
7f39d01a0f
commit
0c11a21d90
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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<URL> 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) {
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -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 */
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user