@Override
public TabularData browse(String connectionFactory, String queue, String selector, String username, String password) throws MBeanException {
try {
CompositeType type = new CompositeType("message", "JMS Message",
new String[]{ "id", "content", "charset", "type", "correlation", "delivery", "destination", "expiration", "priority", "redelivered", "replyto", "timestamp" },
new String[]{ "Message ID", "Content", "Charset", "Type", "Correlation ID", "Delivery Mode", "Destination", "Expiration Date", "Priority", "Redelivered", "Reply-To", "Timestamp" },
new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.STRING, SimpleType.STRING });
TabularType tableType = new TabularType("messages", "JMS Messages", type, new String[]{ "id" });
TabularData table = new TabularDataSupport(tableType);
for (JmsMessage message : getJmsService().browse(connectionFactory, queue, selector, username, password)) {
CompositeData data = new CompositeDataSupport(type,
new String[]{ "id", "content", "charset", "type", "correlation", "delivery", "destination", "expiration", "priority", "redelivered", "replyto", "timestamp" },
new Object[]{ 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.put(data);
}
return table;
} catch (Throwable t) {
throw new MBeanException(null, t.getMessage());
}
}