public static CompositeType getThrowableCompositeType() throws JMException { if (THROWABLE_COMPOSITE_TYPE == null) { THROWABLE_COMPOSITE_TYPE = new CompositeType("Throwable", "Throwable", THROWABLE_COMPOSITE_INDEX_NAMES, THROWABLE_COMPOSITE_INDEX_DESCRIPTIONS, THROWABLE_COMPOSITE_INDEX_TYPES); } return THROWABLE_COMPOSITE_TYPE; }
private CompositeData buildWanInfoType(String key, Boolean state) throws OpenDataException { Object[] itemValues = {key, state}; CompositeData result = new CompositeDataSupport(wanInfoType, itemNames, itemValues); return result; }
public ServerObject(String name) { this.name = name; this.wanInfo = new TabularDataSupport(wanType); }
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; }
private Map<String, Object> toNeo4jValue( CompositeData composite ) { HashMap<String,Object> properties = new HashMap<>(); for ( String key : composite.getCompositeType().keySet() ) { properties.put( key, toNeo4jValue(composite.get( key )) ); } return map( "description", composite.getCompositeType().getDescription(), "properties", properties ); }
public void writeCompositeData(CompositeData compositeData) { if (compositeData == null) { writeNull(); return; } int entryIndex = 0; write('{'); for (Object key : compositeData.getCompositeType().keySet()) { if (entryIndex != 0) { write(','); } writeString((String) key); write(':'); Object value = compositeData.get((String) key); writeObject(value); entryIndex++; } write('}'); }
private String[] formatRow(CompositeData row, List<String> header) { String[] text = new String[header.size()]; for(int i = 0; i != text.length; ++i) { String attr = header.get(i); text[i] = formatLine(row.get(attr), row.getCompositeType().getType(attr).getClassName()); } return text; }
public static void appendTabularMap(Map map, CompositeData cdata, String fieldName) { Object tabularObject = cdata.get(fieldName); if (tabularObject instanceof TabularData) { TabularData tabularData = (TabularData) tabularObject; Collection<CompositeData> values = (Collection<CompositeData>) tabularData.values(); for (CompositeData compositeData : values) { Object key = compositeData.get("key"); Object value = compositeData.get("value"); map.put(key, value); } } }
protected <T> TabularType createTabularType(Class<T> type, OpenType openType) throws OpenDataException { String typeName = "java.util.Map<java.lang.String, " + type.getName() + ">"; String[] keyValue = new String[]{"key", "value"}; OpenType[] openTypes = new OpenType[]{SimpleType.STRING, openType}; CompositeType rowType = new CompositeType(typeName, typeName, keyValue, keyValue, openTypes); return new TabularType(typeName, typeName, rowType, new String[]{"key"}); }
public static TabularData toTabularData(List<? extends Trigger> triggers) { TabularData tData = new TabularDataSupport(TABULAR_TYPE); if (triggers != null) { ArrayList<CompositeData> list = new ArrayList<CompositeData>(); for (Trigger trigger : triggers) { list.add(toCompositeData(trigger)); } tData.putAll(list.toArray(new CompositeData[list.size()])); } return tData; }
@Mapping( "type" ) public ValueRepresentation getType() { return ValueRepresentation.string( data.getCompositeType() .getTypeName() ); }
@Mapping( "description" ) public ValueRepresentation getDescription() { return ValueRepresentation.string( data.getCompositeType() .getDescription() ); }
public void writeTabularData(TabularData tabularData) { if (tabularData == null) { writeNull(); return; } int entryIndex = 0; write('['); for (Object item : tabularData.values()) { if (entryIndex != 0) { write(','); } CompositeData row = (CompositeData) item; writeCompositeData(row); entryIndex++; } write(']'); }
@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 CompositeDataSupport getCompositeData() throws JMException { return new CompositeDataSupport(getCompositeType(), getData()); }
public static TabularData toTabularData(JobDetail[] jobDetails) { TabularData tData = new TabularDataSupport(TABULAR_TYPE); if (jobDetails != null) { ArrayList<CompositeData> list = new ArrayList<CompositeData>(); for (JobDetail jobDetail : jobDetails) { list.add(toCompositeData(jobDetail)); } tData.putAll(list.toArray(new CompositeData[list.size()])); } return tData; }
public static CompositeType getCompositeType() throws JMException { OpenType<?>[] indexTypes = new OpenType<?>[] { SimpleType.LONG, SimpleType.DATE, SimpleType.LONG, SimpleType.DATE, SimpleType.LONG, SimpleType.STRING, JMXUtils.getThrowableCompositeType(), SimpleType.DATE, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING }; return new CompositeType("ConnectionStatistic", "Connection Statistic", indexNames, indexDescriptions, indexTypes); }
@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 CompositeDataSupport getCompositeData(Object dataSource) throws JMException { CompositeType rowType = getDruidDataSourceCompositeType(); Map<String, Object> map = DruidDataSourceUtils.getStatDataForMBean(dataSource); return new CompositeDataSupport(rowType, map); }
@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; }