Example usage for javax.management.openmbean TabularDataSupport put

List of usage examples for javax.management.openmbean TabularDataSupport put

Introduction

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

Prototype

public void put(CompositeData value) 

Source Link

Usage

From source file:com.adobe.acs.commons.httpcache.engine.impl.HttpCacheEngineImpl.java

@Override
public TabularData getRegisteredHttpCacheRules() throws OpenDataException {
    // @formatter:off
    final CompositeType cacheEntryType = new CompositeType(JMX_HTTPCACHE_HANDLING_RULE,
            JMX_HTTPCACHE_HANDLING_RULE, new String[] { JMX_HTTPCACHE_HANDLING_RULE },
            new String[] { JMX_HTTPCACHE_HANDLING_RULE }, new OpenType[] { SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType(JMX_PN_HTTPCACHE_HANDLING_RULES, JMX_PN_HTTPCACHE_HANDLING_RULES, cacheEntryType,
                    new String[] { JMX_HTTPCACHE_HANDLING_RULE }));
    // @formatter:on

    for (final Map.Entry<String, HttpCacheHandlingRule> entry : cacheHandlingRules.entrySet()) {
        final Map<String, Object> row = new HashMap<String, Object>();

        row.put(JMX_HTTPCACHE_HANDLING_RULE, entry.getValue().getClass().getName());
        tabularData.put(new CompositeDataSupport(cacheEntryType, row));
    }// w  ww  .j  a v  a2s  .  co  m

    return tabularData;
}

From source file:com.adobe.acs.commons.httpcache.engine.impl.HttpCacheEngineImpl.java

@Override
public TabularData getRegisteredHttpCacheConfigs() throws OpenDataException {
    // @formatter:off
    // Exposing all google guava stats.
    final CompositeType cacheEntryType = new CompositeType(JMX_PN_HTTPCACHE_CONFIG, JMX_PN_HTTPCACHE_CONFIG,
            new String[] { JMX_PN_ORDER, JMX_PN_OSGICOMPONENT },
            new String[] { JMX_PN_ORDER, JMX_PN_OSGICOMPONENT },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(new TabularType(JMX_PN_HTTPCACHE_CONFIGS,
            JMX_PN_HTTPCACHE_CONFIGS, cacheEntryType, new String[] { JMX_PN_OSGICOMPONENT }));

    // @formatter:on

    for (HttpCacheConfig cacheConfig : this.cacheConfigs) {
        final Map<String, Object> row = new HashMap<String, Object>();

        Map<String, Object> osgiConfig = cacheConfigConfigs.get(cacheConfig);

        row.put(JMX_PN_ORDER, cacheConfig.getOrder());
        row.put(JMX_PN_OSGICOMPONENT, (String) osgiConfig.get(Constants.SERVICE_PID));

        tabularData.put(new CompositeDataSupport(cacheEntryType, row));
    }/*from w  w w .ja  v  a 2 s. c o m*/

    return tabularData;
}

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier.java

@Override
public TabularData getIndexPathMapping() {
    TabularDataSupport tds;
    try {//  w  w  w  . j  a v  a  2 s.  com
        TabularType tt = new TabularType(IndexMappingData.class.getName(), "Lucene Index Stats",
                IndexMappingData.TYPE, new String[] { "jcrPath" });
        tds = new TabularDataSupport(tt);
        for (LocalIndexDir indexDir : indexRootDirectory.getAllLocalIndexes()) {
            String size = humanReadableByteCount(indexDir.size());
            tds.put(new CompositeDataSupport(IndexMappingData.TYPE, IndexMappingData.FIELD_NAMES,
                    new String[] { indexDir.getJcrPath(), indexDir.getFSPath(), size }));
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}

From source file:org.apache.qpid.server.jmx.mbeans.QueueMBean.java

public TabularData viewMessages(long startPosition, long endPosition) throws IOException, JMException {
    if ((startPosition > endPosition) || (startPosition < 1)) {
        throw new OperationsException("From Index = " + startPosition + ", To Index = " + endPosition
                + "\n\"From Index\" should be greater than 0 and less than \"To Index\"");
    }//from   www .ja  v a2 s . c  o  m

    if ((endPosition - startPosition) > Integer.MAX_VALUE) {
        throw new OperationsException(
                "Specified MessageID interval is too large. Intervals must be less than 2^31 in size");
    }

    List<QueueEntry> messages = getMessages(startPosition, endPosition);

    TabularDataSupport messageTable = new TabularDataSupport(MSG_LIST_DATA_TYPE);

    // Create the tabular list of message header contents
    long position = startPosition;

    for (QueueEntry queueEntry : messages) {
        ServerMessage serverMsg = queueEntry.getMessage();
        AMQMessageHeader header = serverMsg.getMessageHeader();
        String[] headerAttributes = { "reply-to = " + header.getReplyTo(), "propertyFlags = ",
                "ApplicationID = " + header.getAppId(), "ClusterID = ", "UserId = " + header.getUserId(),
                "JMSMessageID = " + header.getMessageId(), "JMSCorrelationID = " + header.getCorrelationId(),
                "JMSDeliveryMode = " + (serverMsg.isPersistent() ? "Persistent" : "Non_Persistent"),
                "JMSPriority = " + header.getPriority(), "JMSType = " + header.getType(),
                "JMSExpiration = " + (header.getExpiration() == 0 ? null
                        : FAST_DATE_FORMAT.format(header.getExpiration())),
                "JMSTimestamp = " + (header.getTimestamp() == 0 ? null
                        : FAST_DATE_FORMAT.format(header.getTimestamp())) };

        Object[] itemValues = new Object[] { serverMsg.getMessageNumber(), headerAttributes,
                serverMsg.getSize(), queueEntry.isRedelivered(), position, queueEntry.getDeliveryCount() };

        position++;

        CompositeData messageData = new CompositeDataSupport(MSG_DATA_TYPE,
                VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC_ARRAY, itemValues);
        messageTable.put(messageData);
    }

    return messageTable;

}