Package javax.management.openmbean

Examples of javax.management.openmbean.TabularDataSupport


                    String key = (String)it.next();
                    getMetric(objectName, metricName + "`" + key, data.get(key), rr);
                }
            }
            else if ( value instanceof TabularDataSupport ) {
                TabularDataSupport data = (TabularDataSupport)value;
                Set keys = data.keySet();
                for ( Iterator it = keys.iterator(); it.hasNext(); ) {
                    Object key = it.next();
                    for ( Iterator ki = ((List) key).iterator(); ki.hasNext(); ) {
                        Object key2 = ki.next();
                        CompositeData cd = data.get(new Object[] {key2});
                        getMetric(objectName, metricName + "`" + key2, cd.get("value"), rr);
                    }
                }
            }
            else if ( value.getClass().isArray() ) {
View Full Code Here


        }
        return top;
    }

    public TabularData getQueries() {
        TabularDataSupport tds = null;
        try {
            CompositeType ct = QueryStatCompositeTypeFactory.getCompositeType();

            TabularType tt = new TabularType(QueryStatDto.class.getName(),
                    "Query History", ct, QueryStatCompositeTypeFactory.index);
            tds = new TabularDataSupport(tt);

            for (QueryStatDto q : getTopQueries()) {
                tds.put(new CompositeDataSupport(ct,
                        QueryStatCompositeTypeFactory.names,
                        QueryStatCompositeTypeFactory.getValues(q)));
            }
            return tds;
        } catch (Exception e) {
View Full Code Here

            }

            try {
                CompositeType ct = new CompositeType(typeName, typeDescription, names, names, types);
                TabularType type = new TabularType(typeName, typeDescription, ct, names);
                TabularDataSupport data = new TabularDataSupport(type);

                CompositeData line = new CompositeDataSupport(ct, names, values);
                data.put(line);

                return data;
            } catch (OpenDataException e) {
                return null;
            }
View Full Code Here

        assertEquals("test", value);
        String key = (String)header.get(KEY);
        assertEquals(Constants.BUNDLE_SYMBOLICNAME, key);
       
       
        TabularData bundleTable = new TabularDataSupport(BUNDLES_TYPE);
        bundleTable.put(b.toCompositeData());
  
        CompositeData bundleData = bundleTable.get(new Object[]{Long.valueOf(1)});
        assertNotNull(bundleData);
        String location = (String) bundleData.get(LOCATION);
        assertEquals("location", location);
       
        assertArrayEquals(new String[] { "org.apache.aries.jmx;1.0.0"} , (String[]) compositeData.get(EXPORTED_PACKAGES));
View Full Code Here

        items.put(SERVICES_IN_USE, new Long[] { new Long(15), new Long(16), new Long(17) });
        items.put(START_LEVEL, 1);
        items.put(STATE, "ACTIVE");
        items.put(SYMBOLIC_NAME, "test");
        items.put(VERSION, "0.0.0");
        TabularData headerTable = new TabularDataSupport(HEADERS_TYPE);
        headerTable.put(new Header("a", "a").toCompositeData());
        headerTable.put(new Header("b", "b").toCompositeData());
        items.put(HEADERS, headerTable);
        CompositeData compositeData = new CompositeDataSupport(BUNDLE_TYPE, items);
       
        BundleData b = BundleData.from(compositeData);
       
View Full Code Here

                } else {
                    createProperty(propertyPrefix + "." + key, value);
                }
            }
        } else if (result instanceof TabularDataSupport) {
            TabularDataSupport data = (TabularDataSupport) result;
            for (Iterator iter = data.keySet().iterator(); iter.hasNext();) {
                Object key = iter.next();
                for (Iterator iter1 = ((List) key).iterator(); iter1.hasNext();) {
                    Object key1 = iter1.next();
                    CompositeData valuedata = data.get(new Object[] { key1 });
                    Object value = valuedata.get("value");
                    OpenType type = valuedata.getCompositeType().getType(
                            "value");
                    if (type instanceof SimpleType) {
                        setProperty(propertyPrefix + "." + key1, value);
View Full Code Here

        }
    }

    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);
        }
View Full Code Here

    @Override
    public TabularData viewUsers()
    {
        Map<String, Map<String, String>> users = _authProvider.getUsers();

        TabularDataSupport userList = new TabularDataSupport(_userlistDataType);

        try
        {
            // Create the tabular list of message header contents
            for (String user : users.keySet())
            {
                // Create header attributes list
                // Read,Write,Admin items are deprecated and we return always false.
                Object[] itemData = {user, false, false, false};
                CompositeData messageData = new CompositeDataSupport(_userDataType, COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), itemData);
                userList.put(messageData);
            }
        }
        catch (OpenDataException e)
        {
            _logger.warn("Unable to create user list due to :", e);
View Full Code Here

  CompositeData cdata = new CompositeDataSupport(ctype, data);
  CompositeData[] cdataarr = new CompositeData[] { cdata };
  ArrayType type2 = new ArrayType(1, ctype);
  h.check(type2.isValue(cdataarr), "Composite data check");
  TabularType ttype = new TabularType("Test","Test",ctype,new String[]{"name"});
  TabularData tdata = new TabularDataSupport(ttype);
  tdata.put(cdata);
  TabularData[] tdataarr = new TabularData[] {tdata};
  ArrayType type3 = new ArrayType(1, ttype);
  h.check(type3.isValue(tdataarr), "Tabular data check");
      }
    catch (OpenDataException e)
View Full Code Here

            }
        }

        Object fromSimpleModelNode(final ModelNode node) {
            final TabularType tabularType = (TabularType)getOpenType();
            final TabularDataSupport tabularData = new TabularDataSupport(tabularType);
            final Map<String, ModelNode> values = new HashMap<String, ModelNode>();
            final List<Property> properties = node.isDefined() ? node.asPropertyList() : null;
            if (properties != null) {
                for (Property prop : properties) {
                    values.put(prop.getName(), prop.getValue());
                }
            }

            final TypeConverter converter = TypeConverter.getConverter(valueTypeNode, null);
            for (Map.Entry<String, ModelNode> prop : values.entrySet()) {
                Map<String, Object> rowData = new HashMap<String, Object>();
                rowData.put("key", prop.getKey());
                rowData.put("value", converter.fromModelNode(prop.getValue()));
                try {
                    tabularData.put(new CompositeDataSupport(tabularType.getRowType(), rowData));
                } catch (OpenDataException e) {
                    throw new RuntimeException(e);
                }
            }
            return tabularData;
View Full Code Here

TOP

Related Classes of javax.management.openmbean.TabularDataSupport

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.