public void stageLocalFiles(Path outputPath) { if (!GlobalApplicationOptions.getInstance().isUseRemoteDaemon()) { return; } localFiles().forEach(f -> { try { f.setAccessible(true); String fContent = (String) f.get(this); if (fContent != null) { CRC32 crc = new CRC32(); crc.update(fContent.getBytes()); String fPath = Paths .get(outputPath.toAbsolutePath().toString(), Long.toHexString(crc.getValue())) .toString(); FileUtils.writeStringToFile(new File(fPath), fContent); f.set(this, fPath); } } catch (IllegalAccessException | IOException e) { throw new RuntimeException("Failed to get local files for node " + this.getNodeName(), e); } finally { f.setAccessible(false); } }); }
public void stageLocalFiles(Path outputPath) { if (!GlobalApplicationOptions.getInstance().isUseRemoteDaemon()) { return; } localFiles().forEach(f -> { try { f.setAccessible(true); String fContent = (String) f.get(this); if (fContent != null) { CRC32 crc = new CRC32(); crc.update(fContent.getBytes()); String fPath = Paths .get(outputPath.toAbsolutePath().toString(), Long.toHexString(crc.getValue())) .toString(); FileUtils.writeStringToFile(new File(fPath), fContent); f.set(this, fPath); } } catch (IllegalAccessException | IOException e) { throw new RuntimeException("Failed to get local files for node " + this.getNodeName(), e); } finally { f.setAccessible(false); } }); }
private void swapLocalFilePrefixes(String to, String from) { Consumer<Node> fileFinder = n -> n.localFiles().forEach(f -> { try { f.setAccessible(true); String fPath = (String) f.get(n); if (fPath == null) { return; } if (fPath.startsWith(to)) { log.info("File " + f.getName() + " was already in correct format " + fPath); return; } if (!fPath.startsWith(from)) { throw new HalException(FATAL, "Local file: " + fPath + " has incorrect prefix - must match " + from); } fPath = to + fPath.substring(from.length()); f.set(n, fPath); } catch (IllegalAccessException e) { throw new RuntimeException("Failed to get local files for node " + n.getNodeName(), e); } finally { f.setAccessible(false); } }); recursiveConsume(fileFinder); }
private void swapLocalFilePrefixes(String to, String from) { Consumer<Node> fileFinder = n -> n.localFiles().forEach(f -> { try { f.setAccessible(true); String fPath = (String) f.get(n); if (fPath == null) { return; } if (fPath.startsWith(to)) { log.info("File " + f.getName() + " was already in correct format " + fPath); return; } if (!fPath.startsWith(from)) { throw new HalException(FATAL, "Local file: " + fPath + " has incorrect prefix - must match " + from); } fPath = to + fPath.substring(from.length()); f.set(n, fPath); } catch (IllegalAccessException e) { throw new RuntimeException("Failed to get local files for node " + n.getNodeName(), e); } finally { f.setAccessible(false); } }); recursiveConsume(fileFinder); }
Consumer<Node> fileFinder = n -> referencedFiles.addAll(n.localFiles().stream().map(f -> { try { f.setAccessible(true);
public List<String> backupLocalFiles(String outputPath) { List<String> files = new ArrayList<>(); Consumer<Node> fileFinder = n -> files.addAll(n.localFiles().stream().map(f -> { try { f.setAccessible(true);
public List<String> backupLocalFiles(String outputPath) { List<String> files = new ArrayList<>(); Consumer<Node> fileFinder = n -> files.addAll(n.localFiles().stream().map(f -> { try { f.setAccessible(true);
Consumer<Node> fileFinder = n -> referencedFiles.addAll(n.localFiles().stream().map(f -> { try { f.setAccessible(true);