Example usage for javax.management.openmbean SimpleType INTEGER

List of usage examples for javax.management.openmbean SimpleType INTEGER

Introduction

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

Prototype

SimpleType INTEGER

To view the source code for javax.management.openmbean SimpleType INTEGER.

Click Source Link

Document

The SimpleType instance describing values whose Java class name is java.lang.Integer.

Usage

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}/*from  ww  w  .jav a2  s  .co m*/
 */
@Override
public CompositeData getActiveFeedConnections() throws OpenDataException {
    List<Feed> feeds = profilerService.getEnabledFeeds();

    Map<Integer, Map<String, Boolean>> results = new HashMap<Integer, Map<String, Boolean>>();

    for (Feed feed : feeds)
        try {
            results.put(feed.getId(), testingService.testFeedConnection(feed));
        } catch (TestingException e) {
            logger.error("Could not test feed with ID " + feed.getId() + " as no testing response was received",
                    e);
        }

    Integer successful = 0, total = 0;

    for (Entry<Integer, Map<String, Boolean>> modifierResult : results.entrySet())
        for (Entry<String, Boolean> result : modifierResult.getValue().entrySet()) {
            total++;

            if (result.getValue())
                successful++;
        }

    // Return the compound status as the absolute difference - where 0 means success

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { Math.abs(successful - total),
                    successful + "/" + total + " feeds could be successfully retrieved" });
}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}//from   w ww.  j  a v a2  s .com
 */
@Override
public CompositeData getActiveArchiveConnections() throws OpenDataException {
    List<Archive> archives = profilerService.getEnabledArchives();

    Map<Integer, Map<String, Boolean>> results = new HashMap<Integer, Map<String, Boolean>>();

    for (Archive archive : archives)
        try {
            results.put(archive.getId(), testingService.testArchiveConnection(archive));
        } catch (TestingException e) {
            logger.error(
                    "Could not test feed with ID " + archive.getId() + " as no testing response was received",
                    e);
        }

    Integer successful = 0, total = 0;

    for (Entry<Integer, Map<String, Boolean>> modifierResult : results.entrySet())
        for (Entry<String, Boolean> result : modifierResult.getValue().entrySet()) {
            total++;

            if (result.getValue())
                successful++;
        }

    // Return the compound status as the absolute difference - where 0 means success

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" }, new Object[] {
            Math.abs(successful - total), successful + "/" + total + " archives could successfully connect" });
}

From source file:com.alibaba.dragoon.client.DragoonClient.java

private CompositeType getSessionType() throws JMException {
    OpenType<?>[] indexTypes = new OpenType<?>[] { SimpleType.DATE, SimpleType.STRING, SimpleType.STRING,
            SimpleType.INTEGER, SimpleType.INTEGER };

    String[] indexNames = { "createdDate", "localAddress", "remoteAddress", "receivedMessageCount",
            "sentMessageCount" };
    String[] indexDescriptions = { "createdDate", "localAddress", "remoteAddress", "receivedMessageCount",
            "sentMessageCount" };

    return new CompositeType("Session", "Session", indexNames, indexDescriptions, indexTypes);
}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}//w  w w. jav  a 2  s . co  m
 */
@Override
public CompositeData getLoggingCount() throws OpenDataException {
    Integer count = profilerService.getLoggingCount();

    // Return the compound status as the number of messages

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { count, "The logging table contains " + count + " entries" });
}

From source file:com.adobe.acs.commons.httpcache.store.mem.impl.MemHttpCacheStoreImpl.java

@Override
@SuppressWarnings("squid:S1192")
protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(JMX_PN_CACHEENTRY, JMX_PN_CACHEENTRY,
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE, JMX_PN_CHARENCODING,
                    JMX_PN_HITS, JMX_PN_TOTALSIZESERVED },
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE, JMX_PN_CHARENCODING,
                    JMX_PN_HITS, JMX_PN_TOTALSIZESERVED },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING,
                    SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING });

}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}/*from  w w  w.j a  va2  s  .  c  om*/
 */
@Override
public CompositeData getElementCacheCount() throws OpenDataException {
    Integer count = cacheService.getCacheCounts().get("elementCache");

    // Return the compound status as the number of messages

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { count, "The queue cache contains " + count + " entries" });
}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}/*from   w  ww. java  2 s .  com*/
 */
@Override
public CompositeData getDeleteCacheCount() throws OpenDataException {
    Integer count = cacheService.getCacheCounts().get("deleteCache");

    // Return the compound status as the number of messages

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { count, "The delete cache contains " + count + " entries" });
}

From source file:org.wso2.andes.server.information.management.QueueManagementInformationMBean.java

/**
 * {@inheritDoc}/*ww  w .j  av  a2 s .com*/
 */
@Override
public CompositeData getMessageCountOfQueuesAsCompositeData() {
    CompositeDataSupport support;
    try {
        Map<String, java.lang.Integer> messageCounts = getAllQueueCounts();

        OpenType[] messageCountAttributeTypes = new OpenType[messageCounts.size()];
        String[] itemNames = messageCounts.keySet().toArray(new String[0]);
        String[] itemDescriptions = messageCounts.keySet().toArray(new String[0]);
        for (int count = 0; count < messageCounts.size(); count++) {
            messageCountAttributeTypes[count] = SimpleType.INTEGER;
        }
        CompositeType messageCountCompositeType = new CompositeType("Message Count of Queues",
                "Message count of queues", itemNames, itemDescriptions, messageCountAttributeTypes);
        support = new CompositeDataSupport(messageCountCompositeType, messageCounts);
    } catch (OpenDataException e) {
        log.error("Error in accessing retrieving message count information", e);
        throw new RuntimeException("Error in accessing retrieving message count information", e);
    }
    return support;
}

From source file:org.jolokia.converter.json.TabularDataExtractor.java

private Object getKey(CompositeType rowType, String key, String value) {
    OpenType keyType = rowType.getType(key);
    if (SimpleType.STRING == keyType) {
        return value;
    } else if (SimpleType.INTEGER == keyType) {
        return Integer.parseInt(value);
    } else if (SimpleType.LONG == keyType) {
        return Long.parseLong(value);
    } else if (SimpleType.SHORT == keyType) {
        return Short.parseShort(value);
    } else if (SimpleType.BYTE == keyType) {
        return Byte.parseByte(value);
    } else if (SimpleType.OBJECTNAME == keyType) {
        try {/* w ww .j a  v  a  2 s.co  m*/
            return new ObjectName(value);
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException("Can not convert " + value + " to an ObjectName", e);
        }
    } else {
        throw new IllegalArgumentException(
                "All keys must be a string, integer, long, short, byte or ObjectName type for accessing TabularData via a path. "
                        + "This is not the case for '" + key + "' which is of type " + keyType);
    }
}

From source file:com.adobe.acs.commons.httpcache.store.jcr.impl.JCRHttpCacheStoreImpl.java

protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(JMX_PN_CACHEENTRY, JMX_PN_CACHEENTRY,
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE,
                    JMX_PN_CHARENCODING },
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE,
                    JMX_PN_CHARENCODING },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING,
                    SimpleType.STRING });

}