Java 类javax.management.openmbean.TabularData 实例源码

项目:quartz-web    文件:JSONWriter.java   
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(']');
}
项目:lams    文件:JobDetailSupport.java   
/**
 * @param cData
 * @return JobDetail
 */
public static JobDetail newJobDetail(CompositeData cData)
  throws ClassNotFoundException
{
    JobDetailImpl jobDetail = new JobDetailImpl();

    int i = 0;
    jobDetail.setName((String) cData.get(ITEM_NAMES[i++]));
    jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++]));
    jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++]));
    Class<?> jobClass = Class.forName((String) cData.get(ITEM_NAMES[i++]));
    @SuppressWarnings("unchecked")
    Class<? extends Job> jobClassTyped = (Class<? extends Job>)jobClass;
    jobDetail.setJobClass(jobClassTyped);
    jobDetail.setJobDataMap(JobDataMapSupport.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
    jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
    jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));

    return jobDetail;
}
项目:asura    文件:QuartzSchedulerMBeanImpl.java   
public TabularData getAllTriggers(String instanceId)
        throws SchedulerException {
    SchedulingContext cntx = new SchedulingContext(instanceId);
    List<Trigger> triggerList = new ArrayList<Trigger>();

    for (String triggerGroupName : scheduler.getTriggerGroupNames(cntx)) {
        for (String triggerName : scheduler.getTriggerNames(cntx,
                triggerGroupName)) {
            triggerList.add(scheduler.getTrigger(cntx, triggerName,
                    triggerGroupName));
        }
    }

    return TriggerSupport.toTabularData(triggerList
            .toArray(new Trigger[triggerList.size()]));
}
项目:asura    文件:JobDetailSupport.java   
/**
 * @param cData
 * @return JobDetail
 */
public static JobDetail newJobDetail(CompositeData cData) {
    JobDetail jobDetail = new JobDetail();

    int i = 0;
    jobDetail.setName((String) cData.get(ITEM_NAMES[i++]));
    jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++]));
    jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++]));
    try {
        Class c = Class.forName((String) cData.get(ITEM_NAMES[i++]));
        jobDetail.setJobClass(c);
    } catch (ClassNotFoundException cnfe) {
        /**/
    }
    jobDetail.setJobDataMap(JobDataMapSupport
            .newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
    jobDetail.setVolatility((Boolean) cData.get(ITEM_NAMES[i++]));
    jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
    jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));

    return jobDetail;
}
项目:OpenJSharp    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:OpenJSharp    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:OpenJSharp    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:jdk8u-jdk    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:jdk8u-jdk    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:jdk8u-jdk    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:openjdk-jdk10    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:openjdk-jdk10    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:openjdk-jdk10    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:openjdk9    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:openjdk9    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:openjdk9    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:djigger    文件:MBeanCollector.java   
private void recursive(GenericObject object, String key, Object value) {
    if (value instanceof CompositeData) {
        CompositeData composite = (CompositeData) value;
        object.put(key, toGenericObject(composite));
    } else if (value instanceof TabularData) {
        TabularData tabularData = (TabularData) value;
        @SuppressWarnings("unchecked")
        Collection<CompositeData> values = (Collection<CompositeData>) tabularData.values();
        GenericArray array = new GenericArray();
        for (CompositeData data : values) {
            array.add(toGenericObject(data));
        }
        object.put(key, array);
    } else if (value instanceof Number || value instanceof Boolean || value instanceof String){
        object.put(key, value);
    } else {
        // todo log
    }
}
项目:jdk8u_jdk    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:jdk8u_jdk    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:jdk8u_jdk    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:lookaside_java-1.8.0-openjdk    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:lookaside_java-1.8.0-openjdk    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:lookaside_java-1.8.0-openjdk    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}
项目:cuba    文件:AttributeHelper.java   
public static String convertToString(Object value) {
    if (value == null) {
        return null;
    }

    if (value.getClass().isArray()) {
        StringBuilder b = new StringBuilder("[");
        int length = Array.getLength(value);
        for (int i = 0; i < length; i++) {
            Object o = Array.get(value, i);
            b.append(convertToString(o));
            if (i < length - 1) {
                b.append(", ");
            }
        }
        return b.append("]").toString();
    }
    else if (value instanceof CompositeData) {
        return compositeToString((CompositeData) value);
    }
    else if (value instanceof TabularData) {
        return tabularToString((TabularData) value);
    }
    return value.toString();
}
项目:Camel    文件:ManagedInflightRepository.java   
@Override
public TabularData browse(String routeId, int limit, boolean sortByLongestDuration) {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listInflightExchangesTabularType());
        Collection<InflightRepository.InflightExchange> exchanges = inflightRepository.browse(routeId, limit, sortByLongestDuration);

        for (InflightRepository.InflightExchange entry : exchanges) {
            CompositeType ct = CamelOpenMBeanTypes.listInflightExchangesCompositeType();
            String exchangeId = entry.getExchange().getExchangeId();
            String fromRouteId = entry.getFromRouteId();
            String atRouteId = entry.getAtRouteId();
            String nodeId = entry.getNodeId();
            String elapsed = "" + entry.getElapsed();
            String duration = "" + entry.getDuration();

            CompositeData data = new CompositeDataSupport(ct,
                    new String[]{"exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration"},
                    new Object[]{exchangeId, fromRouteId, atRouteId, nodeId, elapsed, duration});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedSendProcessor.java   
@Override
public TabularData extendedInformation() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());

        // we only have 1 endpoint

        CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
        String url = getDestination();
        Long hits = processor.getCounter();

        CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "hits"}, new Object[]{url, hits});
        answer.put(data);
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedEndpointRegistry.java   
@SuppressWarnings("unchecked")
public TabularData listEndpoints() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEndpointsTabularType());
        Collection<Endpoint> endpoints = endpointRegistry.values();
        for (Endpoint endpoint : endpoints) {
            CompositeType ct = CamelOpenMBeanTypes.listEndpointsCompositeType();
            String url = endpoint.getEndpointUri();
            if (sanitize) {
                url = URISupport.sanitizeUri(url);
            }

            boolean fromStatic = endpointRegistry.isStatic(url);
            boolean fromDynamic = endpointRegistry.isDynamic(url);

            CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "static", "dynamic"}, new Object[]{url, fromStatic, fromDynamic});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedAsyncProcessorAwaitManager.java   
