List of usage examples for javax.management.openmbean CompositeType CompositeType
public CompositeType(String typeName, String description, String[] itemNames, String[] itemDescriptions, OpenType<?>[] itemTypes) throws OpenDataException
CompositeType
instance, checking for the validity of the given parameters. From source file:com.alibaba.dragoon.stat.SpringIbatisStatementStats.java
public static CompositeType getCompositeTypeInternal() throws OpenDataException { if (compositeType != null) { return compositeType; }//ww w . jav a 2s . 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.seajas.search.profiler.service.management.ManagementService.java
/** * {@inheritDoc}/*from w ww.jav a2 s. c o 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:org.eclipse.gyrex.monitoring.internal.mbeans.MetricSetMBean.java
private CompositeType getType(final BaseMetric metric) throws OpenDataException { // get attributes final List<MetricAttribute> attributes = metric.getAttributes(); // collect names, descriptions and types final List<String> names = new ArrayList<String>(attributes.size()); final List<String> descriptions = new ArrayList<String>(attributes.size()); final List<OpenType> types = new ArrayList<OpenType>(attributes.size()); for (final MetricAttribute attribute : attributes) { final OpenType openType = detectType(attribute.getType()); if (null != openType) { names.add(attribute.getName()); descriptions.add(attribute.getDescription()); types.add(openType);/*from ww w . j a v a 2s .c o m*/ } } return new CompositeType(metric.getClass().getSimpleName(), "Metric of type " + metric.getClass().getName(), names.toArray(new String[names.size()]), descriptions.toArray(new String[descriptions.size()]), types.toArray(new OpenType[types.size()])); }
From source file:com.seajas.search.profiler.service.management.ManagementService.java
/** * {@inheritDoc}/*from w ww.ja v a 2 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: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 ww w . jav a 2 s .c om*/ .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:com.seajas.search.profiler.service.management.ManagementService.java
/** * {@inheritDoc}/*from w w w. j a v a 2 s. co m*/ */ @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: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 ww w.j a v a 2 s . c om*/ */ 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}//from w w w. j av a 2 s .c o 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" }); }