public int reconfig(String[] argv, int i) throws IOException { String nodeType = argv[i]; String address = argv[i + 1]; String op = argv[i + 2]; if ("start".equals(op)) { return startReconfiguration(nodeType, address, System.out, System.err); } else if ("status".equals(op)) { return getReconfigurationStatus(nodeType, address, System.out, System.err); } else if ("properties".equals(op)) { return getReconfigurableProperties(nodeType, address, System.out, System.err); } System.err.println("Unknown operation: " + op); return -1; }
public int reconfig(String[] argv, int i) throws IOException { String nodeType = argv[i]; String address = argv[i + 1]; String op = argv[i + 2]; if ("start".equals(op)) { return startReconfiguration(nodeType, address); } else if ("status".equals(op)) { return getReconfigurationStatus(nodeType, address, System.out, System.err); } System.err.println("Unknown operation: " + op); return -1; }
public int reconfig(String[] argv, int i) throws IOException { String nodeType = argv[i]; String address = argv[i + 1]; String op = argv[i + 2]; if ("start".equals(op)) { return startReconfiguration(nodeType, address); } else if ("status".equals(op)) { return getReconfigurationStatus(nodeType, address, System.out, System.err); } System.err.println("Unknown operation: " + op); return -1; }
private List<String> getReconfigureStatus(String nodeType, String address) throws IOException { ByteArrayOutputStream bufOut = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bufOut); ByteArrayOutputStream bufErr = new ByteArrayOutputStream(); PrintStream err = new PrintStream(bufErr); admin.getReconfigurationStatus(nodeType, address, out, err); Scanner scanner = new Scanner(bufOut.toString()); List<String> outputs = Lists.newArrayList(); while (scanner.hasNextLine()) { outputs.add(scanner.nextLine()); } return outputs; }