Package javax.management.openmbean

Examples of javax.management.openmbean.CompositeType


        /* waitedTime */new Long(GOOD_WAITED_TIME),
        /* lockName */new String(GOOD_LOCK_NAME),
        /* lockOwnerId */new Long(GOOD_LOCK_OWNER_ID),
        /* lockOwnerName */new String(GOOD_LOCK_OWNER_NAME),
        /* stackTrace */createGoodStackTraceCompositeData() };
        CompositeType cType = createGoodThreadInfoCompositeType();
        try {
            result = new CompositeDataSupport(cType, names, values);
        } catch (OpenDataException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here


     */
    public static CompositeData[] createGoodStackTraceCompositeData() {
        // Let's make the array have three elements. Doesn't matter that
        // they are all identical.
        CompositeData[] result = new CompositeData[GOOD_STACK_SIZE];
        CompositeType cType = createGoodStackTraceElementCompositeType();
        String[] names = { "className", "methodName", "fileName", "lineNumber",
                "nativeMethod" };
        Object[] values = { GOOD_STACK_CLASSNAME, GOOD_STACK_METHODNAME,
                GOOD_STACK_FILENAME, new Integer(GOOD_STACK_LINENUMBER),
                new Boolean(GOOD_STACK_NATIVEMETHOD) };
View Full Code Here

     * @return <code>CompositeType</code> for use when wrapping up
     *         <code>ThreadInfo</code> objects in <code>CompositeData</code>
     *         s.
     */
    private static CompositeType createGoodThreadInfoCompositeType() {
        CompositeType result = null;
        try {
            String[] typeNames = { "threadId", "threadName", "threadState",
                    "suspended", "inNative", "blockedCount", "blockedTime",
                    "waitedCount", "waitedTime", "lockName", "lockOwnerId",
                    "lockOwnerName", "stackTrace" };
            String[] typeDescs = { "threadId", "threadName", "threadState",
                    "suspended", "inNative", "blockedCount", "blockedTime",
                    "waitedCount", "waitedTime", "lockName", "lockOwnerId",
                    "lockOwnerName", "stackTrace", };
            OpenType[] typeTypes = {
                    SimpleType.LONG,
                    SimpleType.STRING,
                    SimpleType.STRING,
                    SimpleType.BOOLEAN,
                    SimpleType.BOOLEAN,
                    SimpleType.LONG,
                    SimpleType.LONG,
                    SimpleType.LONG,
                    SimpleType.LONG,
                    SimpleType.STRING,
                    SimpleType.LONG,
                    SimpleType.STRING,
                    new ArrayType(1, createGoodStackTraceElementCompositeType()) };
            result = new CompositeType(ThreadInfo.class.getName(),
                    ThreadInfo.class.getName(), typeNames, typeDescs, typeTypes);
        } catch (OpenDataException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
View Full Code Here

        }
        return result;
    }

    private static CompositeType createGoodStackTraceElementCompositeType() {
        CompositeType result = null;
        String[] typeNames = { "className", "methodName", "fileName",
                "lineNumber", "nativeMethod" };
        String[] typeDescs = { "className", "methodName", "fileName",
                "lineNumber", "nativeMethod" };
        OpenType[] typeTypes = { SimpleType.STRING, SimpleType.STRING,
                SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN };
        try {
            result = new CompositeType(StackTraceElement.class.getName(),
                    StackTraceElement.class.getName(), typeNames, typeDescs,
                    typeTypes);
        } catch (OpenDataException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

     * Test method for 'java.lang.management.ThreadInfo.from(CompositeData)'
     * with more than 13 essential fields
     */
    public void test_from_fields() throws Exception {
        Object stackTraceElementData = createGoodStackTraceCompositeData();
        CompositeType stackTraceElementType = createGoodStackTraceElementCompositeType();
        String[] names = { "threadId", "threadName", "threadState",
                "suspended", "inNative", "blockedCount", "blockedTime",
                "waitedCount", "waitedTime", "lockName", "lockOwnerId",
                "lockOwnerName", "stackTrace", "additionalName" };
        Object[] values = { 1L, "threadName", GOOD_THREAD_STATE.toString(),
                true, false, 1L, 500L, 1L, 1L, "lock", 2L, "lockOwner",
                stackTraceElementData, "additionalValue" };
        OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
                SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
                SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
                SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
                SimpleType.STRING, new ArrayType(1, stackTraceElementType),
                SimpleType.STRING };
        CompositeType compositeType = new CompositeType(ThreadInfo.class
                .getName(), ThreadInfo.class.getName(), names, names, types);
        CompositeData data = new CompositeDataSupport(compositeType, names,
                values);
        ThreadInfo threadInfo = ThreadInfo.from(data);
        assertEquals(values[0], threadInfo.getThreadId());
View Full Code Here

    }

    public TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException {
        OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
        Message[] messages = destination.browse();
        CompositeType ct = factory.getCompositeType();
        TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] {"JMSMessageID"});
        TabularDataSupport rc = new TabularDataSupport(tt);

        MessageEvaluationContext ctx = new MessageEvaluationContext();
        ctx.setDestination(destination.getActiveMQDestination());
View Full Code Here

    }

    public TabularData browseAsTable(SubscriptionView view) throws OpenDataException {
        OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
        List<Message> messages = getSubscriberMessages(view);
        CompositeType ct = factory.getCompositeType();
        TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] {"JMSMessageID"});
        TabularDataSupport rc = new TabularDataSupport(tt);
        for (int i = 0; i < messages.size(); i++) {
            rc.put(new CompositeDataSupport(ct, factory.getFields(messages.get(i))));
        }
View Full Code Here

    public static CompositeData convert(Message message) throws OpenDataException {
        OpenTypeFactory f = getFactory(message.getClass());
        if (f == null) {
            throw new OpenDataException("Cannot create a CompositeData for type: " + message.getClass().getName());
        }
        CompositeType ct = f.getCompositeType();
        Map<String, Object> fields = f.getFields(message);
        return new CompositeDataSupport(ct, fields);
    }
View Full Code Here

        protected CompositeType createCompositeType() throws OpenDataException {
            String[] itemNames = itemNamesList.toArray(new String[itemNamesList.size()]);
            String[] itemDescriptions = itemDescriptionsList.toArray(new String[itemDescriptionsList.size()]);
            OpenType[] itemTypes = itemTypesList.toArray(new OpenType[itemTypesList.size()]);
            return new CompositeType(getTypeName(), getDescription(), itemNames, itemDescriptions, itemTypes);
        }
View Full Code Here

    protected ConnectionPool pool = null;
   
    protected static CompositeType getCompositeType() {
        if (SLOW_QUERY_TYPE==null) {
            try {
                SLOW_QUERY_TYPE = new CompositeType(
                        SlowQueryReportJmx.class.getName(),
                        "Composite data type for query statistics",
                        QueryStats.getFieldNames(),
                        QueryStats.getFieldDescriptions(),
                        QueryStats.getFieldTypes());
View Full Code Here

TOP

Related Classes of javax.management.openmbean.CompositeType

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.