use of javax.management.openmbean.TabularType in project druid by alibaba.
the class JdbcDataSourceStat method getConnectionList.
@Override
public TabularData getConnectionList() throws JMException {
CompositeType rowType = JdbcConnectionStat.Entry.getCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("ConnectionListStatistic", "ConnectionListStatistic", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : getConnections().entrySet()) {
data.put(entry.getValue().getCompositeData());
}
return data;
}
use of javax.management.openmbean.TabularType in project druid by alibaba.
the class JdbcDataSourceStat method getSqlList.
@Override
public TabularData getSqlList() throws JMException {
Map<String, JdbcSqlStat> sqlStatMap = this.getSqlStatMap();
CompositeType rowType = JdbcSqlStat.getCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("SqlListStatistic", "SqlListStatistic", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
for (Map.Entry<String, JdbcSqlStat> entry : sqlStatMap.entrySet()) {
data.put(entry.getValue().getCompositeData());
}
return data;
}
use of javax.management.openmbean.TabularType in project druid by alibaba.
the class JdbcStatManager method getDataSourceList.
@Override
public TabularData getDataSourceList() throws JMException {
CompositeType rowType = getDataSourceCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("DataSourceStat", "DataSourceStat", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
{
final ConcurrentMap<String, DataSourceProxyImpl> dataSources = DruidDriver.getProxyDataSources();
for (DataSourceProxyImpl dataSource : dataSources.values()) {
data.put(dataSource.getCompositeData());
}
}
final Set<DruidDataSource> dataSources = DruidDataSourceStatManager.getDruidDataSourceInstances();
for (DruidDataSource dataSource : dataSources) {
data.put(dataSource.getCompositeData());
}
return data;
}
use of javax.management.openmbean.TabularType 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.TabularType 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