protected String textResult(ProjectOverviewDTO project) { StringBuilder buffer = new StringBuilder("\n\n"); Set<String> perspectives = project.getPerspectives(); TablePrinter table = new TablePrinter(); table.columns("perspective"); for (String perspective : perspectives) { table.row(perspective); } addTableTextOutput(buffer, null, table); Set<String> builders = project.getBuilders(); table = new TablePrinter(); table.columns("builder"); for (String builder : builders) { table.row(builder); } addTableTextOutput(buffer, null, table); return buffer.toString(); }
@Override protected Object doExecute() throws Exception { TablePrinter printer = new TablePrinter(); printer.column("id"); List<String> containers = clusterService.getEnsembleContainers(); if (containers != null) { for (String container : containers) { printer.row(container); } } printer.print(); 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(); }
protected String textResult(ProjectDto projectDto) { StringBuilder buffer = new StringBuilder("\n\n"); FunktionConfig config = projectDto.getConfig(); if (config != null) { List<FunktionRule> rules = config.getRules(); if (rules != null && !rules.isEmpty()) { TablePrinter table = new TablePrinter(); table.columns("name", "trigger", "action", "chain"); for (FunktionRule rule : rules) { table.row(rule.getName(), rule.getTrigger(), rule.getAction(), rule.getChain()); } addTableTextOutput(buffer, "Rules", table); } } return buffer.toString(); } }
@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; } }
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(); }
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(); }
@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; } }
table.row(containerId, resolver, localHostName, localIp, publicHostName, publicIp, manualIp);
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(); } }
@Override protected void printRequirements(PrintStream out, FabricRequirements requirements) { TablePrinter table = new TablePrinter(); table.columns("profile", "# minimum", "# maximum", "depends on"); List<ProfileRequirements> profileRequirements = requirements.getProfileRequirements(); for (ProfileRequirements profile : profileRequirements) { table.row(profile.getProfile(), getStringOrBlank(profile.getMinimumInstances()), getStringOrBlank(profile.getMaximumInstances()), getStringOrBlank(profile.getDependentProfiles())); } table.print(); }
protected void printProfiles(ProfileService profileService, List<Profile> profiles, PrintStream out) { TablePrinter table = new TablePrinter(); table.columns("id", "# containers", "parents"); for (Profile profile : profiles) { String versionId = profile.getVersion(); String profileId = profile.getId(); // skip profiles that do not exists (they may have been deleted) if (profileService.hasProfile(versionId, profileId) && (hidden || !profile.isHidden())) { int active = fabricService.getAssociatedContainers(versionId, profileId).length; String parents = Strings.join(profile.getParentIds(), " "); table.row(profileId, activeContainerCountText(active), parents); } } table.print(); }