Search in sources :

Example 46 with ShellTable

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

the class ListEndpointsCommand method execute.

@Override
public Object execute() throws Exception {
    List<Bus> busses;
    if (name == null) {
        busses = getBusses();
    } else {
        Bus b = getBus(name);
        if (b != null) {
            busses = Collections.singletonList(getBus(name));
        } else {
            busses = Collections.emptyList();
        }
    }
    ShellTable table = new ShellTable();
    if (terminal != null && terminal.getWidth() > 0) {
        table.size(terminal.getWidth());
    }
    table.column("Name");
    table.column("State");
    table.column("Address");
    table.column("BusID");
    for (Bus b : busses) {
        ServerRegistry reg = b.getExtension(ServerRegistry.class);
        List<Server> servers = reg.getServers();
        for (Server serv : servers) {
            String qname = serv.getEndpoint().getEndpointInfo().getName().getLocalPart();
            String started = serv.isStarted() ? "Started" : "Stopped";
            String address = serv.getEndpoint().getEndpointInfo().getAddress();
            if (fullAddress) {
                address = toFullAddress(address);
            }
            String busId = b.getId();
            table.addRow().addContent(qname, started, address, busId);
        }
    }
    table.print(System.out, !noFormat);
    return null;
}
Also used : Bus(org.apache.cxf.Bus) ShellTable(org.apache.karaf.shell.support.table.ShellTable) Server(org.apache.cxf.endpoint.Server) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry)

Example 47 with ShellTable

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

the class ListBussesCommand method execute.

@Override
public Object execute() throws Exception {
    List<Bus> busses = getBusses();
    ShellTable table = new ShellTable();
    if (terminal != null && terminal.getWidth() > 0) {
        table.size(terminal.getWidth());
    }
    table.column("Name");
    table.column("State");
    for (Bus bus : busses) {
        String name = bus.getId();
        String state = bus.getState().toString();
        table.addRow().addContent(name, state);
    }
    table.print(System.out, !noFormat);
    return null;
}
Also used : Bus(org.apache.cxf.Bus) ShellTable(org.apache.karaf.shell.support.table.ShellTable)

Aggregations

ShellTable (org.apache.karaf.shell.support.table.ShellTable)47 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 Repository (org.apache.karaf.features.Repository)3 List (java.util.List)2 TreeMap (java.util.TreeMap)2 Bus (org.apache.cxf.Bus)2 Feature (org.apache.karaf.features.Feature)2 MavenRepositoryURL (org.apache.karaf.maven.core.MavenRepositoryURL)2 PackageVersion (org.apache.karaf.packages.core.PackageVersion)2 Proxy (org.apache.maven.settings.Proxy)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