public TabularData getInstances() throws Exception { List<Instance> allInstances = Arrays.asList(adminService.getInstances()); List<JmxInstance> instances = new ArrayList<JmxInstance>(); for (Instance instance : allInstances) { try { instances.add(new JmxInstance(instance)); } catch (Exception e) { e.printStackTrace(); } } TabularData table = JmxInstance.tableFrom(instances); return table; }
private String getStatusLine() { final Instance[] instances = adminService.getInstances(); int started = 0, starting = 0, stopped = 0; for (Instance instance : instances) {
protected Object doExecute() throws Exception { getAdminService().refreshInstance(); Instance[] instances = getAdminService().getInstances(); if (javaOpts) { System.out.println(" SSH Port RMI Ports State Pid JavaOpts");
public int complete(String buffer, int cursor, List candidates) { StringsCompleter delegate = new StringsCompleter(); for (Instance instance : adminService.getInstances()) { if (acceptsInstance(instance)) { delegate.getStrings().add(instance.getName()); } } return delegate.complete(buffer, cursor, candidates); }
private void writeJSON(final PrintWriter pw) { final JSONWriter jw = new JSONWriter(pw); final Instance[] instances = adminService.getInstances(); try { jw.object(); jw.key("status"); jw.value(getStatusLine()); jw.key("instances"); jw.array(); for (Instance i : instances) { instanceInfo(jw, i); } jw.endArray(); jw.endObject(); } catch (JSONException ex) { Logger.getLogger(AdminPlugin.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(AdminPlugin.class.getName()).log(Level.SEVERE, null, ex); } }