@Override
public TabularData browse() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listAwaitThreadsTabularType());
        Collection<AsyncProcessorAwaitManager.AwaitThread> threads = manager.browse();
        for (AsyncProcessorAwaitManager.AwaitThread entry : threads) {
            CompositeType ct = CamelOpenMBeanTypes.listAwaitThreadsCompositeType();
            String id = "" + entry.getBlockedThread().getId();
            String name = entry.getBlockedThread().getName();
            String exchangeId = entry.getExchange().getExchangeId();
            String routeId = entry.getRouteId();
            String nodeId = entry.getNodeId();
            String duration = "" + entry.getWaitDuration();

            CompositeData data = new CompositeDataSupport(ct,
                    new String[]{"id", "name", "exchangeId", "routeId", "nodeId", "duration"},
                    new Object[]{id, name, exchangeId, routeId, nodeId, duration});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedTypeConverterRegistry.java   
public TabularData listTypeConverters() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTypeConvertersTabularType());
        List<Class<?>[]> converters = registry.listAllTypeConvertersFromTo();
        for (Class<?>[] entry : converters) {
            CompositeType ct = CamelOpenMBeanTypes.listTypeConvertersCompositeType();
            String from = entry[0].getCanonicalName();
            String to = entry[1].getCanonicalName();
            CompositeData data = new CompositeDataSupport(ct, new String[]{"from", "to"}, new Object[]{from, to});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedCamelContext.java   
public TabularData listEips() throws Exception {
    try {
        // find all EIPs
        Map<String, Properties> eips = context.findEips();

        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEipsTabularType());

        // gather EIP detail for each eip
        for (Map.Entry<String, Properties> entry : eips.entrySet()) {
            String name = entry.getKey();
            String title = (String) entry.getValue().get("title");
            String description = (String) entry.getValue().get("description");
            String label = (String) entry.getValue().get("label");
            String type = (String) entry.getValue().get("class");
            String status = CamelContextHelper.isEipInUse(context, name) ? "in use" : "on classpath";
            CompositeType ct = CamelOpenMBeanTypes.listEipsCompositeType();
            CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "title", "description", "label", "status", "type"},
                    new Object[]{name, title, description, label, status, type});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:SpringManagedCamelContextTest.java   
@Test
public void testListEips() throws Exception {
    // JMX tests dont work well on AIX CI servers (hangs them)
    if (isPlatform("aix")) {
        return;
    }

    MBeanServer mbeanServer = getMBeanServer();

    ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\"");

    assertTrue("Should be registered", mbeanServer.isRegistered(on));

    @SuppressWarnings("unchecked")
    TabularData data = (TabularData) mbeanServer.invoke(on, "listEips", null, null);
    assertNotNull(data);
    assertTrue(data.size() > 150);
}
项目:scylla-jmx    文件:FailureDetector.java   
@Override
public TabularData getPhiValues() throws OpenDataException {
    final CompositeType ct = new CompositeType("Node", "Node", new String[] { "Endpoint", "PHI" },
            new String[] { "IP of the endpoint", "PHI value" },
            new OpenType[] { SimpleType.STRING, SimpleType.DOUBLE });
    final TabularDataSupport results = new TabularDataSupport(
            new TabularType("PhiList", "PhiList", ct, new String[] { "Endpoint" }));
    final JsonArray arr = client.getJsonArray("/failure_detector/endpoint_phi_values");

    for (JsonValue v : arr) {
        JsonObject o = (JsonObject) v;
        String endpoint = o.getString("endpoint");
        double phi = Double.parseDouble(o.getString("phi"));

        if (phi != Double.MIN_VALUE) {
            // returned values are scaled by PHI_FACTOR so that the are on
            // the same scale as PhiConvictThreshold
            final CompositeData data = new CompositeDataSupport(ct, new String[] { "Endpoint", "PHI" },
                    new Object[] { endpoint, phi * PHI_FACTOR });
            results.put(data);
        }
    }

    return results;
}
项目:scylla-jmx    文件:APIClient.java   
public Map<String, TabularData> getMapStringSnapshotTabularDataValue(String string,
        MultivaluedMap<String, String> queryParams) {
    if (string.equals("")) {
        return null;
    }
    JsonReader reader = getReader(string, queryParams);
    JsonArray arr = reader.readArray();
    Map<String, TabularData> map = new HashMap<>();

    for (int i = 0; i < arr.size(); i++) {
        JsonObject obj = arr.getJsonObject(i);
        if (obj.containsKey("key") && obj.containsKey("value")) {
            String key = obj.getString("key");
            map.put(key, getSnapshotData(key, obj.getJsonArray("value")));
        }
    }
    reader.close();
    return map;
}
项目:cassandra-kmean    文件:NodeTool.java   
@Override
public void execute(NodeProbe probe)
{
    System.out.println("Compaction History: ");

    TabularData tabularData = probe.getCompactionHistory();
    if (tabularData.isEmpty())
    {
        System.out.printf("There is no compaction history");
        return;
    }

    String format = "%-41s%-19s%-29s%-26s%-15s%-15s%s%n";
    List<String> indexNames = tabularData.getTabularType().getIndexNames();
    System.out.printf(format, toArray(indexNames, Object.class));

    Set<?> values = tabularData.keySet();
    for (Object eachValue : values)
    {
        List<?> value = (List<?>) eachValue;
        System.out.printf(format, toArray(value, Object.class));
    }
}
项目:parfait    文件:JmxInProgressMonitor.java   
@Override
public TabularData apply(InProgressSnapshot from) {
    List<OpenType<?>> types = Lists.transform(from.getColumnClasses(), CLASS_TO_OPENTYPE);

    CompositeType rowType;
    try {
        int columnCount = from.getColumnCount();
        rowType = new CompositeType("Snapshot row", "Snapshot row", from.getColumnNames()
                .toArray(new String[columnCount]), from.getColumnDescriptions().toArray(
                new String[columnCount]), types.toArray(new OpenType<?>[columnCount]));
        TabularType type = new TabularType("Snapshot", "Snapshot", rowType,
                new String[] { "Thread name" });
        TabularData data = new TabularDataSupport(type);

        for (Map<String, Object> dataRow : from.getValues()) {
            CompositeData row = new CompositeDataSupport(rowType, dataRow);
            data.put(row);
        }
        return data;
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
项目:boon    文件:MBeans.java   
private static Object convertFromTabularDataToMap( Object value ) {
    final TabularData data = ( TabularData ) value;

    final Set<List<?>> keys = ( Set<List<?>> ) data.keySet();

    final Map<String, Object> map = new HashMap<>();
    for ( final List<?> key : keys ) {
        final Object subValue = convertValue( data.get( key.toArray() ) );

        if ( key.size() == 1 ) {
            map.put( convertValue( key.get( 0 ) ).toString(), subValue );
        } else {
            map.put( convertValue( key ).toString(), subValue );
        }
    }

    value = map;
    return value;
}
项目:tnt4j-stream-jmx    文件:DefaultSampleListener.java   
/**
 * Process/extract value from a given MBean attribute
 *
 * @param snapshot instance where extracted attribute is stored
 * @param mbAttrInfo MBean attribute info
 * @param propName name to be assigned to given attribute value
 * @param value associated with attribute
 * @return snapshot instance where all attributes are contained
 */
protected PropertySnapshot processAttrValue(PropertySnapshot snapshot, MBeanAttributeInfo mbAttrInfo,
        PropertyNameBuilder propName, Object value) {
    if (value instanceof CompositeData) {
        CompositeData cdata = (CompositeData) value;
        Set<String> keys = cdata.getCompositeType().keySet();
        for (String key : keys) {
            Object cVal = cdata.get(key);
            processAttrValue(snapshot, mbAttrInfo, propName.append(key), cVal);
            propName.popLevel();
        }
    } else if (value instanceof TabularData) {
        TabularData tData = (TabularData) value;
        Collection<?> values = tData.values();
        int row = 0;
        for (Object tVal : values) {
            processAttrValue(snapshot, mbAttrInfo, propName.append(padNumber(++row)), tVal);
            propName.popLevel();
        }
    } else {
        snapshot.add(propName.propString(), value);
    }
    return snapshot;
}
项目:infobip-open-jdk-8    文件:XMBeanNotifications.java   
@Override
public String toString() {
    if (userData == null) {
        return null;
    }
    if (userData.getClass().isArray()) {
        String name =
                Utils.getArrayClassName(userData.getClass().getName());
        int length = Array.getLength(userData);
        return name + "[" + length + "]";
    }

    if (userData instanceof CompositeData ||
            userData instanceof TabularData) {
        return userData.getClass().getName();
    }

    return userData.toString();
}
项目:infobip-open-jdk-8    文件:XMBeanAttributes.java   
@Override
public String toString() {

    if(value == null) return null;

    if(value.getClass().isArray()) {
        String name =
            Utils.getArrayClassName(value.getClass().getName());
        int length = Array.getLength(value);
        return name + "[" + length +"]";
    }

    if(value instanceof CompositeData ||
       value instanceof TabularData)
        return value.getClass().getName();

    return value.toString();
}
项目:infobip-open-jdk-8    文件:DefaultMXBeanMappingFactory.java   
@Override
final Object fromNonNullOpenValue(Object openValue)
        throws InvalidObjectException {
    final TabularData table = (TabularData) openValue;
    final Collection<CompositeData> rows = cast(table.values());
    final Map<Object, Object> valueMap =
        sortedMap ? newSortedMap() : newInsertionOrderMap();
    for (CompositeData row : rows) {
        final Object key =
            keyMapping.fromOpenValue(row.get("key"));
        final Object value =
            valueMapping.fromOpenValue(row.get("value"));
        if (valueMap.put(key, value) != null) {
            final String msg =
                "Duplicate entry in TabularData: key=" + key;
            throw new InvalidObjectException(msg);
        }
    }
    return valueMap;
}