Examples of ShellTable


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

            maxPName = Math.max(maxPName, emptyIfNull(resource.getPresentationName()).length());
            maxSName = Math.max(maxSName, emptyIfNull(resource.getSymbolicName()).length());
            maxVersion = Math.max(maxVersion, emptyIfNull(resource.getVersion()).length());
        }

        ShellTable table = new ShellTable();
        table.column("Name");
        table.column("Symbolic Name");
        table.column("Version");
        table.emptyTableText("No matching bundles");

        for (Resource resource : resources) {
            table.addRow().addContent(emptyIfNull(resource.getPresentationName()),
                    emptyIfNull(resource.getSymbolicName()),
                    emptyIfNull(resource.getVersion()));
        }

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

        return null;
    }
View Full Code Here

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

    @Argument(index = 1, name = "queue", description = "The JMS queue name", required = true, multiValued = false)
    String queue;

    public Object doExecute() throws Exception {
        ShellTable table = new ShellTable();
        table.column("Messages Count");
        table.addRow().addContent(getJmsService().count(connectionFactory, queue, username, password));
        table.print(System.out);
        return null;
    }
View Full Code Here

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

    @Option(name = "-v", aliases = { "--verbose" }, description = "Display JMS properties", required = false, multiValued = false)
    boolean verbose = false;

    public Object doExecute() throws Exception {

        ShellTable table = new ShellTable();
        table.column("Message ID");
        table.column("Content").maxSize(80);
        table.column("Charset");
        table.column("Type");
        table.column("Correlation ID");
        table.column("Delivery Mode");
        table.column("Destination");
        table.column("Expiration");
        table.column("Priority");
        table.column("Redelivered");
        table.column("ReplyTo");
        table.column("Timestamp");
        if (verbose) {
            table.column("Properties");
        }

        List<JmsMessage> messages = getJmsService().browse(connectionFactory, queue, selector, username, password);
        for (JmsMessage message : messages) {
            if (verbose) {
                StringBuilder properties = new StringBuilder();
                for (String property : message.getProperties().keySet()) {
                    properties.append(property).append("=").append(message.getProperties().get(property)).append("\n");
                }
                table.addRow().addContent(
                        message.getMessageId(),
                        message.getContent(),
                        message.getCharset(),
                        message.getType(),
                        message.getCorrelationID(),
                        message.getDeliveryMode(),
                        message.getDestination(),
                        message.getExpiration(),
                        message.getPriority(),
                        message.isRedelivered(),
                        message.getReplyTo(),
                        message.getTimestamp(),
                        properties.toString());
            } else {
                table.addRow().addContent(
                        message.getMessageId(),
                        message.getContent(),
                        message.getCharset(),
                        message.getType(),
                        message.getCorrelationID(),
                        message.getDeliveryMode(),
                        message.getDestination(),
                        message.getExpiration(),
                        message.getPriority(),
                        message.isRedelivered(),
                        message.getReplyTo(),
                        message.getTimestamp());
            }
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

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

@Command(scope = "jms", name = "topics", description = "List the JMS topics.")
public class TopicsCommand extends JmsConnectionCommandSupport {

    public Object doExecute() throws Exception {
        ShellTable table = new ShellTable();

        table.column("JMS Topics");

        for (String topic : getJmsService().topics(connectionFactory, username, password)) {
            table.addRow().addContent(topic);
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

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

    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

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

    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
    boolean noFormat;

    protected void doExecute(RepositoryAdmin admin) {

        ShellTable table = new ShellTable();
        table.column("Index");
        table.column("OBR URL");
        table.emptyTableText("No OBR repository URL");

        Repository[] repos = admin.listRepositories();
        if (repos != null) {
            for (int i = 0; i < repos.length; i++) {
                table.addRow().addContent(i, repos[i].getURI());
            }
        }

        table.print(System.out, !noFormat);
    }
View Full Code Here

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

@Command(scope = "jms", name = "info", description = "Provides details about a JMS connection factory.")
public class InfoCommand extends JmsConnectionCommandSupport {

    public Object doExecute() 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

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

@Command(scope = "jms", name = "connectionfactories", description = "List the JMS connection factories")
public class ConnectionFactoriesCommand extends JmsCommandSupport {

    public Object doExecute() 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

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

@Command(scope = "jms", name = "queues", description = "List the JMS queues.")
public class QueuesCommand extends JmsConnectionCommandSupport {

    public Object doExecute() throws Exception {
        ShellTable table = new ShellTable();

        table.column("JMS Queues");

        for (String queue : getJmsService().queues(connectionFactory, username, password)) {
            table.addRow().addContent(queue);
        }

        table.print(System.out);

        return null;
    }
View Full Code Here

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

    @Argument(index = 0, name = "context", description = "The base JNDI context", required = false, multiValued = false)
    String context;

    public Object doExecute() throws Exception {
        ShellTable table = new ShellTable();

        table.column("JNDI Sub-Context");

        List<String> contexts;
        if (context == null) {
            contexts = this.getJndiService().contexts();
        } else {
            contexts = this.getJndiService().contexts(context);
        }

        for (String c : contexts) {
            table.addRow().addContent(c);
        }

        table.print(System.out);

        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.