javax.management.openmbean.TabularData Java Examples

The following examples show how to use javax.management.openmbean.TabularData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: TestSCMNodeManagerMXBean.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
private void verifyEquals(TabularData actualData, Map<String, Long>
    expectedData) {
  if (actualData == null || expectedData == null) {
    fail("Data should not be null.");
  }
  for (Object obj : actualData.values()) {
    assertTrue(obj instanceof CompositeData);
    CompositeData cds = (CompositeData) obj;
    assertEquals(2, cds.values().size());
    Iterator<?> it = cds.values().iterator();
    String key = it.next().toString();
    String value = it.next().toString();
    long num = Long.parseLong(value);
    assertTrue(expectedData.containsKey(key));
    assertEquals(expectedData.remove(key).longValue(), num);
  }
  assertTrue(expectedData.isEmpty());
}
 
Example #3
Source File: ConfigurationInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Map<String, String> createMap(Object o) {
    if (o instanceof TabularData) {
        TabularData td = (TabularData) o;
        Collection<?> values = td.values();
        Map<String, String> map = new HashMap<>(values.size());
        for (Object value : td.values()) {
            if (value instanceof CompositeData) {
                CompositeData cdRow = (CompositeData) value;
                Object k = cdRow.get("key");
                Object v = cdRow.get("value");
                if (k instanceof String && v instanceof String) {
                    map.put((String) k, (String) v);
                }
            }
        }
        return Collections.unmodifiableMap(map);
    }
    return Collections.emptyMap();
}
 
Example #4
Source File: MBeans.java    From boon with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: DefaultMXBeanMappingFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: XMBeanNotifications.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example #7
Source File: DefaultMXBeanMappingFactory.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #8
Source File: KarafContainerImpl.java    From brooklyn-library with Apache License 2.0 6 votes vote down vote up
@Override
@Effector(description="Updates the OSGi Service's properties, adding (and overriding) the given key-value pairs")
public void updateServiceProperties(
        @EffectorParam(name="serviceName", description="Name of the OSGi service") String serviceName, 
        Map<String,String> additionalVals) {
    TabularData table = (TabularData) jmxHelper.operation(OSGI_COMPENDIUM, "getProperties", serviceName);
    
    try {
        for (Map.Entry<String, String> entry: additionalVals.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            CompositeData data = new CompositeDataSupport(
                    JmxConstants.PROPERTY_TYPE,
                    MutableMap.of(JmxConstants.KEY, key, JmxConstants.TYPE, "String", JmxConstants.VALUE, value));
            table.remove(data.getAll(new String[] {JmxConstants.KEY}));
            table.put(data);
        }
    } catch (OpenDataException e) {
        throw Exceptions.propagate(e);
    }
    
    LOG.info("Updating monterey-service configuration with changes {}", additionalVals);
    if (LOG.isTraceEnabled()) LOG.trace("Updating monterey-service configuration with new configuration {}", table);
    
    jmxHelper.operation(OSGI_COMPENDIUM, "update", serviceName, table);
}
 
Example #9
Source File: XMBeanAttributes.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example #10
Source File: QuartzSchedulerMBeanImpl.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
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()]));
}
 
Example #11
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #12
Source File: DynamicMBeanWrapper.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #13
Source File: XMBeanNotifications.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example #14
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testByteArrayObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));

    ModelNode node = new ModelNode();
    node.get("one").set(new byte[] {1,2});
    node.get("two").set(new byte[] {3,4});

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
    Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));

    //Allow plain map as well? Yeah why not!
    Map<String, byte[]> map = new HashMap<String, byte[]>();
    map.put("one", new byte[] {1,2});
    map.put("two", new byte[] {3,4});
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
Example #15
Source File: ConfigurationInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static Map<String, String> createMap(Object o) {
    if (o instanceof TabularData) {
        TabularData td = (TabularData) o;
        Collection<?> values = td.values();
        Map<String, String> map = new HashMap<>(values.size());
        for (Object value : td.values()) {
            if (value instanceof CompositeData) {
                CompositeData cdRow = (CompositeData) value;
                Object k = cdRow.get("key");
                Object v = cdRow.get("value");
                if (k instanceof String && v instanceof String) {
                    map.put((String) k, (String) v);
                }
            }
        }
        return Collections.unmodifiableMap(map);
    }
    return Collections.emptyMap();
}
 
