/** * Entry point from the framework into the command execution * @param context context for the command. */ public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ColumnFormatter cf = new ColumnFormatter(); ActionReport.MessagePart part = report.getTopMessagePart(); int numOfApplications = 0; if ( !terse && long_opt ) { String[] headings= new String[] { "NAME", "STATUS" }; cf = new ColumnFormatter(headings); } for (ApplicationRef ref : domain.getApplicationRefsInTarget(target)) { Object[] row = new Object[] { ref.getRef() }; if( !terse && long_opt ){ row = new Object[]{ ref.getRef(), getLongStatus(ref) }; } cf.addRow(row); numOfApplications++; } if (numOfApplications != 0) { report.setMessage(cf.toString()); } else if ( !terse) { part.setMessage(localStrings.getLocalString("list.components.no.elements.to.list", "Nothing to List.")); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); }
ColumnFormatter cf = new ColumnFormatter(); String[] headings = headerList.toArray(new String[headerList.size()]); heading_count = headerList.size(); cf = new ColumnFormatter(s); } else { cf = new ColumnFormatter(headings); cf.addRow(outputstring); } else if (type == null) { if (scope == null) { cf.addRow(new Object[]{cloudName, ipAddress, instanceID, serverType, state, serviceType}); } else { if (serviceType.equals(scope)) { cf.addRow(new Object[]{cloudName, ipAddress, instanceID, serverType, state}); cf.addRow(new Object[]{cloudName, ipAddress, instanceID, state, serviceType}); } else { if (serviceType.equals(scope)) { cf.addRow(new Object[]{cloudName, ipAddress, instanceID, state}); cf.addRow(this.generateOutputRow(headings, heading_count, e, mapOfMaps)); report.setMessage(cf.toString()); extraProperties.put("list", cf.getContent()); } else if (header = true) { report.setMessage("Nothing to list.");