public TabularData getInstances() throws MBeanException { List<Instance> instances = Arrays.asList(instanceService.getInstances()); TabularData table = InstanceToTableMapper.tableFrom(instances); return table; }
public TabularData getInstances() throws MBeanException { List<Instance> instances = Arrays.asList(instanceService.getInstances()); TabularData table = InstanceToTableMapper.tableFrom(instances); return table; }
protected List<Instance> getMatchingInstances(List<String> patterns) { List<Instance> instances = new ArrayList<>(); Instance[] allInstances = instanceService.getInstances(); for (Instance instance : allInstances) { if (match(instance.getName(), patterns)) { instances.add(instance); } } if (instances.isEmpty()) { throw new IllegalArgumentException("No matching instances"); } return instances; }
protected List<Instance> getMatchingInstances(List<String> patterns) { List<Instance> instances = new ArrayList<>(); Instance[] allInstances = instanceService.getInstances(); for (Instance instance : allInstances) { if (match(instance.getName(), patterns)) { instances.add(instance); } } if (instances.isEmpty()) { throw new IllegalArgumentException("No matching instances"); } return instances; }
private String getStatusLine() { final Instance[] instances = instanceService.getInstances(); int started = 0, starting = 0, stopped = 0; for (Instance instance : instances) {
public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); for (Instance instance : instanceService.getInstances()) { if (acceptsInstance(instance)) { delegate.getStrings().add(instance.getName()); } } return delegate.complete(session, commandLine, candidates); }
public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); for (Instance instance : instanceService.getInstances()) { if (acceptsInstance(instance)) { delegate.getStrings().add(instance.getName()); } } return delegate.complete(session, commandLine, candidates); }
private void writeJSON(final PrintWriter pw) { final JSONWriter jw = new JSONWriter(pw); final Instance[] instances = instanceService.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 (IOException ex) { Logger.getLogger(InstancePlugin.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(InstancePlugin.class.getName()).log(Level.SEVERE, null, ex); } }
protected Object doExecute() throws Exception { Instance[] instances = getInstanceService().getInstances(); ShellTable table = new ShellTable(); table.column("SSH Port").alignRight(); table.column("SSH Host").alignRight(); table.column("RMI Registry").alignRight(); table.column("RMI Registry Host").alignRight(); table.column("RMI Server").alignRight(); table.column("RMI Server Host").alignRight(); table.column("State"); table.column("PID"); table.column(getRightColumnHeader()); for (Instance instance : instances) { table.addRow().addContent( instance.getSshPort(), instance.getSshHost(), instance.getRmiRegistryPort(), instance.getRmiRegistryHost(), instance.getRmiServerPort(), instance.getRmiServerHost(), instance.getState(), instance.getPid(), getRightColumnValue(instance)); } table.print(System.out, !noFormat); return null; }
protected Object doExecute() throws Exception { Instance[] instances = getInstanceService().getInstances(); ShellTable table = new ShellTable(); table.column("SSH Port").alignRight(); table.column("SSH Host").alignRight(); table.column("RMI Registry").alignRight(); table.column("RMI Registry Host").alignRight(); table.column("RMI Server").alignRight(); table.column("RMI Server Host").alignRight(); table.column("State"); table.column("PID"); table.column(getRightColumnHeader()); for (Instance instance : instances) { table.addRow().addContent( instance.getSshPort(), instance.getSshHost(), instance.getRmiRegistryPort(), instance.getRmiRegistryHost(), instance.getRmiServerPort(), instance.getRmiServerHost(), instance.getState(), instance.getPid(), getRightColumnValue(instance)); } table.print(System.out, !noFormat); return null; }