Java Code Examples for javax.management.openmbean.SimpleType#STRING

The following examples show how to use javax.management.openmbean.SimpleType#STRING . 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: LocalMBeanServer.java    From tomee with Apache License 2.0 6 votes vote down vote up
public static TabularData tabularData(final String typeName, final String typeDescription, final String[] names, final Object[] values) {
    if (names.length == 0) {
        return null;
    }

    final OpenType<?>[] types = new OpenType<?>[names.length];
    for (int i = 0; i < types.length; i++) {
        types[i] = SimpleType.STRING;
    }

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

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

        return data;
    } catch (final OpenDataException e) {
        return null;
    }
}
 
Example 2
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 3
Source File: TypeConverters.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Object[] toArray(List<Object> list) {
    if (getOpenType() == SimpleType.STRING) {
        return list.toArray(new String[list.size()]);
    }
    return list.toArray(new Object[list.size()]);
}
 
Example 4
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType makeFilesType_2_1_20() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.ProgressInfo";
  String description = "ProgressInfo";
  String[] itemNames = {
      "currentBytes",
      "direction",
      "fileName",
      "peer",
      "planId",
      "sessionIndex",
      "totalBytes"
  };
  String[] itemDescriptions = {
      "currentBytes",
      "direction",
      "fileName",
      "peer",
      "planId",
      "sessionIndex",
      "totalBytes"
  };
  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.INTEGER,
      SimpleType.LONG,
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example 5
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType streamStateType_2_1_20() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.StreamState";
  String description = "StreamState";
  String[] itemNames = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  String[] itemDescriptions = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };

  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.DOUBLE,
      ArrayType.getArrayType(makeSessionsTypePost2_1()),
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.DOUBLE
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example 6
Source File: JmxValueFunctionsTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Test
public void testTabularDataToMap() throws Exception {
    CompositeType rowType = new CompositeType(
            "MyRowType", 
            "my row descr", 
            new String[] {"key1", "key2"}, 
            new String[] {"key1 descr", "key2 descr"}, 
            new OpenType[] {SimpleType.STRING, SimpleType.STRING});
    TabularType tabularType = new TabularType(
            "MyTabularType", 
            "my table descr", 
            rowType,
            new String[] {"key1"});
    Map<String, ?> row1 = ImmutableMap.of(
            "key1", "row1.val1",
            "key2", "row1.val2");
    Map<String, ?> row2 = ImmutableMap.of(
            "key1", "row2.val1",
            "key2", "row2.val2");
    TabularDataSupport table = new TabularDataSupport(tabularType);
    table.put(new CompositeDataSupport(rowType, row1));
    table.put(new CompositeDataSupport(rowType, row2));
    
    Map<?,?> result = JmxValueFunctions.tabularDataToMap(table);
    assertEquals(result, row2);
    
    Map<?,?> result2 = JmxValueFunctions.tabularDataToMap().apply(table);
    assertEquals(result2, row2);
}
 
Example 7
Source File: GreetingOpenMBean.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
private OpenMBeanOperationInfo greetOpenOperationInfo() {
    return new OpenMBeanOperationInfoSupport(
            GREET_METHOD_NAME,                // 操作方法名称
            "greet 方法",           // 操作方法描述
            of(nameOpenMBeanParameterInfo()), // 操作方法参数信息
            SimpleType.STRING,                // 操作方法返回类型
            ACTION);
}
 
