Package javax.management.openmbean

Examples of javax.management.openmbean.CompositeDataSupport


            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


        boolean flowBlocked = false;

        _connection.createSession(transactional, Session.AUTO_ACKNOWLEDGE);

        final ManagedConnection mBean = getConnectionMBean();
        final CompositeDataSupport row = getTheOneChannelRow(mBean);
        assertChannelRowData(row, 0, transactional, flowBlocked);
    }
View Full Code Here

        sendMessage(session, destination, numberOfMessages);
        receiveMessagesWithoutCommit(consumer, numberOfMessages);

        final ManagedConnection mBean = getConnectionMBean();
        final CompositeDataSupport row = getTheOneChannelRow(mBean);
        boolean flowBlocked = false;
        assertChannelRowData(row, numberOfMessages, transactional, flowBlocked);

        // check that commit advances the lastIoTime
        final Date initialLastIOTime = mBean.getLastIoTime();
        session.commit();
        assertTrue("commit should have caused last IO time to advance", mBean.getLastIoTime().after(initialLastIOTime));

        // check that channels() now returns one session with no unacknowledged messages
        final CompositeDataSupport rowAfterCommit = getTheOneChannelRow(mBean);
        final Number unackCountAfterCommit = (Number) rowAfterCommit.get(ManagedConnection.UNACKED_COUNT);
        assertEquals("Unexpected number of unacknowledged messages", 0, unackCountAfterCommit);
    }
View Full Code Here

        managedQueue.setCapacity(DEFAULT_MESSAGE_SIZE * 3l);

        final ManagedConnection managedConnection = getConnectionMBean();

        // Check that producer flow is not block before test
        final CompositeDataSupport rowBeforeSend = getTheOneChannelRow(managedConnection);
        assertFlowBlocked(rowBeforeSend, false);


        // Check that producer flow does not become block too soon
        sendMessage(session, queue, 3);
        final CompositeDataSupport rowBeforeFull = getTheOneChannelRow(managedConnection);
        assertFlowBlocked(rowBeforeFull, false);

        // Fourth message will over-fill the queue (but as we are not sending more messages, client thread wont't block)
        sendMessage(session, queue, 1);
        final CompositeDataSupport rowAfterFull = getTheOneChannelRow(managedConnection);
        assertFlowBlocked(rowAfterFull, true);

        // Consume two to bring the queue down to the resume capacity
        MessageConsumer consumer = session.createConsumer(queue);
        assertNotNull("Could not receive first message", consumer.receive(1000));
        assertNotNull("Could not receive second message", consumer.receive(1000));
        session.commit();

        // Check that producer flow is no longer blocked
        final CompositeDataSupport rowAfterReceive = getTheOneChannelRow(managedConnection);
        assertFlowBlocked(rowAfterReceive, false);
    }
View Full Code Here

        assertEquals("Unexpected number of rows in channel table", 1, channelsData.size());

        @SuppressWarnings("unchecked")
        final Iterator<CompositeDataSupport> rowItr = (Iterator<CompositeDataSupport>) channelsData.values().iterator();
        final CompositeDataSupport row = rowItr.next();
        return row;
    }
View Full Code Here

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

  CompositeType ctype = new CompositeType("Test","Test",new String[]{"name"},
            new String[]{"Name"},
            new OpenType[] { SimpleType.STRING});
  Map<String,String> data = new HashMap<String,String>();
  data.put("name", "Bob");
  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);
View Full Code Here

            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

                    TypeConverter converter = getConverter(typeNode.get(attrName, TYPE), typeNode.get(attrName, VALUE_TYPE));
                    items.put(attrName, converter.fromModelNode(node.get(attrName)));
                }

                try {
                    return new CompositeDataSupport(compositeType, items);
                } catch (OpenDataException e) {
                    throw new RuntimeException(e);
                }
            } else {
                return node.toJSONString(false);
View Full Code Here

        Map<String, Object> values = new HashMap<String, Object>();
        for (String key : contentType.keySet()) {
            values.put(key, null);
        }
        values.put("hash", hash);
        CompositeData contents = new CompositeDataSupport(contentType, values);

        //Deploy it
        connection.invoke(ROOT_MODEL_NAME,
                "addDeployment",
                new Object[] {"test-jmx-sar.sar", "test-jmx-sar.sar", new CompositeData[] {contents}, Boolean.TRUE},
View Full Code Here

TOP

Related Classes of javax.management.openmbean.CompositeDataSupport

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.