/** * Prints a message if {@link #isVerboseEnabled()} is {@code true}. * * @param message the message to print, may be {@code null} */ default void verbose(CharSequence message) { verbose(null, message); }
/** * Prints a message if {@link #isVerboseEnabled()} is {@code true}. * <p> * The message will not be formatted unless {@link #isVerboseEnabled()} is {@code true}. This is safe to call * without first checking {@link #isVerboseEnabled()} for performance. * </p> * * @param format the format * @param args the arguments for the format * * @see java.util.Formatter */ default void verbose(String format, Object... args) { if (isVerboseEnabled()) { verbose(null, String.format(format, args)); } }
/** * Prints a message if {@link #isVerboseEnabled()} is {@code true}. If the {@code cause} is not {@code null} the * {@linkplain Throwable#printStackTrace(PrintStream) stack trace} will be written as well. * <p> * The message will not be formatted unless {@link #isVerboseEnabled()} is {@code true}. This is safe to call * without first checking {@link #isVerboseEnabled()} for performance. * </p> * * @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 verbose(Throwable cause, String format, Object... args) { if (isVerboseEnabled()) { verbose(cause, String.format(format, args)); } }
@Override public void close() { layout.close(); if (messageWriter.isVerboseEnabled()) { final long time = System.currentTimeMillis() - startTime; final long seconds = time / 1000; messageWriter.verbose("Done in %d.%d seconds", seconds, (time - seconds * 1000)); } } }
log.verbose("Persisting undo tasks: "); try (BufferedWriter writer = Files.newBufferedWriter(stateDir.resolve(Constants.UNDO_TASKS))){ for (Map.Entry<String, Boolean> entry : undoTasks.entrySet()) { final String action = entry.getValue() ? Constants.KEEP : Constants.REMOVE; log.verbose(" - %s %s", entry.getKey(), action); writer.write(entry.getKey()); writer.newLine();
public static void replaceDist(Path stagedDir, Path home, boolean asUndo, Map<String, Boolean> undoTasks, MessageWriter log) throws ProvisioningException { log.verbose("Moving the provisioned installation from the staged directory to %s", home); // copy from the staged to the target installation directory if (Files.exists(home)) { if(asUndo) { StateHistoryUtils.removeLastUndoConfig(home, stagedDir, log); } else { StateHistoryUtils.addNewUndoConfig(home, stagedDir, undoTasks, log); } IoUtils.recursiveDelete(home); } try { IoUtils.copy(stagedDir, home); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(stagedDir, home)); } } }
return null; log.verbose("Detecting user changes"); final Path hashesDir = LayoutUtils.getHashesDir(getInstallationHome()); if(Files.exists(hashesDir)) { final long timeMs = (System.nanoTime() - startTime) / 1000000; final long timeSec = timeMs / 1000; log.verbose(" filesystem diff took %d.%d seconds", timeSec, (timeMs - timeSec * 1000));
public void updateConfig(ProvisionedFeatureDiffCallback featureDiffCallback, ProvisionedConfig updatedConfig, String... relativePaths) throws ProvisioningException { final ConfigId configId = new ConfigId(updatedConfig.getModel(), updatedConfig.getName()); configPlugins = CollectionUtils.put(configPlugins, configId, featureDiffCallback); if(featureDiff == null) { featureDiff = new FeatureDiff(log); } featureDiff.init(getRequiredProvisionedConfig(provisionedState.getConfigs(), updatedConfig.getModel(), updatedConfig.getName())); featureDiff.diff(featureDiffCallback, updatedConfig); final ConfigModel mergedConfig = featureDiff.getMergedConfig(layout); if (mergedConfig == null) { log.verbose("%s has not changed", updatedConfig.getName()); } else { updatedConfigs.put(configId, mergedConfig); } featureDiff.reset(); suppressPaths(relativePaths); }
public void addConfig(ProvisionedFeatureDiffCallback featureDiffCallback, ProvisionedConfig config, String... relativePaths) throws ProvisioningException { if(featureDiff == null) { featureDiff = new FeatureDiff(log); } featureDiff.reset(); featureDiff.model = config.getModel(); featureDiff.name = config.getName(); featureDiff.diff(featureDiffCallback, config); final ConfigModel mergedConfig = featureDiff.getMergedConfig(layout); if (mergedConfig == null) { log.verbose("%s is meaningless", config.getName()); } else { addedConfigs = CollectionUtils.putLinked(addedConfigs, new ConfigId(config.getModel(), config.getName()), mergedConfig); } featureDiff.reset(); suppressPaths(relativePaths); }
IoUtils.recursiveDelete(target); } else { log.verbose(formatMessage(REMOVED, removed.getRelativePath(), HAS_BEEN_REMOVED_FROM_THE_UPDATED_VERSION)); undoTasks = CollectionUtils.putLinked(undoTasks, removed.getRelativePath(), false);
messageWriter.verbose("Installing %s", fp.getFPID()); for(PackageRuntime pkg : fp.getPackages()) { final Path pkgSrcDir = pkg.getContentDir();