Search in sources :

Example 6 with MBeanParameterInfo

use of javax.management.MBeanParameterInfo in project jdk8u_jdk by JetBrains.

the class MustBeValidCommand method makeParInfos.

private static MBeanParameterInfo[] makeParInfos(String[][] spec) {
    final MBeanParameterInfo[] result = new MBeanParameterInfo[spec.length];
    for (int i = 0; i < result.length; i++) {
        System.out.println("\tCreate an MBeanParameterInfo: " + spec[i][0]);
        final MBeanParameterInfo item = new MBeanParameterInfo(spec[i][2], spec[i][1], spec[i][0]);
        result[i] = item;
    }
    return result;
}
Also used : MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 7 with MBeanParameterInfo

use of javax.management.MBeanParameterInfo in project jdk8u_jdk by JetBrains.

the class MustBeValidCommand method makeCtorInfos.

private static MBeanConstructorInfo[] makeCtorInfos(String[][] spec) {
    final MBeanConstructorInfo[] result = new MBeanConstructorInfo[spec.length];
    final MBeanParameterInfo[] pars = makeParInfos(parameters);
    for (int i = 0; i < result.length; i++) {
        System.out.println("\tCreate an MBeanConstructorInfo: " + spec[i][0]);
        final MBeanConstructorInfo item = new MBeanConstructorInfo(spec[i][1], spec[i][0], pars);
        result[i] = item;
    }
    return result;
}
Also used : MBeanConstructorInfo(javax.management.MBeanConstructorInfo) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 8 with MBeanParameterInfo

use of javax.management.MBeanParameterInfo in project tdi-studio-se by Talend.

the class InvokeDialog method validate.

/**
     * Validates the specified text.
     */
void validate() {
    boolean enableButton = true;
    for (Entry<MBeanParameterInfo, Control> entry : controls.entrySet()) {
        Control control = entry.getValue();
        if (!(control instanceof Text)) {
            continue;
        }
        String type = entry.getKey().getType();
        String text = ((Text) control).getText();
        if (!validateNumber(type, text)) {
            enableButton = false;
            break;
        }
    }
    Button invokeButton = getButton(IDialogConstants.CLIENT_ID);
    if (invokeButton != null) {
        invokeButton.setEnabled(enableButton);
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) Text(org.eclipse.swt.widgets.Text) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 9 with MBeanParameterInfo

use of javax.management.MBeanParameterInfo in project tdi-studio-se by Talend.

the class InvokeDialog method getParams.

/**
     * Gets the parameters.
     * 
     * @return The parameters
     */
private Object[] getParams() {
    List<Object> params = new ArrayList<Object>();
    for (final MBeanParameterInfo signature : info.getSignature()) {
        String text = getText(signature);
        Object object;
        String type = signature.getType();
        if ("int".equals(type)) {
            //$NON-NLS-1$
            object = Integer.valueOf(text);
        } else if ("long".equals(type)) {
            //$NON-NLS-1$
            object = Long.valueOf(text);
        } else if ("boolean".equals(type)) {
            //$NON-NLS-1$
            object = Boolean.valueOf(text);
        } else if ("java.lang.String".equals(type)) {
            //$NON-NLS-1$
            object = String.valueOf(text);
        } else if ("[J".equals(type)) {
            //$NON-NLS-1$
            //$NON-NLS-1$
            String[] elements = text.split(",");
            long[] objects = new long[elements.length];
            for (int i = 0; i < elements.length; i++) {
                objects[i] = Long.parseLong(elements[i]);
            }
            object = objects;
        } else {
            //$NON-NLS-1$
            throw new IllegalStateException("unknown parameter type");
        }
        params.add(object);
    }
    return params.toArray(new Object[0]);
}
Also used : ArrayList(java.util.ArrayList) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 10 with MBeanParameterInfo

use of javax.management.MBeanParameterInfo in project tdi-studio-se by Talend.

the class InvokeDialog method getMethodSignature.

/**
     * Gets the method signature.
     * 
     * @return The method signature
     */
private String getMethodSignature() {
    StringBuffer buffer = new StringBuffer();
    buffer.append(info.getName());
    //$NON-NLS-1$
    buffer.append("(");
    StringBuffer paramBuffer = new StringBuffer();
    for (MBeanParameterInfo parameterInfo : info.getSignature()) {
        if (paramBuffer.length() != 0) {
            //$NON-NLS-1$
            paramBuffer.append(", ");
        }
        String param = parameterInfo.getType();
        if (param.startsWith("[")) {
            //$NON-NLS-1$
            param = Signature.toString(param);
        }
        int index = param.lastIndexOf('.');
        if (index > 0) {
            param = param.substring(index + 1);
        }
        paramBuffer.append(param);
    }
    buffer.append(paramBuffer);
    //$NON-NLS-1$
    buffer.append(")");
    return buffer.toString();
}
Also used : MBeanParameterInfo(javax.management.MBeanParameterInfo)

Aggregations

MBeanParameterInfo (javax.management.MBeanParameterInfo)30 MBeanOperationInfo (javax.management.MBeanOperationInfo)17 MBeanInfo (javax.management.MBeanInfo)12 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)9 ObjectName (javax.management.ObjectName)6 ArrayList (java.util.ArrayList)5 Descriptor (javax.management.Descriptor)4 MBeanConstructorInfo (javax.management.MBeanConstructorInfo)4 Test (org.junit.Test)4 TreeMap (java.util.TreeMap)3 MBeanNotificationInfo (javax.management.MBeanNotificationInfo)3 DescriptorSupport (javax.management.modelmbean.DescriptorSupport)3 Annotation (java.lang.annotation.Annotation)2 Method (java.lang.reflect.Method)2 ImmutableDescriptor (javax.management.ImmutableDescriptor)2 ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)2 OpenMBeanOperationInfoSupport (javax.management.openmbean.OpenMBeanOperationInfoSupport)2 OpenMBeanParameterInfo (javax.management.openmbean.OpenMBeanParameterInfo)2 OpenMBeanParameterInfoSupport (javax.management.openmbean.OpenMBeanParameterInfoSupport)2 OpenType (javax.management.openmbean.OpenType)2