use of org.apache.karaf.shell.support.table.ShellTable in project cxf by apache.
the class ListEndpointsCommand method execute.
@Override
public Object execute() throws Exception {
List<Bus> busses;
if (name == null) {
busses = getBusses();
} else {
Bus b = getBus(name);
if (b != null) {
busses = Collections.singletonList(getBus(name));
} else {
busses = Collections.emptyList();
}
}
ShellTable table = new ShellTable();
if (terminal != null && terminal.getWidth() > 0) {
table.size(terminal.getWidth());
}
table.column("Name");
table.column("State");
table.column("Address");
table.column("BusID");
for (Bus b : busses) {
ServerRegistry reg = b.getExtension(ServerRegistry.class);
List<Server> servers = reg.getServers();
for (Server serv : servers) {
String qname = serv.getEndpoint().getEndpointInfo().getName().getLocalPart();
String started = serv.isStarted() ? "Started" : "Stopped";
String address = serv.getEndpoint().getEndpointInfo().getAddress();
if (fullAddress) {
address = toFullAddress(address);
}
String busId = b.getId();
table.addRow().addContent(qname, started, address, busId);
}
}
table.print(System.out, !noFormat);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project cxf by apache.
the class ListBussesCommand method execute.
@Override
public Object execute() throws Exception {
List<Bus> busses = getBusses();
ShellTable table = new ShellTable();
if (terminal != null && terminal.getWidth() > 0) {
table.size(terminal.getWidth());
}
table.column("Name");
table.column("State");
for (Bus bus : busses) {
String name = bus.getId();
String state = bus.getState().toString();
table.addRow().addContent(name, state);
}
table.print(System.out, !noFormat);
return null;
}
Aggregations