Package org.jmxdatamart.Extractor

Examples of org.jmxdatamart.Extractor.Attribute


        ObjectName mS = new ObjectName("java.lang:name=CarBean");
        CarBean cb = new CarBean();
        mbs.registerMBean(cb, mS);
       
        MultiLayeredAttribute mla = new MultiLayeredAttribute(mbs);
        Attribute attr = new Attribute("Car.*", null, null);
        Map<Attribute, Object> result = mla.getAll(mS, attr);
       
        assertTrue ( result.size() == 4);
       
        for (Map.Entry<Attribute, Object> entry : result.entrySet()) {
            if (entry.getKey().getAlias().equals("Car_name")) {
                assertThat(entry.getValue().toString(), equalTo(Car.NAME));
            } else if (entry.getKey().getAlias().equals("Car_autoShow")) {
                assertThat(entry.getValue().toString(), equalTo(Car.AUTOSHOW));
            } else if (entry.getKey().getAlias().equals("Car_engine")) {
                assertThat(entry.getValue().toString(),
                        equalTo((new Integer(Car.ENGINE)).toString()));
            } else if (entry.getKey().getAlias().equals("Car_power")) {
                assertThat(entry.getValue().toString(),
                        equalTo((new Integer(Car.POWER)).toString()));
            } else {
                fail("Unknown attribute " + entry.getKey().toString());
            }
        }
        attr = new Attribute("Map.*.*", null, null);
        result = mla.getAll(mS, attr);
       
        assertEquals(cb.getMap().size() * 4, result.size());
        mbs.unregisterMBean(mS);
    }
View Full Code Here


        String mbName = "org.jmxdatamart.JMXTestServer:type=TestBean";
        ObjectName mbeanName = new ObjectName(mbName);
        mbs.registerMBean(tb, mbeanName);
       
        MultiLayeredAttribute mla = new MultiLayeredAttribute(mbs);
        Attribute attr = new Attribute("*", null, null);
        Map<Attribute, Object> result = mla.getAll(mbeanName, attr);
       
        assertEquals(4, result.size());
        for (Map.Entry<Attribute, Object> entry : result.entrySet()) {
            if (entry.getKey().getAlias().equals("A")) {
View Full Code Here

            StringBuilder sb = new StringBuilder(enclose(Array.get(curr, 0)));
            for (int i = 1; i < len; ++i) {
              sb.append(',').append(enclose(Array.get(curr, i)));
            }
            resultSoFar.put(
                    new Attribute(
                    null,
                    this.alias == null ? name2alias(currName) : this.alias,
                    DataType.STRING),
                    sb.toString());
          }
        } else {
          logger.info("Doesn't support extracting directly from type " + curr.getClass()
                  + " in " + currName);
          return;
        }
      } else {
        resultSoFar.put(
                new Attribute(
                null,
                this.alias == null ? name2alias(currName) : this.alias,
                dt),
                curr);
      }
View Full Code Here

TOP

Related Classes of org.jmxdatamart.Extractor.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.