Esempio n. 1
0
 public void add(String[] params) {
   Map<String, String> map = paramsToProps(params);
   Monitor monitor = mapToMonitor(map);
   final MonitorConfig monitorConfig = new MonitorConfig();
   monitorConfig.setName(map.get("name"));
   monitorConfig.setMonitor(monitor);
   monitorDao.save(monitorConfig);
 }
Esempio n. 2
0
 public void list() {
   final List<MonitorConfig> list = monitorDao.list();
   System.out.println("\nListing monitors");
   for (MonitorConfig monitorConfig : list) {
     System.out.println("\n  " + monitorConfig.getId() + " " + monitorConfig.getName());
     try {
       final Map props = new TreeMap(BeanUtils.describe(monitorConfig.getMonitor()));
       for (Object key : props.keySet()) {
         System.out.println("    " + key + " = " + props.get(key));
       }
     } catch (Exception ex) {
       log.error(ex);
     }
   }
 }