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

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


@Service
public class QueuesCommand extends JmsConnectionCommandSupport {

    @Override
    public Object execute() 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


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

    @Override
    public Object execute() 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

    boolean verbose = false;

    @Override
    public Object execute() 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

@Service
public class TopicsCommand extends JmsConnectionCommandSupport {

    @Override
    public Object execute() 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

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.