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;
}
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);
}
}
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);
}
}
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);
}
}
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);
}
Aggregations