Example 8
Source File: TypeConverters.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public OpenType<?> getOpenType() {
    List<String> itemNames = new ArrayList<String>();
    List<String> itemDescriptions = new ArrayList<String>();
    List<OpenType<?>> itemTypes = new ArrayList<OpenType<?>>();

    //Some of the common operation descriptions use value-types like "The type will be that of the attribute found".
    if (!typeNode.isDefined() || typeNode.getType() == ModelType.STRING) {
        return SimpleType.STRING;
    }

    for (String name : typeNode.keys()) {
        ModelNode current = typeNode.get(name);
        itemNames.add(name);
        String description = null;
        if (!current.hasDefined(DESCRIPTION)) {
            description = "-";
        }
        else {
            description = current.get(DESCRIPTION).asString().trim();
            if (description.length() == 0) {
                description = "-";
            }
        }

        itemDescriptions.add(getDescription(current));
        itemTypes.add(getConverter(current).getOpenType());
    }
    try {
        return new CompositeType(JmxLogger.ROOT_LOGGER.complexCompositeEntryTypeName(),
                JmxLogger.ROOT_LOGGER.complexCompositeEntryTypeDescription(),
                itemNames.toArray(new String[itemNames.size()]),
                itemDescriptions.toArray(new String[itemDescriptions.size()]),
                itemTypes.toArray(new OpenType[itemTypes.size()]));
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
Example 9
Source File: CompositeDataStringTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
Example 10
Source File: CompositeDataStringTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
Example 11
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
EnumMapping(Class<T> enumClass) {
    super(enumClass, SimpleType.STRING);
    this.enumClass = enumClass;
}
 
Example 12
Source File: MXBeanWeirdParamTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Exception {

            int errorCount = 0 ;
            String msgTag = "ClientSide::main: ";

            try {

                // Get a connection to remote mbean server
                JMXServiceURL addr = new JMXServiceURL(args[0]);
                JMXConnector cc = JMXConnectorFactory.connect(addr);
                MBeanServerConnection mbsc = cc.getMBeanServerConnection();

                // ----
                System.out.println(msgTag + "Create and register the MBean");
                ObjectName objName = new ObjectName("sqe:type=Basic,protocol=rmi") ;
                mbsc.createMBean(BASIC_MXBEAN_CLASS_NAME, objName);
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                System.out.println(msgTag +"Get attribute SqeParameterAtt on our MXBean");
                Object result = mbsc.getAttribute(objName, "SqeParameterAtt");
                System.out.println(msgTag +"(OK) Got result of class "
                        + result.getClass().getName());
                System.out.println(msgTag +"Received CompositeData is " + result);
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                // We use the value returned by getAttribute to perform the invoke.
                System.out.println(msgTag +"Call operation doWeird on our MXBean [1]");
                mbsc.invoke(objName, "doWeird",
                        new Object[]{result},
                        new String[]{"javax.management.openmbean.CompositeData"});
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                // We build the CompositeData ourselves that time.
                System.out.println(msgTag +"Call operation doWeird on our MXBean [2]");
                String typeName = "SqeParameter";
                String[] itemNames = new String[] {"glop"};
                OpenType<?>[] openTypes = new OpenType<?>[] {SimpleType.STRING};
                CompositeType rowType = new CompositeType(typeName, typeName,
                        itemNames, itemNames, openTypes);
                Object[] itemValues = {"HECTOR"};
                CompositeData data =
                        new CompositeDataSupport(rowType, itemNames, itemValues);
                TabularType tabType = new TabularType(typeName, typeName,
                        rowType, new String[]{"glop"});
                TabularDataSupport tds = new TabularDataSupport(tabType);
                tds.put(data);
                System.out.println(msgTag +"Source CompositeData is " + data);
                mbsc.invoke(objName, "doWeird",
                        new Object[]{data},
                        new String[]{"javax.management.openmbean.CompositeData"});
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                System.out.println(msgTag +"Unregister the MBean");
                mbsc.unregisterMBean(objName);
                System.out.println(msgTag +"---- OK\n") ;

                // Terminate the JMX Client
                cc.close();

            } catch(Exception e) {
                Utils.printThrowable(e, true) ;
                errorCount++;
                throw new RuntimeException(e);
            } finally {
                System.exit(errorCount);
            }
        }
 
Example 13
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
private CompositeType makeSessionsType4_0() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.SessionInfo";
  String description = "SessionInfo";
  String[] itemNames = {
      "connecting",
      "connecting_port",
      "peer",
      "peer_port",
      "planId",
      "receivingFiles",
      "receivingSummaries",
      "sendingFiles",
      "sendingSummaries",
      "sessionIndex",
      "state"
  };
  String[] itemDescriptions = {
      "connecting",
      "connecting_port",
      "peer",
      "peer_port",
      "planId",
      "receivingFiles",
      "receivingSummaries",
      "sendingFiles",
      "sendingSummaries",
      "sessionIndex",
      "state"
  };
  OpenType[] itemTypes = {
      SimpleType.STRING,
      SimpleType.INTEGER,
      SimpleType.STRING,
      SimpleType.INTEGER,
      SimpleType.STRING,
      ArrayType.getArrayType(makeFilesType_4_0_0()),
      ArrayType.getArrayType(makeSummariesType_4_0_0()),
      ArrayType.getArrayType(makeFilesType_4_0_0()),
      ArrayType.getArrayType(makeSummariesType_4_0_0()),
      SimpleType.INTEGER,
      SimpleType.STRING,
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example 14
Source File: CompositeDataStringTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
Example 15
Source File: CompositeDataStringTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
Example 16
Source File: CompositeDataStringTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
Example 17
Source File: DefaultMXBeanMappingFactory.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
EnumMapping(Class<T> enumClass) {
    super(enumClass, SimpleType.STRING);
    this.enumClass = enumClass;
}
 
Example 18
Source File: TypeConverters.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
OpenType<?> getOpenType() {
    return SimpleType.STRING;
}
 
Example 19
Source File: MXBeanWeirdParamTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Exception {

            int errorCount = 0 ;
            String msgTag = "ClientSide::main: ";

            try {

                // Get a connection to remote mbean server
                JMXServiceURL addr = new JMXServiceURL(args[0]);
                JMXConnector cc = JMXConnectorFactory.connect(addr);
                MBeanServerConnection mbsc = cc.getMBeanServerConnection();

                // ----
                System.out.println(msgTag + "Create and register the MBean");
                ObjectName objName = new ObjectName("sqe:type=Basic,protocol=rmi") ;
                mbsc.createMBean(BASIC_MXBEAN_CLASS_NAME, objName);
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                System.out.println(msgTag +"Get attribute SqeParameterAtt on our MXBean");
                Object result = mbsc.getAttribute(objName, "SqeParameterAtt");
                System.out.println(msgTag +"(OK) Got result of class "
                        + result.getClass().getName());
                System.out.println(msgTag +"Received CompositeData is " + result);
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                // We use the value returned by getAttribute to perform the invoke.
                System.out.println(msgTag +"Call operation doWeird on our MXBean [1]");
                mbsc.invoke(objName, "doWeird",
                        new Object[]{result},
                        new String[]{"javax.management.openmbean.CompositeData"});
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                // We build the CompositeData ourselves that time.
                System.out.println(msgTag +"Call operation doWeird on our MXBean [2]");
                String typeName = "SqeParameter";
                String[] itemNames = new String[] {"glop"};
                OpenType<?>[] openTypes = new OpenType<?>[] {SimpleType.STRING};
                CompositeType rowType = new CompositeType(typeName, typeName,
                        itemNames, itemNames, openTypes);
                Object[] itemValues = {"HECTOR"};
                CompositeData data =
                        new CompositeDataSupport(rowType, itemNames, itemValues);
                TabularType tabType = new TabularType(typeName, typeName,
                        rowType, new String[]{"glop"});
                TabularDataSupport tds = new TabularDataSupport(tabType);
                tds.put(data);
                System.out.println(msgTag +"Source CompositeData is " + data);
                mbsc.invoke(objName, "doWeird",
                        new Object[]{data},
                        new String[]{"javax.management.openmbean.CompositeData"});
                System.out.println(msgTag +"---- OK\n") ;

                // ----
                System.out.println(msgTag +"Unregister the MBean");
                mbsc.unregisterMBean(objName);
                System.out.println(msgTag +"---- OK\n") ;

                // Terminate the JMX Client
                cc.close();

            } catch(Exception e) {
                Utils.printThrowable(e, true) ;
                errorCount++;
                throw new RuntimeException(e);
            } finally {
                System.exit(errorCount);
            }
        }
 
Example 20
Source File: DefaultMXBeanMappingFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
EnumMapping(Class<T> enumClass) {
    super(enumClass, SimpleType.STRING);
    this.enumClass = enumClass;
}