Package io.fabric8.utils

Examples of io.fabric8.utils.TablePrinter$Column


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

    private void printServices(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 = KubernetesHelper.createServiceFilter(filterText.getValue());
        for (ServiceSchema item : items) {
            if (filter.matches(item)) {
                String labels = KubernetesHelper.toLabelsString(item.getLabels());
                String selector = KubernetesHelper.toLabelsString(item.getSelector());
                table.row(item.getId(), labels, selector, KubernetesHelper.toPositiveNonZeroText(item.getPort()));
            }
        }
        table.print();
    }
View Full Code Here


    @Override
    protected Object doExecute() throws Exception {
        IOpenShiftConnection connection = getOrCreateConnection();

        TablePrinter printer = new TablePrinter();
        printer.columns("domain", "application id");

        for (IDomain domain : connection.getDomains()) {
            if (domainId == null || domainId.equals(domain.getId())) {
                String displayDomain = domain.getId();
                domain.refresh();
                for (IApplication application : domain.getApplications()) {
                    printer.row(displayDomain, application.getName());
                    displayDomain = "";
                }
            }
        }
        printer.print();

        return null;
    }
View Full Code Here

    @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;
    }
View Full Code Here

            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;
    }
View Full Code Here

    }

    @Override
    protected Object doExecute() throws Exception {

        TablePrinter table = new TablePrinter();
        if (verbose) {
            table.columns("groupId", "artifactId", "version", "description");
        } else {
            table.columns("artifactId", "description");
        }

        for (Archetype archetype : archetypeService.listArchetypes()) {
            if (verbose) {
                table.row(archetype.groupId, archetype.artifactId, archetype.version, archetype.description);
            } else {
                // only list artifact id in short format
                table.row(archetype.artifactId, archetype.description);
            }
        }
        table.print();

        return null;
    }
View Full Code Here

        printVersions(containers, versions, fabricService.getDefaultVersionId(), System.out);
        return null;
    }

    protected void printVersions(Container[] containers, List<String> versions, String defaultVersionId, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("version", "default", "# containers", "description");

        // they are sorted in the correct order by default
        for (String versionId : versions) {
            boolean isDefault = versionId.equals(defaultVersionId);
            Version version = profileService.getRequiredVersion(versionId);
            int active = countContainersByVersion(containers, version);
            String description = version.getAttributes().get(Version.DESCRIPTION);
            table.row(version.getId(), (isDefault ? "true" : ""), activeContainerCountText(active), description);
        }
        table.print();
    }
View Full Code Here

        printStatus(out, status);
        return null;
    }

    protected void printStatus(PrintStream out, AutoScaleStatus status) {
        TablePrinter table = new TablePrinter();
        table.columns("auto scale profile", "status", "message");
        List<AutoScaleProfileStatus> profileStatuses = status.getProfileStatuses();
        for (AutoScaleProfileStatus profile : profileStatuses) {
            table.row(getStringOrBlank(profile.getProfile()),
                    getStringOrBlank(profile.getStatus()),
                    getStringOrBlank(profile.getMessage()));
        }
        table.print();
    }
View Full Code Here

                    }
                }
            }
        }

        TablePrinter table = new TablePrinter();
        table.columns("cluster", "masters", "slaves", "services");

        for (String clusterName : clusters.keySet()) {
            Map<String, ClusterNode> nodes = clusters.get(clusterName);
            table.row(clusterName, "", "", "", "");
            for (String nodeName : nodes.keySet()) {
                ClusterNode node = nodes.get(nodeName);
                table.row("   " + nodeName,
                        printList(node.masters),
                        printList(node.slaves),
                        printList(node.services));
            }
        }
        table.print();
    }
View Full Code Here

        }
        return null;
    }

    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());
                table.row(indent + container.getId() + marker, container.getVersion().getId(), container.getType(),
                        aliveText(container), assignedProfiles.get(0), CommandUtils.status(container));

                // 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();
    }
View Full Code Here

    protected static String aliveText(Container container) {
        return container.isAlive() ? "yes" : "";
    }

    private void printContainersVerbose(Container[] containers, Version version, PrintStream out) {
        TablePrinter table = new TablePrinter();
        table.columns("id", "version", "type", "connected", "profiles", "blueprint", "spring", "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 = "*";
                }

                String blueprintStatus = dataStore.getContainerAttribute(container.getId(), DataStore.ContainerAttribute.BlueprintStatus, "", false, false);
                String springStatus = dataStore.getContainerAttribute(container.getId(), DataStore.ContainerAttribute.SpringStatus, "", false, false);
                blueprintStatus = blueprintStatus.toLowerCase(Locale.ENGLISH);
                springStatus = springStatus.toLowerCase(Locale.ENGLISH);

                List<String> assignedProfiles = dataStore.getContainerProfiles(container.getId());
                table.row(indent + container.getId() + marker, container.getVersion().getId(), container.getType(),
                        aliveText(container), assignedProfiles.get(0), blueprintStatus, springStatus, CommandUtils.status(container));

                // 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();

    }
View Full Code Here

TOP

Related Classes of io.fabric8.utils.TablePrinter$Column

Copyright © 2018 www.massapicom. 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.