Example usage for javax.management.openmbean OpenDataException OpenDataException

List of usage examples for javax.management.openmbean OpenDataException OpenDataException

Introduction

In this page you can find the example usage for javax.management.openmbean OpenDataException OpenDataException.

Prototype

public OpenDataException(String msg) 

Source Link

Document

An OpenDataException with a detail message.

Usage

From source file:org.xmatthew.spy2servers.jmx.AbstractComponentViewMBean.java

protected TabularData tabularDataWrapFromMessages(List<Message> messages) throws OpenDataException {
    if (CollectionUtils.isBlankCollection(messages)) {
        return null;
    }/*from   www .j  av  a2 s . co m*/

    messages = Collections.synchronizedList(messages);

    String[] itemNames = Message.getKeys().toArray(new String[Message.getKeys().size()]);
    String[] itemDescriptions = itemNames;
    OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
            SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING };
    CompositeType compositeType = new CompositeType("MessageList", "list spyed messages", itemNames,
            itemDescriptions, itemTypes);

    TabularType tt = new TabularType("MessageList", "MessageList", compositeType, itemNames);

    TabularDataSupport rc = new TabularDataSupport(tt);

    for (Message message : messages) {
        try {
            rc.put(new CompositeDataSupport(compositeType, message.getFileds()));
        } catch (Exception e) {
            throw new OpenDataException(e.getMessage());
        }
    }

    return rc;
}