@XmlRpcMethod(alias = "flux", method = "hosts") public List<Object> getHosts(String domain) { FluxDomain fluxDomain = monitor.getDomain(domain); if (fluxDomain == null) return new ArrayList<Object>(); return marshalHosts(fluxDomain.getHosts()); }
private Map<String, Object> marshal(FluxDomain domain) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ"); Map<String, Object> m = new HashMap<String, Object>(); m.put("name", domain.getName()); m.put("created_at", dateFormat.format(domain.getCreateDateTime())); m.put("updated_at", dateFormat.format(domain.getUpdateDateTime())); m.put("count", domain.getHosts().size()); return m; }