/** * Undoes changes to the staged in-memory halconfig. */ public void undoChanges() { DaemonTaskHandler.setContext(null); }
/** * Undoes changes to the staged in-memory halconfig. */ public void undoChanges() { DaemonTaskHandler.setContext(null); }
public void switchToPrimaryConfig() { DaemonTaskHandler.setContext(null); useBackup = false; }
public void switchToPrimaryConfig() { DaemonTaskHandler.setContext(null); useBackup = false; }
public void switchToBackupConfig() { DaemonTaskHandler.setContext(null); backupHalconfigPath = halconfigDirectoryStructure.getBackupConfigPath().toString(); useBackup = true; }
public void switchToBackupConfig() { DaemonTaskHandler.setContext(null); backupHalconfigPath = halconfigDirectoryStructure.getBackupConfigPath().toString(); useBackup = true; }
/** * Parse Halyard's config for inmemory usage. HalConfigs parsed with this function will NOT be written to disk for * persistence. * * @param is is the input stream to read from. * @return the fully parsed halconfig. * @see Halconfig */ public Halconfig setInmemoryHalConfig(ByteArrayInputStream is) throws IllegalArgumentException { Halconfig halconfig = parseHalconfig(is); DaemonTaskHandler.setContext(halconfig); return halconfig; }
/** * Parse Halyard's config for inmemory usage. HalConfigs parsed with this function will NOT be written to disk for * persistence. * * @param is is the input stream to read from. * @return the fully parsed halconfig. * @see Halconfig */ public Halconfig setInmemoryHalConfig(ByteArrayInputStream is) throws IllegalArgumentException { Halconfig halconfig = parseHalconfig(is); DaemonTaskHandler.setContext(halconfig); return halconfig; }
private void saveConfigTo(Path path) { Halconfig local = (Halconfig) DaemonTaskHandler.getContext(); if (local == null) { throw new HalException( new ConfigProblemBuilder(Severity.WARNING, "No halconfig changes have been made, nothing to write") .build() ); } AtomicFileWriter writer = null; try { writer = new AtomicFileWriter(path); writer.write(yamlParser.dump(objectMapper.convertValue(local, Map.class))); writer.commit(); } catch (IOException e) { throw new HalException(Severity.FATAL, "Failure writing your halconfig to path \"" + halconfigPath + "\": " + e.getMessage(), e); } finally { DaemonTaskHandler.setContext(null); if (writer != null) { writer.close(); } } } }
private void saveConfigTo(Path path) { Halconfig local = (Halconfig) DaemonTaskHandler.getContext(); if (local == null) { throw new HalException( new ConfigProblemBuilder(Severity.WARNING, "No halconfig changes have been made, nothing to write") .build() ); } AtomicFileWriter writer = null; try { writer = new AtomicFileWriter(path); writer.write(yamlParser.dump(objectMapper.convertValue(local, Map.class))); writer.commit(); } catch (IOException e) { throw new HalException(Severity.FATAL, "Failure writing your halconfig to path \"" + halconfigPath + "\": " + e.getMessage(), e); } finally { DaemonTaskHandler.setContext(null); if (writer != null) { writer.close(); } } } }
/** * Returns the current halconfig stored at the halconfigPath. * * @return the fully parsed halconfig. * @see Halconfig */ public Halconfig getHalconfig() { Halconfig local = (Halconfig) DaemonTaskHandler.getContext(); if (local == null) { try { InputStream is = getHalconfigStream(); local = parseHalconfig(is); } catch (FileNotFoundException ignored) { // leave res as `null` } catch (ParserException e) { throw new ParseConfigException(e); } catch (ScannerException e) { throw new ParseConfigException(e); } catch (IllegalArgumentException e) { throw new ParseConfigException(e); } } local = transformHalconfig(local); DaemonTaskHandler.setContext(local); return local; }
/** * Returns the current halconfig stored at the halconfigPath. * * @return the fully parsed halconfig. * @see Halconfig */ public Halconfig getHalconfig() { Halconfig local = (Halconfig) DaemonTaskHandler.getContext(); if (local == null) { try { InputStream is = getHalconfigStream(); local = parseHalconfig(is); } catch (FileNotFoundException ignored) { // leave res as `null` } catch (ParserException e) { throw new ParseConfigException(e); } catch (ScannerException e) { throw new ParseConfigException(e); } catch (IllegalArgumentException e) { throw new ParseConfigException(e); } } local = transformHalconfig(local); DaemonTaskHandler.setContext(local); return local; }