Search in sources :

Example 41 with ShellTable

use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.

the class PsCommand method execute.

@Override
public Object execute() throws Exception {
    ShellTable table = new ShellTable();
    table.column("Id");
    table.column("Names");
    table.column("Command");
    table.column("Created");
    table.column("Image");
    table.column("Image ID");
    table.column("Status");
    table.column("State");
    table.column("Ports");
    table.column("Size");
    table.column("Size Root");
    for (Container container : getDockerService().ps(showAll, url)) {
        StringBuilder portBuffer = new StringBuilder();
        for (Port port : container.getPorts()) {
            portBuffer.append(port.getType()).append(":").append(port.getPrivatePort()).append(":").append(port.getPublicPort()).append(" ");
        }
        table.addRow().addContent(container.getId(), container.getNames(), container.getCommand(), container.getCreated(), container.getImage(), container.getImageId(), container.getStatus(), container.getState(), portBuffer.toString(), container.getSizeRw(), container.getSizeRootFs());
    }
    table.print(System.out);
    return null;
}
Also used : Container(org.apache.karaf.docker.Container) ShellTable(org.apache.karaf.shell.support.table.ShellTable) Port(org.apache.karaf.docker.Port)

Example 42 with ShellTable

use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.

the class SearchCommand method execute.

@Override
public Object execute() throws Exception {
    ShellTable table = new ShellTable();
    table.column("Name");
    table.column("Description");
    table.column("Automated");
    table.column("Official");
    table.column("Star Count");
    for (ImageSearch search : getDockerService().search(term, url)) {
        table.addRow().addContent(search.getName(), search.getDescription(), search.isAutomated(), search.isOfficial(), search.getStarCount());
    }
    table.print(System.out);
    return null;
}
Also used : ShellTable(org.apache.karaf.shell.support.table.ShellTable) ImageSearch(org.apache.karaf.docker.ImageSearch)

Example 43 with ShellTable

use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.

the class ListProvidedFeaturesCommand method doExecute.

@Override
protected void doExecute(FeaturesService service) throws Exception {
    ShellTable table = new ShellTable();
    table.column("Name");
    table.column("Version");
    for (Feature feature : service.repositoryProvidedFeatures(featuresRepositoryUri)) {
        table.addRow().addContent(feature.getName(), feature.getVersion());
    }
    table.print(System.out);
}
Also used : ShellTable(org.apache.karaf.shell.support.table.ShellTable) Feature(org.apache.karaf.features.Feature)

Example 44 with ShellTable

use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.

the class RepoListCommand method doExecute.

protected void doExecute(FeaturesService featuresService) throws Exception {
    if (reload) {
        reloadAllRepos(featuresService);
    }
    ShellTable table = new ShellTable();
    table.column("Repository");
    table.column("URL");
    if (showBlacklisted) {
        table.column("Blacklisted");
    }
    table.emptyTableText("No repositories available");
    Repository[] repos = featuresService.listRepositories();
    for (Repository repo : repos) {
        if (repo != null) {
            if (showBlacklisted || !repo.isBlacklisted()) {
                Row row = table.addRow();
                row.addContent(repo.getName(), repo.getURI().toString());
                if (showBlacklisted) {
                    row.addContent(repo.isBlacklisted() ? "yes" : "no");
                }
            }
        }
    }
    table.print(System.out, !noFormat);
}
Also used : Repository(org.apache.karaf.features.Repository) ShellTable(org.apache.karaf.shell.support.table.ShellTable) Row(org.apache.karaf.shell.support.table.Row)

Example 45 with ShellTable

use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.

the class RequirementList method execute.

@Override
public Object execute() throws Exception {
    Map<String, Set<String>> requirements = featuresService.listRequirements();
    ShellTable table = new ShellTable();
    table.column("Region");
    table.column("Requirement");
    table.emptyTableText("No requirements defined");
    for (Map.Entry<String, Set<String>> entry : requirements.entrySet()) {
        for (String requirement : entry.getValue()) {
            table.addRow().addContent(entry.getKey(), requirement);
        }
    }
    table.print(System.out, !noFormat);
    return null;
}
Also used : Set(java.util.Set) ShellTable(org.apache.karaf.shell.support.table.ShellTable) Map(java.util.Map)

Aggregations

ShellTable (org.apache.karaf.shell.support.table.ShellTable)59 Row (org.apache.karaf.shell.support.table.Row)10 Col (org.apache.karaf.shell.support.table.Col)7 ArrayList (java.util.ArrayList)4 Bundle (org.osgi.framework.Bundle)4 Map (java.util.Map)3 Feature (org.apache.karaf.features.Feature)3 Repository (org.apache.karaf.features.Repository)3 List (java.util.List)2 TreeMap (java.util.TreeMap)2 Bus (org.apache.cxf.Bus)2 Booking (org.apache.karaf.examples.jdbc.api.Booking)2 Booking (org.apache.karaf.examples.jpa.Booking)2 MavenRepositoryURL (org.apache.karaf.maven.core.MavenRepositoryURL)2 Attribute (ddf.catalog.data.Attribute)1 Result (ddf.catalog.data.Result)1 SortByImpl (ddf.catalog.filter.impl.SortByImpl)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 SourceResponse (ddf.catalog.operation.SourceResponse)1 QueryImpl (ddf.catalog.operation.impl.QueryImpl)1