Examples of TablePrinter


Examples of io.fabric8.utils.TablePrinter

       
        return null;
    }

    private void printContainers(PodListSchema pods, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "image(s)", "host", "labels", "status");
        List<PodSchema> items = pods.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<PodSchema> filter = KubernetesHelpers.createPodFilter(filterText);
        for (PodSchema item : items) {
            if (filter.matches(item)) {
                String id = item.getId();
                CurrentState currentState = item.getCurrentState();
                String status = "";
                String host = "";
                if (currentState != null) {
                    status = currentState.getStatus();
                    host = currentState.getHost();
                }
                Map<String, String> labelMap = item.getLabels();
                String labels = KubernetesHelpers.toLabelsString(labelMap);
                DesiredState desiredState = item.getDesiredState();
                if (desiredState != null) {
                    ManifestSchema manifest = desiredState.getManifest();
                    if (manifest != null) {
                        List<ManifestContainer> containers = manifest.getContainers();
                        for (ManifestContainer container : containers) {
                            String image = container.getImage();
                            table.row(id, image, host, labels, status);

                            id = "";
                            host = "";
                            status = "";
                            labels = "";
                        }
                    }
                }
            }
        }
        table.print();
    }
View Full Code Here

Examples of io.fabric8.utils.TablePrinter

        printContainers(services, System.out);
        return null;
    }

    private void printContainers(ServiceListSchema services, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "labels", "selector", "port");
        List<ServiceSchema> items = services.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<ServiceSchema> filter = KubernetesHelpers.createServiceFilter(filterText);
        for (ServiceSchema item : items) {
            if (filter.matches(item)) {
                String labels = KubernetesHelpers.toLabelsString(item.getLabels());
                String selector = KubernetesHelpers.toLabelsString(item.getSelector());
                table.row(item.getId(), labels, selector, KubernetesHelpers.toPositiveNonZeroText(item.getPort()));
            }
        }
        table.print();
    }
View Full Code Here

Examples of io.fabric8.utils.TablePrinter

        printContainers(replicationControllers, System.out);
        return null;
    }

    private void printContainers(ReplicationControllerListSchema replicationControllers, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "labels", "replicas", "replica selector");
        List<ReplicationControllerSchema> items = replicationControllers.getItems();
        if (items == null) {
            items = Collections.EMPTY_LIST;
        }
        Filter<ReplicationControllerSchema> filter = KubernetesHelpers.createReplicationControllerFilter(filterText);
        for (ReplicationControllerSchema item : items) {
            if (filter.matches(item)) {
                String id = item.getId();
                String labels = KubernetesHelpers.toLabelsString(item.getLabels());
                Integer replicas = null;
                ControllerDesiredState desiredState = item.getDesiredState();
                ControllerCurrentState currentState = item.getCurrentState();
                String selector = null;
                if (desiredState != null) {
                    selector = KubernetesHelpers.toLabelsString(desiredState.getReplicaSelector());
                }
                if (currentState != null) {
                    replicas = currentState.getReplicas();
                }
                table.row(id, labels, toPositiveNonZeroText(replicas), selector);
            }
        }
        table.print();
    }
View Full Code Here

Examples of org.nasutekds.server.util.table.TablePrinter

      }
    }

    PrintStream out = app.getOutputStream();
    if (app.isScriptFriendly()) {
      TablePrinter printer = createScriptFriendlyTablePrinter(out);
      builder.print(printer);
    } else {
      TextTablePrinter printer = new TextTablePrinter(out);
      printer.setColumnSeparator(ToolConstants.LIST_TABLE_SEPARATOR);
      printer.setColumnWidth(1, 0);
      builder.print(printer);
    }

    return MenuResult.success(0);
  }
View Full Code Here

Examples of org.nasutekds.server.util.table.TablePrinter

        }
      }

      PrintStream out = app.getOutputStream();
      if (app.isScriptFriendly()) {
        TablePrinter printer = createScriptFriendlyTablePrinter(out);
        builder.print(printer);
      } else {
        if (app.isInteractive()) {
          // Make interactive mode prettier.
          app.println();
          app.println();
        }

        TextTablePrinter printer = new TextTablePrinter(out);
        printer.setColumnSeparator(ToolConstants.LIST_TABLE_SEPARATOR);
        builder.print(printer);
      }
    }

    return MenuResult.success(0);
View Full Code Here

Examples of org.nasutekds.server.util.table.TablePrinter

      PropertyDefinitionUsageBuilder v = new PropertyDefinitionUsageBuilder(
          false);
      builder.appendCell(v.getUsage(pd));
    }

    TablePrinter printer = new TextTablePrinter(app.getErrorStream());
    builder.print(printer);
  }
View Full Code Here

Examples of org.nasutekds.server.util.table.TablePrinter

          builder.appendCell(v.getUsage(pd));
        }
      }
    }

    TablePrinter printer;
    if (app.isScriptFriendly()) {
      printer = createScriptFriendlyTablePrinter(app.getOutputStream());
    } else {
      printer = new TextTablePrinter(app.getOutputStream());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.