public void outputf(String format, Object... args) { output(String.format(format, args)); }
public void handleSigInt() { _logger.info("Got SIGINT\n"); WorkItem wItem = _polledWorkItem; if (wItem != null) { _logger.outputf("Killing %s\n", wItem.getId()); boolean result = _workHelper.killWork(_polledWorkItem.getId()); _logger.outputf("Result of killing %s: %s\n", wItem.getId(), result); } else { _logger.output("No work being polled\n"); } }
private boolean dir(List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 0, 1, Command.DIR)) { return false; } String dirname = (parameters.size() == 1) ? parameters.get(0) : "."; File currDirectory = new File(dirname); for (File file : currDirectory.listFiles()) { _logger.output(file.getName() + "\n"); } return true; }
private boolean getQuestionTemplates(List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 0, 0, Command.GET_QUESTION_TEMPLATES)) { return false; } JSONObject templates = _workHelper.getQuestionTemplates(); if (templates == null) { return false; } _logger.outputf("Found %d templates\n", templates.length()); try { _logger.output(templates.toString(1)); } catch (JSONException e) { throw new BatfishException("Failed to print templates", e); } return true; }
private void logOutput(FileWriter outWriter, String message) { if (outWriter == null) { _logger.output(message); } else { try { outWriter.write(message); } catch (IOException e) { throw new BatfishException("Failed to log output to outWriter", e); } } }
_logger.output("---------------- Service Log --------------\n"); String logFileName = wItem.getId() + BfConsts.SUFFIX_LOG_FILE; String downloadedFileStr =
private boolean prompt(List<String> options, List<String> parameters) throws IOException { if (!isValidArgument(options, parameters, 0, 0, 0, Command.PROMPT)) { return false; } if (_settings.getRunMode() == RunMode.interactive) { _logger.output("\n\n[Press enter to proceed]\n\n"); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in.readLine(); } return true; }
private boolean initNetwork(List<String> options, List<String> parameters) { if (options.contains("-setname")) { if (!isValidArgument(options, parameters, 1, 1, 1, Command.INIT_NETWORK)) { return false; } _currContainerName = _workHelper.initNetwork(parameters.get(0), null); } else { if (!isValidArgument(options, parameters, 0, 0, 1, Command.INIT_NETWORK)) { return false; } String containerPrefix = parameters.isEmpty() ? DEFAULT_NETWORK_PREFIX : parameters.get(0); _currContainerName = _workHelper.initNetwork(null, containerPrefix); } if (_currContainerName == null) { _logger.errorf("Could not init network\n"); return false; } _logger.output("Active network is set"); _logger.infof(" to %s\n", _currContainerName); _logger.output("\n"); return true; }
/** * Get information of the container (first element in {@code parameters}). * * <p>Returns {@code true} if successfully get container information, {@code false} otherwise */ private boolean getNetwork(List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, 1, Command.GET_NETWORK)) { return false; } String containerName = parameters.get(0); Container container = _workHelper.getNetwork(containerName); if (container != null) { _logger.output(container.getTestrigs() + "\n"); return true; } return false; }
reader.lines().forEach(line -> _mainLogger.output(line + "\n")); } catch (IOException e) { _mainLogger.errorf(
return false; _logger.output("Init'ed and set active network"); _logger.infof(" to %s\n", _currContainerName); _logger.output("\n"); return false; _logger.output("Uploaded snapshot.\n"); _logger.output("Parsing now.\n"); WorkItem wItemParse = WorkItemBuilder.getWorkItemParse(_currContainerName, testrigName);
_logger.output(DIFF_NOT_READY_MSG); return false;
JsonSchemaGenerator schemaGenNew = new JsonSchemaGenerator(BatfishObjectMapper.mapper()); JsonNode schemaNew = schemaGenNew.generateJsonSchema(Configuration.class); _logger.output(BatfishObjectMapper.writePrettyString(schemaNew));
_logger.output(DIFF_NOT_READY_MSG); return false;
_logger.output(answerStringToPrint); } catch (BatfishException e) {