Example usage for javax.management.openmbean SimpleType STRING

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

Introduction

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

Prototype

SimpleType STRING

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

Click Source Link

Document

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

Usage

From source file:com.alibaba.dragoon.stat.SpringIbatisStatementStats.java

public static CompositeType getCompositeTypeInternal() throws OpenDataException {
    if (compositeType != null) {
        return compositeType;
    }// w ww .  j  a  v a 2  s.  c o m

    OpenType<?>[] indexTypes = new OpenType<?>[] { SimpleType.STRING, SimpleType.STRING, SimpleType.LONG,
            SimpleType.LONG, SimpleType.LONG, SimpleType.DATE, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.INTEGER, SimpleType.INTEGER };

    String[] indexNames = { "id", "resource", "executeCount", "errorCount", "totalTime", "lastTime",
            "updateCount", "fetchObjectCount", "effectedRowCount", "concurrentMax", "runningCount" };

    String[] indexDescriptions = indexNames;

    compositeType = new CompositeType("IbatisStatementStat", "IbatisStatementStat", indexNames,
            indexDescriptions, indexTypes);

    return compositeType;
}

From source file:com.adobe.acs.commons.errorpagehandler.cache.impl.ErrorPageCacheImpl.java

@SuppressWarnings("squid:S1192")
public final TabularData getCacheEntries() throws OpenDataException {

    final CompositeType cacheEntryType = new CompositeType("cacheEntry", "Cache Entry",
            new String[] { "errorPage", "hit", "miss", "hitRate", "missRate", "sizeInKB" },
            new String[] { "Error Page", "Hit", "Miss", "Hit Rate", "Miss Rate", "Size in KB" },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.FLOAT,
                    SimpleType.FLOAT, SimpleType.INTEGER });

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType("cacheEntries", "Cache Entries", cacheEntryType, new String[] { "errorPage" }));

    for (final Map.Entry<String, CacheEntry> entry : this.cache.entrySet()) {
        final CacheEntry cacheEntry = entry.getValue();

        final Map<String, Object> data = new HashMap<String, Object>();
        data.put("errorPage", entry.getKey());
        data.put("hit", cacheEntry.getHits());
        data.put("miss", cacheEntry.getMisses());
        data.put("hitRate", cacheEntry.getHitRate());
        data.put("missRate", cacheEntry.getMissRate());
        data.put("sizeInKB", cacheEntry.getBytes() / KB_IN_BYTES);

        tabularData.put(new CompositeDataSupport(cacheEntryType, data));
    }//w  w w.j  a  v a  2  s .c  om

    return tabularData;
}

From source file:com.adobe.acs.commons.oak.impl.EnsureOakIndexManagerImpl.java

/**
 * Method for displaying Ensure Oak Index state in in the MBean
 *
 * @return the Ensure Oak Index data in a Tabular Format for the MBean
 * @throws OpenDataException//w  w  w.  j  a  v a  2s  .  c  o m
 */
@Override
@SuppressWarnings("squid:S1192")
public final TabularData getEnsureOakIndexes() throws OpenDataException {

    final CompositeType configType = new CompositeType("Ensure Oak Index Configurations",
            "Ensure Oak Index Configurations",
            new String[] { "Ensure Definitions Path", "Oak Indexes Path", "Applied", "Immediate" },
            new String[] { "Ensure Definitions Path", "Oak Indexes Path", "Applied", "Immediate" },
            new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN });

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType("Ensure Oak Index Configuration", "Ensure Oak Index Configuration", configType,
                    new String[] { "Ensure Definitions Path", "Oak Indexes Path" }));

    for (final AppliableEnsureOakIndex index : this.ensureIndexes) {
        final Map<String, Object> data = new HashMap<String, Object>();

        data.put("Ensure Definitions Path", index.getEnsureDefinitionsPath());
        data.put("Oak Indexes Path", index.getOakIndexesPath());
        data.put("Applied", index.isApplied());
        data.put("Immediate", index.isImmediate());

        tabularData.put(new CompositeDataSupport(configType, data));
    }

    return tabularData;
}

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

