/** * Prints an error message. * * @param message the message to print, may be {@code null} */ default void error(CharSequence message) { print(null, message); }
/** * Prints an informational message. * * @param message the message to print, may be {@code null} */ default void print(CharSequence message) { print(null, message); }
/** * Prints an informational message. * * @param format the format * @param args the arguments for the format * * @see java.util.Formatter */ default void print(String format, Object... args) { print(null, String.format(format, args)); }
/** * Prints an error message. If the {@code cause} is not {@code null} the * {@linkplain Throwable#printStackTrace(PrintStream) stack trace} will be written as well. * * @param cause the cause of an error or {@code null} * @param format the format * @param args the arguments for the format * * @see java.util.Formatter */ default void error(Throwable cause, String format, Object... args) { print(cause, String.format(format, args)); }
/** * Prints an error message. * * @param format the format * @param args the arguments for the format * * @see java.util.Formatter */ default void error(String format, Object... args) { print(null, String.format(format, args)); }
/** * Prints an informational message. If the {@code cause} is not {@code null} the * {@linkplain Throwable#printStackTrace(PrintStream) stack trace} will be written as well. * * @param cause the cause of an error or {@code null} * @param format the format * @param args the arguments for the format * * @see java.util.Formatter */ default void print(Throwable cause, String format, Object... args) { print(cause, String.format(format, args)); }
private void persistHashes(ProvisioningRuntime runtime) throws ProvisioningException { final long startTime = System.nanoTime(); final FsEntry root = getDefaultFsEntryFactory().forPath(runtime.getStagedDir()); if (root.hasChildren()) { final Path hashes = LayoutUtils.getHashesDir(runtime.getStagedDir()); try { Files.createDirectories(hashes); } catch (IOException e) { throw new ProvisioningException("Failed to persist hashes", e); } final List<FsEntry> dirs = new ArrayList<>(); persistChildHashes(hashes, root, dirs, hashes); if(!dirs.isEmpty()) { for(int i = dirs.size() - 1; i >= 0; --i) { persistDirHashes(hashes, dirs.get(i), dirs); } } } if(log.isVerboseEnabled()) { final long timeMs = (System.nanoTime() - startTime) / 1000000; final long timeSec = timeMs / 1000; log.print("Hashing took %d.%d seconds", timeSec, (timeMs - timeSec * 1000)); } }
public static Map<String, Boolean> replay(FsDiff diff, Path home, MessageWriter log) throws ProvisioningException { log.print("Replaying your changes on top"); Map<String, Boolean> undoTasks = Collections.emptyMap(); if(diff.hasRemovedEntries()) { log.print(formatMessage(REMOVED, removed.getRelativePath(), null)); IoUtils.recursiveDelete(target); } else { log.print(formatMessage(action, update.getRelativePath(), warning)); try { IoUtils.copy(update.getPath(), target);
log.print(formatMessage(action, added.getRelativePath(), warning)); try { IoUtils.copy(added.getPath(), target);