@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; }
@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; }
public TabularData getDataSourceList() throws JMException { CompositeType rowType = getDruidDataSourceCompositeType(); String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]); TabularType tabularType = new TabularType("DruidDataSourceStat", "DruidDataSourceStat", rowType, indexNames); TabularData data = new TabularDataSupport(tabularType); final Set<Object> dataSources = getInstances().keySet(); for (Object dataSource : dataSources) { data.put(getCompositeData(dataSource)); } return data; }
@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; }
public TabularData getConnectionList() throws JMException { CompositeType rowType = JdbcConnectionStat.Entry.getCompositeType(); String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]); TabularType tabularType = new TabularType("ConnectionList", "ConnectionList", rowType, indexNames); TabularData data = new TabularDataSupport(tabularType); final ConcurrentMap<String, DataSourceProxyImpl> dataSources = DruidDriver.getProxyDataSources(); for (DataSourceProxyImpl dataSource : dataSources.values()) { JdbcDataSourceStat dataSourceStat = dataSource.getDataSourceStat(); ConcurrentMap<Long, JdbcConnectionStat.Entry> connections = dataSourceStat.getConnections(); for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : connections.entrySet()) { data.put(entry.getValue().getCompositeData()); } } for (DruidDataSource instance : DruidDataSourceStatManager.getDruidDataSourceInstances()) { JdbcDataSourceStat dataSourceStat = instance.getDataSourceStat(); ConcurrentMap<Long, JdbcConnectionStat.Entry> connections = dataSourceStat.getConnections(); for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : connections.entrySet()) { data.put(entry.getValue().getCompositeData()); } } return data; }
public TabularData getMissingPersistentMembersJMX() throws AdminException { try { Set<PersistentID> members = super.getMissingPersistentMembers(); TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE); int index = 0; for (PersistentID id : members) { CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()}); results.put(idData); index++; } return results; } catch (OpenDataException e) { logger.warn("Exception occurred while getting missing persistent members.", e); throw new AdminException(e); } }
@Override Object toNonNullOpenValue(Object value) throws OpenDataException { final Map<Object, Object> valueMap = (Map<Object, Object>) value; if (valueMap instanceof SortedMap) { Comparator comparator = ((SortedMap) valueMap).comparator(); if (comparator != null) { final String msg = "Cannot convert SortedMap with non-null comparator: " + comparator; IllegalArgumentException iae = new IllegalArgumentException(msg); OpenDataException ode = new OpenDataException(msg); ode.initCause(iae); throw ode; } } final TabularType tabularType = (TabularType) getOpenType(); final TabularData table = new TabularDataSupport(tabularType); final CompositeType rowType = tabularType.getRowType(); for (Map.Entry entry : valueMap.entrySet()) { final Object openKey = keyConverter.toOpenValue(entry.getKey()); final Object openValue = valueConverter.toOpenValue(entry.getValue()); final CompositeData row; row = new CompositeDataSupport(rowType, keyValueArray, new Object[] {openKey, openValue}); table.put(row); } return table; }
@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; }
@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; }
public TabularData getDataSourceList() throws JMException { CompositeType rowType = getDruidDataSourceCompositeType(); String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]); TabularType tabularType = new TabularType("DruidDataSourceStat", "DruidDataSourceStat", rowType, indexNames); TabularData data = new TabularDataSupport(tabularType); final Set<Object> dataSources = getInstances().keySet(); for (Object dataSource : dataSources) { data.put(getCompositeData(dataSource)); } return data; }
@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; }
public TabularData getConnectionList() throws JMException { CompositeType rowType = JdbcConnectionStat.Entry.getCompositeType(); String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]); TabularType tabularType = new TabularType("ConnectionList", "ConnectionList", rowType, indexNames); TabularData data = new TabularDataSupport(tabularType); final ConcurrentMap<String, DataSourceProxyImpl> dataSources = DruidDriver.getProxyDataSources(); for (DataSourceProxyImpl dataSource : dataSources.values()) { JdbcDataSourceStat dataSourceStat = dataSource.getDataSourceStat(); ConcurrentMap<Long, JdbcConnectionStat.Entry> connections = dataSourceStat.getConnections(); for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : connections.entrySet()) { data.put(entry.getValue().getCompositeData()); } } for (DruidDataSource instance : DruidDataSourceStatManager.getDruidDataSourceInstances()) { JdbcDataSourceStat dataSourceStat = instance.getDataSourceStat(); ConcurrentMap<Long, JdbcConnectionStat.Entry> connections = dataSourceStat.getConnections(); for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : connections.entrySet()) { data.put(entry.getValue().getCompositeData()); } } return data; }
private TabularData createTabularDataFromLevelsMap(Map<String, String> levels) { TabularData loggerLevelList = new TabularDataSupport(LOGGER_LEVEL_TABULAR_TYPE); for (Map.Entry<String,String> entry : levels.entrySet()) { String loggerName = entry.getKey(); String level = entry.getValue(); CompositeData loggerData = createRow(loggerName, level); loggerLevelList.put(loggerData); } return loggerLevelList; }
private static TabularData deserialize(final TabularType type, final JsonNode rows, final ObjectCodec codec) throws IOException { final TabularData result = new TabularDataSupport(type); for(final JsonNode row: rows) result.put(deserialize(type.getRowType(), row, codec)); return result; }
public TabularData getMissingPersistentMembersJMX() throws AdminException { try { Set<PersistentID> members = super.getMissingPersistentMembers(); TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE); int index = 0; for(PersistentID id : members) { CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()}); results.put(idData); index++; } return results; } catch( OpenDataException e) { logger.warn("Exception occurred while getting missing persistent members.", e); throw new AdminException(e); } }
public TabularData getMissingPersistentMembersJMX() throws AdminException { try { Set<PersistentID> members = super.getMissingPersistentMembers(); TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE); for(PersistentID id : members) { CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()}); results.put(idData); } return results; } catch( OpenDataException e) { logger.warning(LocalizedStrings.ONE_ARG, "Exception occurred while getting missing persistent members.", e); throw new AdminException(e); } }
public TabularData fromArray(String tableTypeName, String rowTypeName, Object[] objects) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory(rowTypeName, rowTypeName); rowTypeFactory.defineItem(rowTypeName, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType(tableTypeName, tableTypeName, rowType, new String[] { rowTypeName }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object object : objects) { rowDataFactory.clear(); rowDataFactory.setValue(rowTypeName, object.toString()); table.put(rowDataFactory.createCompositeData()); } return table; }
public TabularData fromArray(String tableTypeName, String rowTypeName, Object[] objects) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory(rowTypeName, rowTypeName); rowTypeFactory.defineItem(rowTypeName, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType(tableTypeName, tableTypeName, rowType, new String[] { rowTypeName }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object object : objects) { rowDataFactory.clear(); rowDataFactory.setValue(rowTypeName, object.toString()); table.put(rowDataFactory.createCompositeData()); } return table; }