/**
 * {@inheritDoc}/*from ww  w. ja v a  2s.  co m*/
 */
@Override
public CompositeData getActiveResultModifiers() throws OpenDataException {
    List<Modifier> modifiers = profilerService.getResultModifiers();

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

    for (Modifier modifier : modifiers)
        if (modifier.getIsEnabled() && modifier.getTestFeed() != null
                && modifier.getTestFeed().getIsEnabled()) {
            TestElement testFeed = testingService.getTestFeedByModifierId(modifier.getId());

            if (testFeed != null)
                try {
                    results.put(modifier.getId(), testingService.testResultModifier(testFeed));
                } catch (TestingException e) {
                    Map<String, Boolean> exceptionResult = new HashMap<String, Boolean>();

                    exceptionResult.put("exception", false);
                    results.put(modifier.getId(), exceptionResult);

                    logger.error("Testing exception occurred", 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 + " results were successful" });
}

From source file:com.adobe.acs.commons.httpcache.store.caffeine.impl.CaffeineMemHttpCacheStoreImpl.java

@Override
protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(AbstractCacheMBean.JMX_PN_CACHEENTRY, AbstractCacheMBean.JMX_PN_CACHEENTRY,
            new String[] { AbstractCacheMBean.JMX_PN_CACHEKEY, AbstractCacheMBean.JMX_PN_STATUS,
                    AbstractCacheMBean.JMX_PN_SIZE, AbstractCacheMBean.JMX_PN_CONTENTTYPE,
                    AbstractCacheMBean.JMX_PN_CHARENCODING, AbstractCacheMBean.JMX_PN_HITS,
                    AbstractCacheMBean.JMX_PN_TOTALSIZESERVED },
            new String[] { AbstractCacheMBean.JMX_PN_CACHEKEY, AbstractCacheMBean.JMX_PN_STATUS,
                    AbstractCacheMBean.JMX_PN_SIZE, AbstractCacheMBean.JMX_PN_CONTENTTYPE,
                    AbstractCacheMBean.JMX_PN_CHARENCODING, AbstractCacheMBean.JMX_PN_HITS,
                    AbstractCacheMBean.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 v a  2  s  .  c  om
 */
@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:org.eclipse.gyrex.monitoring.internal.mbeans.MetricSetMBean.java

private void initialize() {
    final List<OpenMBeanAttributeInfoSupport> attributes = new ArrayList<OpenMBeanAttributeInfoSupport>();
    final OpenMBeanConstructorInfoSupport[] constructors = new OpenMBeanConstructorInfoSupport[0];
    final List<OpenMBeanOperationInfoSupport> operations = new ArrayList<OpenMBeanOperationInfoSupport>(1);
    final MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

    // common attribute
    attributes//from   www. j a v a2  s. co m
            .add(new OpenMBeanAttributeInfoSupport(ID, "MetricSet Id", SimpleType.STRING, true, false, false));
    attributes.add(new OpenMBeanAttributeInfoSupport(DESCRIPTION, "MetricSet Description", SimpleType.STRING,
            true, false, false));

    // service property attributes
    try {
        final String[] propertyTypeNames = new String[] { "key", "value" };
        propertyType = new CompositeType("property", "A property with name and value.", propertyTypeNames,
                new String[] { "Name", "Value" }, new OpenType[] { SimpleType.STRING, SimpleType.STRING });
        propertyTableType = new TabularType(PROPERTIES, "A lst of properties.", propertyType,
                new String[] { "key" });
        attributes.add(new OpenMBeanAttributeInfoSupport(PROPERTIES, "MetricSet Properties", propertyTableType,
                true, false, false));

        // pre-build service properties
        properties = new TabularDataSupport(propertyTableType);
        final String[] propertyKeys = reference.getPropertyKeys();
        for (final String serviceProperty : propertyKeys) {
            if (serviceProperty.startsWith("gyrex.") || serviceProperty.equals(Constants.SERVICE_DESCRIPTION)
                    || serviceProperty.equals(Constants.SERVICE_VENDOR)) {
                final Object value = reference.getProperty(serviceProperty);
                if (value == null) {
                    continue;
                }
                if (isConvertibleToString(value.getClass())) {
                    final Object[] values = { serviceProperty, String.valueOf(value) };
                    properties.put(new CompositeDataSupport(propertyType, propertyTypeNames, values));
                }
            }
        }
    } catch (final OpenDataException e) {
        attributes.add(new OpenMBeanAttributeInfoSupport("propertiesError",
                "Exception occured while determining properties. " + e.toString(), SimpleType.STRING, true,
                false, false));
    }

    // metrics
    final List<BaseMetric> metrics = metricSet.getMetrics();
    metricTypesByAttributeName = new HashMap<String, CompositeType>(metrics.size());
    metricByAttributeName = new HashMap<String, BaseMetric>(metrics.size());
    for (final BaseMetric metric : metrics) {
        final String attributeName = StringUtils.removeStart(metric.getId(), metricSet.getId() + ".");
        try {
            final CompositeType type = getType(metric);
            if (type != null) {
                metricTypesByAttributeName.put(attributeName, type);
                metricByAttributeName.put(attributeName, metric);
                attributes.add(new OpenMBeanAttributeInfoSupport(attributeName, metric.getId(), type, true,
                        false, false));
            }
        } catch (final OpenDataException e) {
            attributes.add(new OpenMBeanAttributeInfoSupport(attributeName + "Error",
                    "Exception occured while determining properties. " + e.toString(), SimpleType.STRING, true,
                    false, false));
        }
    }

    // reset operation for metric
    operations.add(new OpenMBeanOperationInfoSupport(RESET_STATS, "reset the metric statistics", null,
            SimpleType.VOID, MBeanOperationInfo.ACTION));

    // build the info
    beanInfo = new OpenMBeanInfoSupport(this.getClass().getName(), metricSet.getDescription(),
            attributes.toArray(new OpenMBeanAttributeInfoSupport[attributes.size()]), constructors,
            operations.toArray(new OpenMBeanOperationInfoSupport[operations.size()]), notifications);
}

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

/***
 * Virtual host information are needed in the constructor to evaluate user permissions for
 * queue management actions.(e.g. purge)
 *
 * @param vHostMBean Used to access the virtual host information
 * @throws NotCompliantMBeanException//from w  w  w  .j a  va2  s.  c o m
 */
public QueueManagementInformationMBean(VirtualHostImpl.VirtualHostMBean vHostMBean)
        throws NotCompliantMBeanException, OpenDataException {
    super(QueueManagementInformation.class, QueueManagementInformation.TYPE);

    andesChannel = Andes.getInstance().createChannel(new FlowControlListener() {
        @Override
        public void block() {
            restoreBlockedByFlowControl = true;
        }

        @Override
        public void unblock() {
            restoreBlockedByFlowControl = false;
        }

        @Override
        public void disconnect() {
            // Do nothing. since its not applicable.
        }
    });

    VirtualHost virtualHost = vHostMBean.getVirtualHost();

    queueRegistry = virtualHost.getQueueRegistry();
    disablePubAck = new DisablePubAckImpl();

    _msgContentAttributeTypes[0] = SimpleType.STRING; // For message properties
    _msgContentAttributeTypes[1] = SimpleType.STRING; // For content type
    _msgContentAttributeTypes[2] = new ArrayType(1, SimpleType.STRING); // For message content
    _msgContentAttributeTypes[3] = SimpleType.STRING; // For JMS message id
    _msgContentAttributeTypes[4] = SimpleType.BOOLEAN; // For redelivered
    _msgContentAttributeTypes[5] = SimpleType.LONG; // For JMS timeStamp
    _msgContentAttributeTypes[6] = SimpleType.STRING; // For dlc message destination
    _msgContentAttributeTypes[7] = SimpleType.LONG; // For andes message metadata id
    _msgContentType = new CompositeType("Message Content", "Message content for queue browse",
            VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC
                    .toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
            VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(
                    new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
            _msgContentAttributeTypes);
    lz4CompressionHelper = new LZ4CompressionHelper();
}

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 .j a  v  a 2s  . c om*/
 */
@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" });
}