Package org.apache.karaf.shell.support.table

Examples of org.apache.karaf.shell.support.table.ShellTable


        this.webContainerService = webContainerService;
    }

    @Override
    public Object execute() throws Exception {
      ShellTable table = new ShellTable();
        table.column(new Col("ID"));
        table.column(new Col("State"));
        table.column(new Col("Web-State"));
        table.column(new Col("Level"));
        table.column(new Col("Web-ContextPath"));
        table.column(new Col("Name"));
       
        java.util.List<WebBundle> webBundles = webContainerService.list();
        if (webBundles != null && !webBundles.isEmpty()) {
            for (WebBundle webBundle : webBundles) {
              table.addRow().addContent(
                        webBundle.getBundleId(),
                        webBundle.getState(),
                        webBundle.getWebState(),
                        webBundle.getLevel(),
                        webBundle.getContextPath(),
                        webBundle.getName());
            }
           
        }
        table.print(System.out, !noFormat);
        return null;
    }
View Full Code Here


    boolean noFormat;

    protected Object doExecute() throws Exception {
        getInstanceService().refreshInstance();
        Instance[] instances = getInstanceService().getInstances();
        ShellTable table = new ShellTable();
        table.column("SSH Port").alignRight();
        table.column("RMI Registry").alignRight();
        table.column("RMI Server").alignRight();
        table.column("State");
        table.column("PID");
        table.column(getRightColumnHeader());
        for (Instance instance : instances) {
            table.addRow().addContent(
                    instance.getSshPort(),
                    instance.getRmiRegistryPort(),
                    instance.getRmiServerPort(),
                    instance.getState(),
                    instance.getPid(),
                    getRightColumnValue(instance));
        }
        table.print(System.out, !noFormat);
        return null;
    }
View Full Code Here

    @Completion(DataSourcesNameCompleter.class)
    String datasource;

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();

        table.column("Property");
        table.column("Value");

        Map<String, String> info = this.getJdbcService().info(datasource);
        for (String property : info.keySet()) {
            table.addRow().addContent(property, info.get(property));
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

    @Completion(DataSourcesNameCompleter.class)
    String datasource;

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();

        Map<String, List<String>> map = this.getJdbcService().tables(datasource);
        int rowCount = 0;
        for (String column : map.keySet()) {
            table.column(column);
            rowCount = map.get(column).size();
        }

        for (int i = 0; i < rowCount; i++) {
            Row row = table.addRow();
            for (String column : map.keySet()) {
                row.addContent(map.get(column).get(i));
            }
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

    @Argument(index = 1, name = "query", description = "The SQL query to execute", required = true, multiValued = false)
    String query;

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();

        Map<String, List<String>> map = this.getJdbcService().query(datasource, query);
        int rowCount = 0;
        for (String column : map.keySet()) {
            table.column(column);
            rowCount = map.get(column).size();
        }

        for (int i = 0; i < rowCount; i++) {
            Row row = table.addRow();
            for (String column : map.keySet()) {
                row.addContent(map.get(column).get(i));
            }
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

@Service
public class DataSourcesCommand extends JdbcCommandSupport {

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();

        table.column("Name");
        table.column("Product");
        table.column("Version");
        table.column("URL");
        table.column("Status");

        Map<String, Set<String>> datasources = this.getJdbcService().aliases();
        for (Map.Entry<String, Set<String>> entry : datasources.entrySet()) {
            StringBuilder ids = new StringBuilder();
            for (String id : entry.getValue()) {
                if (ids.length() > 0) {
                    ids.append(", ");
                }
                ids.append(id);
            }
            String id = ids.toString();
            try {
                Map<String, String> info = this.getJdbcService().info(entry.getKey());
                table.addRow().addContent(id, info.get("db.product"), info.get("db.version"), info.get("url"), "OK");
            } catch (Exception e) {
                table.addRow().addContent(id, "", "", "", "Error");
            }
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

    @Reference
    private ServletService servletService;
   
    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();
        table.column(new Col("ID"));
        table.column(new Col("Servlet"));
        table.column(new Col("Servlet-Name"));
        table.column(new Col("State"));
        table.column(new Col("Alias"));
        table.column(new Col("Url"));

        for (ServletInfo info : servletService.getServlets()) {
            table.addRow().addContent(info.getBundle().getBundleId(), info.getClassName(), info.getName(),
                                      info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls()));
        }
        table.print(System.out, !noFormat);
        return null;
    }
View Full Code Here

    @Override
    public Object execute() throws Exception {
        Map<String, String> loggers = logService.getLevel(logger);

        ShellTable table = new ShellTable();
        table.column("Logger");
        table.column("Level");

        for (String logger : loggers.keySet()) {
            table.addRow().addContent(logger, loggers.get(logger));
        }

        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

@Service
public class InfoCommand extends JmsConnectionCommandSupport {

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();
        table.column("Property");
        table.column("Value");

        Map<String, String> info = getJmsService().info(connectionFactory, username, password);
        for (String key : info.keySet()) {
            table.addRow().addContent(key, info.get(key));
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

public class ConnectionFactoriesCommand extends JmsCommandSupport {

    @Override
    public Object execute() throws Exception {

        ShellTable table = new ShellTable();
        table.column("JMS Connection Factory");

        List<String> connectionFactories = getJmsService().connectionFactories();
        for (String connectionFactory : connectionFactories) {
            table.addRow().addContent(connectionFactory);
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.support.table.ShellTable

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.