public FolderObserver() { super(ConfigConstants.getConfigFolder()); }
public ZigBeeNetworkStateSerializerImpl(String networkId) { this.networkId = networkId; networkStateFilePath = ConfigConstants.getUserDataFolder() + "/" + ZigBeeBindingConstants.BINDING_ID; }
/** * Returns the path to the root of the transformation folder */ protected String getSourcePath() { return ConfigConstants.getConfigFolder() + File.separator + TransformationService.TRANSFORM_FOLDER_NAME + File.separator; }
static public String buildString() { Properties prop = new Properties(); Path versionFilePath = Paths.get(ConfigConstants.getUserDataFolder(), "etc", "version.properties"); try (FileInputStream fis = new FileInputStream(versionFilePath.toFile())) { prop.load(fis); String buildNo = prop.getProperty("build-no"); if (buildNo != null && !buildNo.isEmpty()) { return buildNo; } } catch (Exception e) { // ignore if the file is not there or not readable } return "Unknown Build No."; } }
public AbstractFileProvider(String root) { this.rootSubdirectory = root; configurationRoots = new String[] { ConfigConstants.getConfigFolder() + File.separator + "automation" }; }
private void setLegacyRepoUrl() { Properties prop = new Properties(); Path versionFilePath = Paths.get(ConfigConstants.getUserDataFolder(), "etc", "version.properties"); try (FileInputStream fis = new FileInputStream(versionFilePath.toFile())) { prop.load(fis); } catch (Exception e) { logger.warn("Cannot determine distro version - legacy addon support will be disabled. Error: {}", e.getMessage()); } String version = prop.getProperty("openhab-distro"); if (version != null && !version.trim().isEmpty()) { this.legacy_addons_url = URI .create("mvn:org.openhab.distro/openhab-addons-legacy/" + version.trim() + "/xml/features"); } else { logger.warn("Cannot determine distro version - legacy addon support will be disabled."); } }
public FolderObserver() { super(ConfigConstants.getConfigFolder()); }
private void setOnlineRepoUrl() { Properties prop = new Properties(); Path versionFilePath = Paths.get(ConfigConstants.getUserDataFolder(), "etc", "version.properties"); try (FileInputStream fis = new FileInputStream(versionFilePath.toFile())) { prop.load(fis); } catch (Exception e) { logger.warn("Cannot determine online repo url - online repo support will be disabled. Error: {}", e.getMessage()); } String repo = prop.getProperty("online-repo"); if (repo != null && !repo.trim().isEmpty()) { this.online_repo_url = repo.trim() + "@id=openhab@snapshots"; } else { logger.warn("Cannot determine online repo url - online repo support will be disabled."); } }
public ScriptFileWatcher() { super(ConfigConstants.getConfigFolder() + File.separator + FILE_DIRECTORY); }
@Activate public void activate() { dbFolderName = ConfigConstants.getUserDataFolder() + File.separator + dbFolderName; File folder = new File(dbFolderName); if (!folder.exists()) { folder.mkdirs(); } File dbFile = new File(dbFolderName, DB_FILE_NAME); db = DBMaker.newFileDB(dbFile).closeOnJvmShutdown().make(); logger.debug("Opened MapDB file at '{}'.", dbFile.getAbsolutePath()); }
private static String getPathToWatch() { String progArg = System.getProperty(SERVICEDIR_PROG_ARGUMENT); if (progArg != null) { return ConfigConstants.getConfigFolder() + File.separator + progArg; } else { return ConfigConstants.getConfigFolder() + File.separator + SERVICES_FOLDER; } }
@Activate protected void activate(ComponentContext cContext, Map<String, Object> properties) { dbFolderName = ConfigConstants.getUserDataFolder() + File.separator + dbFolderName; File folder = new File(dbFolderName); if (!folder.exists()) {
/** * Returns the {@link File} object for the given filename. <br /> * It must be contained in the configuration folder * * @param filename * the file name to get the {@link File} for * @return the corresponding {@link File} */ private File getFile(String filename) { return new File(ConfigConstants.getConfigFolder() + File.separator + filename); }
/** * Retrieves a unified unique id, based on {@link java.util.UUID.randomUUID()} * * @return a UUID which identifies the instance or null, if uuid cannot be persisted */ public static synchronized String get() { if (uuid == null) { try { File file = new File(ConfigConstants.getUserDataFolder() + File.separator + UUID_FILE_NAME); if (!file.exists()) { uuid = java.util.UUID.randomUUID().toString(); writeFile(file, uuid); } else { uuid = readFirstLine(file); if (StringUtils.isNotEmpty(uuid)) { LOGGER.debug("UUID '{}' has been restored from file '{}'", file.getAbsolutePath(), uuid); } else { uuid = java.util.UUID.randomUUID().toString(); LOGGER.warn("UUID file '{}' has no content, rewriting it now with '{}'", file.getAbsolutePath(), uuid); writeFile(file, uuid); } } } catch (IOException e) { LOGGER.error("Failed writing instance uuid file: {}", e.getMessage()); return null; } } return uuid; }
private String getDefaultServiceConfigPath() { String progArg = System.getProperty(SERVICECFG_PROG_ARGUMENT); if (progArg != null) { return progArg; } else { return ConfigConstants.getConfigFolder() + File.separator + SERVICE_CFG_FILE; } }
/** * Retrieves a unified unique id, based on {@link java.util.UUID.randomUUID()} * * @return a UUID which identifies the instance or null, if uuid cannot be persisted */ public static synchronized String get() { if (uuid == null) { try { File file = new File(ConfigConstants.getUserDataFolder() + File.separator + UUID_FILE_NAME); if (!file.exists()) { uuid = java.util.UUID.randomUUID().toString(); writeFile(file, uuid); } else { uuid = readFirstLine(file); if (StringUtils.isNotEmpty(uuid)) { logger.debug("UUID '{}' has been restored from file '{}'", file.getAbsolutePath(), uuid); } else { uuid = java.util.UUID.randomUUID().toString(); logger.warn("UUID file '{}' has no content, rewriting it now with '{}'", file.getAbsolutePath(), uuid); writeFile(file, uuid); } } } catch (IOException e) { logger.error("Failed writing instance uuid file: {}", e.getMessage()); return null; } } return uuid; }
/** * Returns the {@link File} object for the given filename. <br /> * It must be contained in the configuration folder * * @param filename * the file name to get the {@link File} for * @return the corresponding {@link File} */ private File getFile(String filename) { return new File(ConfigConstants.getConfigFolder() + File.separator + filename); }
logger.trace("Initializing ZWaveNodeSerializer."); folderName = ConfigConstants.getUserDataFolder() + "/" + ZWaveBindingConstants.BINDING_ID;
private File getIconFile(String filename, String iconSetId) { File folder = new File( ConfigConstants.getConfigFolder() + File.separator + "icons" + File.separator + iconSetId); File file = new File(folder, filename); if (file.exists()) { return file; } else { return null; } }
persistencePath = Paths.get(ConfigConstants.getUserDataFolder()).resolve("mqtt").resolve(host);