Example #16
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    description.get(EXPRESSIONS_ALLOWED).set(true);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
    node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));
}
 
Example #17
Source File: DefaultMXBeanMappingFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #18
Source File: JobSchedulerJmxManagementTests.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetExecutionCount() throws Exception {
   final JobSchedulerViewMBean view = getJobSchedulerMBean();
   assertNotNull(view);
   assertTrue(view.getAllJobs().isEmpty());
   scheduleMessage(10000, 1000, 10);
   assertFalse(view.getAllJobs().isEmpty());
   TabularData jobs = view.getAllJobs();
   assertEquals(1, jobs.size());
   String jobId = null;
   for (Object key : jobs.keySet()) {
      jobId = ((List<?>) key).get(0).toString();
   }

   final String fixedJobId = jobId;
   LOG.info("Attempting to get execution count for Job: {}", jobId);
   assertEquals(0, view.getExecutionCount(jobId));

   assertTrue("Should execute again", Wait.waitFor(new Wait.Condition() {

      @Override
      public boolean isSatisified() throws Exception {
         return view.getExecutionCount(fixedJobId) > 0;
      }
   }));
}
 
Example #19
Source File: XMBeanNotifications.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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();
}
 
Example #20
Source File: ExpressionTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testByteArrayObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));

    ModelNode node = new ModelNode();
    node.get("one").set(new byte[] {1,2});
    node.get("two").set(new byte[] {3,4});

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
    Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));

    //Allow plain map as well? Yeah why not!
    Map<String, byte[]> map = new HashMap<String, byte[]>();
    map.put("one", new byte[] {1,2});
    map.put("two", new byte[] {3,4});
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
Example #21
Source File: Client.java    From vjtools with Apache License 2.0 6 votes vote down vote up
protected static StringBuffer recurseCompositeData(StringBuffer buffer, String indent, String name,
		CompositeData data) {
	indent = addNameToBuffer(buffer, indent, name);
	for (Iterator i = data.getCompositeType().keySet().iterator(); i.hasNext();) {
		String key = (String) i.next();
		Object o = data.get(key);
		if (o instanceof CompositeData) {
			recurseCompositeData(buffer, indent + " ", key, (CompositeData) o);
		} else if (o instanceof TabularData) {
			recurseTabularData(buffer, indent, key, (TabularData) o);
		} else {
			buffer.append(indent);
			buffer.append(key);
			buffer.append(": ");
			buffer.append(o);
			buffer.append("\n");
		}
	}
	return buffer;
}
 
Example #22
Source File: Client.java    From vjtools with Apache License 2.0 6 votes vote down vote up
protected static StringBuffer recurseCompositeData(StringBuffer buffer, String indent, String name,
		CompositeData data) {
	indent = addNameToBuffer(buffer, indent, name);
	for (Iterator i = data.getCompositeType().keySet().iterator(); i.hasNext();) {
		String key = (String) i.next();
		Object o = data.get(key);
		if (o instanceof CompositeData) {
			recurseCompositeData(buffer, indent + " ", key, (CompositeData) o);
		} else if (o instanceof TabularData) {
			recurseTabularData(buffer, indent, key, (TabularData) o);
		} else {
			buffer.append(indent);
			buffer.append(key);
			buffer.append(": ");
			buffer.append(o);
			buffer.append("\n");
		}
	}
	return buffer;
}
 
Example #23
Source File: Client.java    From vjtools with Apache License 2.0 6 votes vote down vote up
protected static StringBuffer recurseTabularData(StringBuffer buffer, String indent, String name,
		TabularData data) {
	addNameToBuffer(buffer, indent, name);
	java.util.Collection c = data.values();
	for (Iterator i = c.iterator(); i.hasNext();) {
		Object obj = i.next();
		if (obj instanceof CompositeData) {
			recurseCompositeData(buffer, indent + " ", "", (CompositeData) obj);
		} else if (obj instanceof TabularData) {
			recurseTabularData(buffer, indent, "", (TabularData) obj);
		} else {
			buffer.append(obj);
		}
	}
	return buffer;
}
 
