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;
}
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;
}
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);
}
}
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]);
}
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();
}
Aggregations