/** * Convert from a JSON or other string representation to real object. Used when preparing operation * argument. If the JSON structure cannot be converted, an {@link IllegalArgumentException} is thrown. * * @param type type to convert to * @param json string to deserialize * @return the deserialized object */ Object fromJson(String type, String json) { return converters.getToObjectConverter().convertFromString(type,json); }
/** * Execute an JMX operation. The operation name is taken from the request, as well as the * arguments to use. If the operation is given in the format "op(type1,type2,...)" * (e.g "getText(java.lang.String,int)" then the argument types are taken into account * as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation * is called without specifying the argument types, then an exception is raised. * * * @param server server to try * @param request request to process from where the operation and its arguments are extracted. * @return the return value of the operation call */ @Override public Object doHandleRequest(MBeanServerConnection server, JmxExecRequest request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { OperationAndParamType types = extractOperationTypes(server,request); int nrParams = types.paramClasses.length; Object[] params = new Object[nrParams]; List<Object> args = request.getArguments(); verifyArguments(request, types, nrParams, args); for (int i = 0;i < nrParams; i++) { if (types.paramOpenTypes != null && types.paramOpenTypes[i] != null) { params[i] = converters.getToOpenTypeConverter().convertToObject(types.paramOpenTypes[i], args.get(i)); } else { params[i] = converters.getToObjectConverter().prepareValue(types.paramClasses[i], args.get(i)); } } // TODO: Maybe allow for a path as well which could be applied on the return value ... return server.invoke(request.getObjectName(),types.operationName,params,types.paramClasses); }
converters.getToObjectConverter().prepareValue(pType, newValue), pCurrentValue };
/** * Convert from a JSON or other string representation to real object. Used when preparing operation * argument. If the JSON structure cannot be converted, an {@link IllegalArgumentException} is thrown. * * @param type type to convert to * @param json string to deserialize * @return the deserialized object */ Object fromJson(String type, String json) { return converters.getToObjectConverter().convertFromString(type,json); }
/** * Execute an JMX operation. The operation name is taken from the request, as well as the * arguments to use. If the operation is given in the format "op(type1,type2,...)" * (e.g "getText(java.lang.String,int)" then the argument types are taken into account * as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation * is called without specifying the argument types, then an exception is raised. * * * @param server server to try * @param request request to process from where the operation and its arguments are extracted. * @return the return value of the operation call */ @Override public Object doHandleRequest(MBeanServerConnection server, JmxExecRequest request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { OperationAndParamType types = extractOperationTypes(server,request); int nrParams = types.paramClasses.length; Object[] params = new Object[nrParams]; List<Object> args = request.getArguments(); verifyArguments(request, types, nrParams, args); for (int i = 0;i < nrParams; i++) { if (types.paramOpenTypes != null && types.paramOpenTypes[i] != null) { params[i] = converters.getToOpenTypeConverter().convertToObject(types.paramOpenTypes[i], args.get(i)); } else { params[i] = converters.getToObjectConverter().prepareValue(types.paramClasses[i], args.get(i)); } } // TODO: Maybe allow for a path as well which could be applied on the return value ... return server.invoke(request.getObjectName(),types.operationName,params,types.paramClasses); }
/** * Execute an JMX operation. The operation name is taken from the request, as well as the * arguments to use. If the operation is given in the format "op(type1,type2,...)" * (e.g "getText(java.lang.String,int)" then the argument types are taken into account * as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation * is called without specifying the argument types, then an exception is raised. * * * @param server server to try * @param request request to process from where the operation and its arguments are extracted. * @return the return value of the operation call */ @Override public Object doHandleRequest(MBeanServerConnection server, JmxExecRequest request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException { OperationAndParamType types = extractOperationTypes(server,request); int nrParams = types.paramClasses.length; Object[] params = new Object[nrParams]; List<Object> args = request.getArguments(); verifyArguments(request, types, nrParams, args); for (int i = 0;i < nrParams; i++) { if (types.paramOpenTypes != null && types.paramOpenTypes[i] != null) { params[i] = converters.getToOpenTypeConverter().convertToObject(types.paramOpenTypes[i], args.get(i)); } else { params[i] = converters.getToObjectConverter().prepareValue(types.paramClasses[i], args.get(i)); } } // TODO: Maybe allow for a path as well which could be applied on the return value ... return server.invoke(request.getObjectName(),types.operationName,params,types.paramClasses); }
converters.getToObjectConverter().prepareValue(pType, newValue), pCurrentValue };
converters.getToObjectConverter().prepareValue(pType, newValue), pCurrentValue };