Example #24
Source File: TriggerSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: ReloadableEntityManagerFactory.java    From tomee with Apache License 2.0 5 votes vote down vote up
private TabularData buildTabularData(final String typeName, final String typeDescription, final List<?> list, final Info info) {
    final String[] names = new String[list.size()];
    final Object[] values = new Object[names.length];
    int i = 0;
    for (final Object o : list) {
        names[i] = o.toString();
        values[i++] = info.info(reloadableEntityManagerFactory.classLoader, o);
    }
    return tabularData(typeName, typeDescription, names, values);
}
 
Example #26
Source File: LiveJvmServiceImpl.java    From glowroot with Apache License 2.0 5 votes vote down vote up
private static MBeanDump.MBeanValue getTabularDataValue(TabularData tabularData) {
    // linked hash map used to preserve row ordering
    List<MBeanDump.MBeanValueMapEntry> outerEntries = Lists.newArrayList();
    Set<String> attributeNames = tabularData.getTabularType().getRowType().keySet();
    for (Object key : tabularData.keySet()) {
        // TabularData.keySet() returns "Set<List<?>> but is declared Set<?> for
        // compatibility reasons" (see javadocs) so safe to cast to List<?>
        List<?> keyList = (List<?>) key;
        @SuppressWarnings("argument.type.incompatible")
        String keyString = Joiner.on(", ").join(keyList);
        @SuppressWarnings("argument.type.incompatible")
        CompositeData compositeData = tabularData.get(keyList.toArray());
        // linked hash map used to preserve attribute ordering
        List<MBeanDump.MBeanValueMapEntry> innerEntries = Lists.newArrayList();
        for (String attributeName : attributeNames) {
            innerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
                    .setKey(attributeName)
                    .setValue(getMBeanAttributeValue(compositeData.get(attributeName)))
                    .build());
        }
        outerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
                .setKey(keyString)
                .setValue(MBeanDump.MBeanValue.newBuilder()
                        .setMap(MBeanDump.MBeanValueMap.newBuilder()
                                .addAllEntry(innerEntries))
                        .build())
                .build());
    }
    return MBeanDump.MBeanValue.newBuilder()
            .setMap(MBeanDump.MBeanValueMap.newBuilder()
                    .addAllEntry(outerEntries))
            .build();
}
 
Example #27
Source File: GcInfoCompositeData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static Map<String, MemoryUsage>
        getMemoryUsageBeforeGc(CompositeData cd) {
    try {
        TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
        return cast(memoryUsageMapType.toJavaTypeData(td));
    } catch (InvalidObjectException | OpenDataException e) {
        // Should never reach here
        throw new AssertionError(e);
    }
}
 
Example #28
Source File: DeltaSpikeConfigInfo.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Override
public TabularData getConfigSources()
{
    ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
    try
    {
        Thread.currentThread().setContextClassLoader(appConfigClassLoader);

        String typeName = "ConfigSources";
        OpenType<?>[] types = new OpenType<?>[]{SimpleType.INTEGER, SimpleType.STRING};
        String[] keys = new String[]{"Ordinal", "ConfigSource"};

        CompositeType ct = new CompositeType(typeName, typeName, keys, keys, types);
        TabularType type = new TabularType(typeName, typeName, ct, keys);
        TabularDataSupport configSourceInfo = new TabularDataSupport(type);

        ConfigSource[] configSources = ConfigResolver.getConfigSources();
        for (ConfigSource configSource : configSources)
        {
            configSourceInfo.put(
                new CompositeDataSupport(ct, keys,
                        new Object[]{configSource.getOrdinal(), configSource.getConfigName()}));
        }

        return configSourceInfo;
    }
    catch (OpenDataException e)
    {
        throw new RuntimeException(e);
    }
    finally
    {
        // set back the original TCCL
        Thread.currentThread().setContextClassLoader(originalCl);
    }
}
 
Example #29
Source File: ValidateOpenTypes.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
Example #30
Source File: ValidateOpenTypes.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}