private void delete(String id) { System.out.println(); final Long i = Long.valueOf(id); if (monitorConfigService.delete(i)) { System.out.println("Deleted monitor " + id); } else { System.out.println("Could not delete monitor " + id); } }
public void process(String[] params) { CommandLine cmd; try { cmd = parser.parse(options, params); } catch (org.apache.commons.cli.ParseException ex) { throw new RuntimeException(ex); } if (cmd.hasOption(LIST)) { list(); } if (cmd.hasOption(DELETE)) { delete(cmd.getOptionValue(DELETE)); } if (cmd.hasOption(START)) { long timeout = 10000; long wait = 120000; if (cmd.hasOption(WAIT)) { wait = Long.parseLong(cmd.getOptionValue(WAIT)); } if (cmd.hasOption(TIMEOUT)) { timeout = Long.parseLong(cmd.getOptionValue(TIMEOUT)); } pollService.start(wait, timeout); } if (cmd.hasOption(ALARMS)) { Long threshold = 20L; Integer minutes = 20; if (cmd.hasOption(THRESHOLD)) { threshold = Long.parseLong(cmd.getOptionValue(THRESHOLD)); } if (cmd.hasOption(PERIOD)) { minutes = Integer.parseInt(cmd.getOptionValue(PERIOD)); } showAlarms(threshold, minutes); } }