/** * Description of the operation. * * @param operation the operation to describe * @return pretty-printed description */ protected String describeOperation(MBeanOperationInfo operation) { StringBuilder buf = new StringBuilder(); buf.append(operation.getReturnType()) .append(" ") .append(operation.getName()) .append("("); MBeanParameterInfo[] params = operation.getSignature(); for (int j = 0; j < params.length; j++) { MBeanParameterInfo param = params[j]; if (j != 0) { buf.append(", "); } buf.append(param.getType()) .append(" ") .append(param.getName()); } buf.append(")"); return buf.toString(); }
: 0 + ", return type=" + operations[i].getReturnType() + paramsStrBuffer.toString()); result.append("\n");
sb.setLength(sb.length() - 2); sb.append(") : ").append(toPrintableType(oi.getReturnType())); sb.append('\n'); if (!oi.getName().equals(oi.getDescription())) {
public String invoke(ObjectName bean, String operation, String... params) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, MBeanException { MBeanInfo mbinfo = mserver.getMBeanInfo(bean); MBeanOperationInfo op = null; for(MBeanOperationInfo oi: mbinfo.getOperations()) { if (oi.getName().equalsIgnoreCase(operation) && oi.getSignature().length == params.length) { if (op != null) { throw new IllegalArgumentException("Ambiguous " + operation + "/" + params.length + " operatition signature for " + bean); } op = oi; } } if (op == null) { throw new IllegalArgumentException("Operation " + operation + "/" + params.length + " not found for " + bean); } Object[] args = new Object[params.length]; String[] sig = new String[params.length]; for(int i = 0; i != params.length; ++i) { args[i] = convert(params[i], op.getSignature()[i].getType()); sig[i] = op.getSignature()[i].getType(); } return format(mserver.invoke(bean, op.getName(), args, sig), op.getReturnType()); }
if (isDirectlySupported(oInfo.getReturnType())) { retType = oInfo.getReturnType(); opMapInfo = new OperationMapInfo(oInfo, false); } else {
map.put(RETURN_TYPE.getKey(), opInfo.getReturnType()); map.put(DESCRIPTION.getKey(), opInfo.getDescription()); Object ops = opMap.get(opInfo.getName());
public static boolean isGetter(final MBeanOperationInfo info) { return (info.getName().startsWith(GET) && info.getSignature().length == 0 && !info.getReturnType().equals("void")); }
public static boolean isGetter(final MBeanOperationInfo info) { return (info.getName().startsWith(GET) && info.getSignature().length == 0 && !info.getReturnType().equals("void")); }
@Override public boolean equals( final MBeanOperationInfo a, final MBeanOperationInfo b ) { return a == b || a.getName().equals( b.getName() ) && a.getReturnType().equals( b.getReturnType() ) && Arrays.equals( a.getSignature(), b.getSignature() ); } }
new RowElement().add("Type: ", operationInfo.getReturnType()), new RowElement().add("Description: ", operationInfo.getDescription()), new RowElement().add("Impact: ", impact),
private OperationRepresentation(MBeanOperationInfo operationInfo) { name = operationInfo.getName(); impact = operationInfo.getImpact(); returnType = operationInfo.getReturnType(); ImmutableList.Builder<ParameterRepresentation> parameters = ImmutableList.builder(); for (MBeanParameterInfo parameterInfo : operationInfo.getSignature()) { parameters.add(new ParameterRepresentation(parameterInfo)); } this.parameters = parameters.build(); descriptor = toMap(operationInfo.getDescriptor()); }
private OperationRepresentation(MBeanOperationInfo operationInfo) { name = operationInfo.getName(); impact = operationInfo.getImpact(); returnType = operationInfo.getReturnType(); ImmutableList.Builder<ParameterRepresentation> parameters = ImmutableList.builder(); for (MBeanParameterInfo parameterInfo : operationInfo.getSignature()) { parameters.add(new ParameterRepresentation(parameterInfo)); } this.parameters = parameters.build(); descriptor = toMap(operationInfo.getDescriptor()); }
private OperationRepresentation(MBeanOperationInfo operationInfo) { name = operationInfo.getName(); impact = operationInfo.getImpact(); returnType = operationInfo.getReturnType(); ImmutableList.Builder<ParameterRepresentation> parameters = ImmutableList.builder(); for (MBeanParameterInfo parameterInfo : operationInfo.getSignature()) { parameters.add(new ParameterRepresentation(parameterInfo)); } this.parameters = parameters.build(); descriptor = toMap(operationInfo.getDescriptor()); }
private OperationRepresentation(MBeanOperationInfo operationInfo) { name = operationInfo.getName(); impact = operationInfo.getImpact(); returnType = operationInfo.getReturnType(); ImmutableList.Builder<ParameterRepresentation> parameters = ImmutableList.builder(); for (MBeanParameterInfo parameterInfo : operationInfo.getSignature()) { parameters.add(new ParameterRepresentation(parameterInfo)); } this.parameters = parameters.build(); descriptor = toMap(operationInfo.getDescriptor()); }
public MethodEntry(MBeanOperationInfo info) { super(info.getName(), info.getDescription(), info.getSignature(), info.getReturnType(), info.getImpact()); this.methodDescriptor = getMethodDescriptor(info.getSignature(), info.getReturnType()); } }
public MethodEntry(MBeanOperationInfo info) { super(info.getName(), info.getDescription(), info.getSignature(), info.getReturnType(), info.getImpact()); this.methodDescriptor = getMethodDescriptor(info.getSignature(), info.getReturnType()); } }
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { MBeanOperationInfo info = (MBeanOperationInfo)value; context.startElement(name, attributes); context.serialize(NAME_QNAME, null, info.getName()); context.serialize(DESCRIPTION_QNAME, null, info.getDescription()); context.serialize(SIGNATURE_QNAME, null, info.getSignature()); context.serialize(CLASS_NAME_QNAME, null, info.getReturnType()); context.serialize(IMPACT_QNAME, null, new Integer(info.getImpact())); context.endElement(); }
public NestedMBeanOperation(String prefix, MBeanOperation delegate) { this.delegate = delegate; MBeanOperationInfo delegateInfo = delegate.getInfo(); this.info = new MBeanOperationInfo(prefix + "." + delegateInfo.getName(), delegateInfo.getDescription(), delegateInfo.getSignature(), delegateInfo.getReturnType(), delegateInfo.getImpact(), delegateInfo.getDescriptor()); signature = new Signature(this.info); }
public NestedMBeanOperation(String prefix, MBeanOperation delegate) { this.delegate = delegate; MBeanOperationInfo delegateInfo = delegate.getInfo(); this.info = new MBeanOperationInfo(prefix + "." + delegateInfo.getName(), delegateInfo.getDescription(), delegateInfo.getSignature(), delegateInfo.getReturnType(), delegateInfo.getImpact(), delegateInfo.getDescriptor()); signature = new Signature(this.info); }
public NestedMBeanOperation(String prefix, MBeanOperation delegate) { this.delegate = delegate; MBeanOperationInfo delegateInfo = delegate.getInfo(); this.info = new MBeanOperationInfo(prefix + "." + delegateInfo.getName(), delegateInfo.getDescription(), delegateInfo.getSignature(), delegateInfo.getReturnType(), delegateInfo.getImpact(), delegateInfo.getDescriptor()); signature = new Signature(this.info); }