Search in sources :

Example 21 with OpenType

use of javax.management.openmbean.OpenType in project druid by alibaba.

the class JdbcSqlStat method getCompositeType.

public static CompositeType getCompositeType() throws JMException {
    if (COMPOSITE_TYPE != null) {
        return COMPOSITE_TYPE;
    }
    OpenType<?>[] indexTypes = new OpenType<?>[] { //
    SimpleType.LONG, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.DATE, //
    SimpleType.LONG, //
    JMXUtils.getThrowableCompositeType(), //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.DATE, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.DATE, //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.STRING, //
    new ArrayType<Long>(SimpleType.LONG, true), //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    new ArrayType<Long>(SimpleType.LONG, true), //
    new ArrayType<Long>(SimpleType.LONG, true), //
    new ArrayType<Long>(SimpleType.LONG, true), //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG };
    String[] indexNames = { //
    "ID", //
    "DataSource", //
    "SQL", //
    "ExecuteCount", //
    "ErrorCount", //
    "TotalTime", //
    "LastTime", //
    "MaxTimespan", //
    "LastError", //
    "EffectedRowCount", //
    "FetchRowCount", //
    "MaxTimespanOccurTime", //
    "BatchSizeMax", //
    "BatchSizeTotal", //
    "ConcurrentMax", //
    "RunningCount", //
    "Name", //
    "File", //
    "LastErrorMessage", //
    "LastErrorClass", //
    "LastErrorStackTrace", //
    "LastErrorTime", //
    "DbType", //
    "InTransactionCount", //
    "URL", //
    "Histogram", //
    "LastSlowParameters", //
    "ResultSetHoldTime", //
    "ExecuteAndResultSetHoldTime", //
    "FetchRowCountHistogram", //
    "EffectedRowCountHistogram", //
    "ExecuteAndResultHoldTimeHistogram", //
    "EffectedRowCountMax", //
    "FetchRowCountMax", "ClobOpenCount", //
    "BlobOpenCount", //
    "ReadStringLength", //
    "ReadBytesLength", //
    "InputStreamOpenCount", //
    "ReaderOpenCount", //
    "HASH" };
    String[] indexDescriptions = indexNames;
    COMPOSITE_TYPE = new CompositeType("SqlStatistic", "Sql Statistic", indexNames, indexDescriptions, indexTypes);
    return COMPOSITE_TYPE;
}
Also used : ArrayType(javax.management.openmbean.ArrayType) OpenType(javax.management.openmbean.OpenType) CompositeType(javax.management.openmbean.CompositeType)

Example 22 with OpenType

use of javax.management.openmbean.OpenType in project nhin-d by DirectProject.

the class FileAuditor method registerMBean.

/*
	 * Register the MBean
	 */
private void registerMBean() {
    LOGGER.info("Registering FileAuditor MBean");
    try {
        itemNames = new String[] { "Event Id", "Event Time", "Event Principal", "Event Name", "Event Type", "Contexts" };
        OpenType<?>[] types = { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, ArrayType.getArrayType(SimpleType.STRING) };
        eventType = new CompositeType("AuditEvent", "Direct Auditable Event", itemNames, itemNames, types);
    } catch (OpenDataException e) {
        LOGGER.error("Failed to create settings composite type: " + e.getLocalizedMessage(), e);
        return;
    }
    Class<?> clazz = this.getClass();
    final StringBuilder objectNameBuilder = new StringBuilder(clazz.getPackage().getName());
    objectNameBuilder.append(":type=").append(clazz.getSimpleName());
    objectNameBuilder.append(",name=").append(UUID.randomUUID());
    try {
        final StandardMBean mbean = new StandardMBean(this, AuditorMBean.class);
        final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
        mbeanServer.registerMBean(mbean, new ObjectName(objectNameBuilder.toString()));
    } catch (JMException e) {
        LOGGER.error("Unable to register the FileAuditor MBean", e);
    }
}
Also used : OpenType(javax.management.openmbean.OpenType) OpenDataException(javax.management.openmbean.OpenDataException) StandardMBean(javax.management.StandardMBean) JMException(javax.management.JMException) CompositeType(javax.management.openmbean.CompositeType) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 23 with OpenType

use of javax.management.openmbean.OpenType in project nhin-d by DirectProject.

the class RDBMSAuditor method registerMBean.

/*
	 * Register the MBean
	 */
private void registerMBean() {
    LOGGER.info("Registering RDBMSAuditor MBean");
    try {
        itemNames = new String[] { "Event Id", "Event Time", "Event Principal", "Event Name", "Event Type", "Contexts" };
        OpenType<?>[] types = { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, ArrayType.getArrayType(SimpleType.STRING) };
        eventType = new CompositeType("AuditEvent", "Direct Auditable Event", itemNames, itemNames, types);
    } catch (OpenDataException e) {
        LOGGER.error("Failed to create settings composite type: " + e.getLocalizedMessage(), e);
        return;
    }
    final Class<?> clazz = this.getClass();
    final StringBuilder objectNameBuilder = new StringBuilder(clazz.getPackage().getName());
    objectNameBuilder.append(":type=").append(clazz.getSimpleName());
    objectNameBuilder.append(",name=").append(UUID.randomUUID());
    try {
        final StandardMBean mbean = new StandardMBean(this, AuditorMBean.class);
        final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
        mbeanServer.registerMBean(mbean, new ObjectName(objectNameBuilder.toString()));
    } catch (JMException e) {
        LOGGER.error("Unable to register the RDBMSAuditors MBean", e);
    }
}
Also used : OpenType(javax.management.openmbean.OpenType) OpenDataException(javax.management.openmbean.OpenDataException) StandardMBean(javax.management.StandardMBean) JMException(javax.management.JMException) CompositeType(javax.management.openmbean.CompositeType) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 24 with OpenType

use of javax.management.openmbean.OpenType in project deltaspike by apache.

the class DynamicMBeanWrapper method toTabularData.

private TabularData toTabularData(final String typeName, final String description, final Table table) {
    final OpenType<?>[] types = new OpenType<?>[table.getColumnNames().size()];
    for (int i = 0; i < types.length; i++) {
        types[i] = SimpleType.STRING;
    }
    try {
        final String[] keys = table.getColumnNames().toArray(new String[table.getColumnNames().size()]);
        final CompositeType ct = new CompositeType(typeName, description, keys, keys, types);
        final TabularType type = new TabularType(typeName, description, ct, keys);
        final TabularDataSupport data = new TabularDataSupport(type);
        for (final Collection<String> line : table.getLines()) {
            data.put(new CompositeDataSupport(ct, keys, line.toArray(new Object[line.size()])));
        }
        return data;
    } catch (final OpenDataException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : OpenType(javax.management.openmbean.OpenType) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 25 with OpenType

use of javax.management.openmbean.OpenType in project geode by apache.

the class OpenTypeConverter method makeTabularConverter.

private static OpenTypeConverter makeTabularConverter(Type objType, boolean sortedMap, Type keyType, Type valueType) throws OpenDataException {
    final String objTypeName = objType.toString();
    final OpenTypeConverter keyConverter = toConverter(keyType);
    final OpenTypeConverter valueConverter = toConverter(valueType);
    final OpenType keyOpenType = keyConverter.getOpenType();
    final OpenType valueOpenType = valueConverter.getOpenType();
    final CompositeType rowType = new CompositeType(objTypeName, objTypeName, keyValueArray, keyValueArray, new OpenType[] { keyOpenType, valueOpenType });
    final TabularType tabularType = new TabularType(objTypeName, objTypeName, rowType, keyArray);
    return new TableConverter(objType, sortedMap, tabularType, keyConverter, valueConverter);
}
Also used : OpenType(javax.management.openmbean.OpenType) TabularType(javax.management.openmbean.TabularType) CompositeType(javax.management.openmbean.CompositeType)

Aggregations

OpenType (javax.management.openmbean.OpenType)32 CompositeType (javax.management.openmbean.CompositeType)26 OpenDataException (javax.management.openmbean.OpenDataException)15 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)10 TabularType (javax.management.openmbean.TabularType)10 CompositeData (javax.management.openmbean.CompositeData)7 TabularDataSupport (javax.management.openmbean.TabularDataSupport)7 ObjectName (javax.management.ObjectName)6 ArrayType (javax.management.openmbean.ArrayType)6 GenericArrayType (java.lang.reflect.GenericArrayType)5 ParameterizedType (java.lang.reflect.ParameterizedType)5 MBeanServer (javax.management.MBeanServer)5 Method (java.lang.reflect.Method)4 Type (java.lang.reflect.Type)4 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)4 MBeanInfo (javax.management.MBeanInfo)4 Descriptor (javax.management.Descriptor)3 ImmutableDescriptor (javax.management.ImmutableDescriptor)3 JMException (javax.management.JMException)3 MBeanOperationInfo (javax.management.MBeanOperationInfo)3