use of io.fabric8.utils.TablePrinter in project fabric8 by jboss-fuse.
the class ContainerListAction method printContainers.
private void printContainers(Container[] containers, Version version, PrintStream out) {
TablePrinter table = new TablePrinter();
table.columns("id", "version", "type", "connected", "profiles", "provision status");
for (Container container : containers) {
if (CommandUtils.matchVersion(container, version)) {
String indent = "";
for (Container c = container; !c.isRoot(); c = c.getParent()) {
indent += " ";
}
// Mark local container with a star symbol
String marker = "";
if (container.getId().equals(fabricService.getCurrentContainer().getId())) {
marker = "*";
}
List<String> assignedProfiles = dataStore.getContainerProfiles(container.getId());
try {
table.row(indent + container.getId() + marker, container.getVersion().getId(), container.getType(), aliveText(container), assignedProfiles.get(0), CommandUtils.status(container));
} catch (RuntimeException e) {
LOG.warn("Problem getting the overlay profile for container " + container.getId(), e);
}
// we want multiple profiles to be displayed on next lines
for (int i = 1; i < assignedProfiles.size(); i++) {
table.row("", "", "", "", assignedProfiles.get(i), "");
}
}
}
table.print();
}
use of io.fabric8.utils.TablePrinter in project fabric8 by jboss-fuse.
the class ContainerResolverListAction method doExecute.
@Override
protected Object doExecute() throws Exception {
if (containerIds == null || containerIds.isEmpty()) {
containerIds = new ArrayList<String>();
for (Container container : fabricService.getContainers()) {
containerIds.add(container.getId());
}
}
TablePrinter table = new TablePrinter();
table.columns("id", "resolver", "local hostname", "local ip", "public hostname", "public ip", "manual ip");
for (String containerId : containerIds) {
Container container = fabricService.getContainer(containerId);
String localHostName = container.getLocalHostname();
String localIp = container.getLocalIp();
String publicHostName = container.getPublicHostname();
String publicIp = container.getPublicIp();
String manualIp = container.getManualIp();
localHostName = localHostName != null ? localHostName : "";
localIp = localIp != null ? localIp : "";
publicHostName = publicHostName != null ? publicHostName : "";
publicIp = publicIp != null ? publicIp : "";
manualIp = manualIp != null ? manualIp : "";
String resolver = container.getResolver();
table.row(containerId, resolver, localHostName, localIp, publicHostName, publicIp, manualIp);
}
table.print();
return null;
}
use of io.fabric8.utils.TablePrinter in project fabric8 by jboss-fuse.
the class FabricGitSummaryAction method printVersions.
private void printVersions(String title, List<GitVersion> versions) {
System.out.println(title);
TablePrinter table = new TablePrinter();
table.columns("version", "SHA1", "timestamp", "message");
for (GitVersion version : versions) {
table.row(version.getVersion(), version.getSha1(), version.getTimestamp(), version.getMessage());
}
table.print();
}
use of io.fabric8.utils.TablePrinter in project fabric8 by jboss-fuse.
the class DomainListAction method doExecute.
@Override
protected Object doExecute() throws Exception {
IOpenShiftConnection connection = getOrCreateConnection();
TablePrinter printer = new TablePrinter();
printer.column("id");
for (IDomain domain : connection.getDomains()) {
printer.row(domain.getId());
}
printer.print();
return null;
}
Aggregations