@Override public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { throw new ReflectionException(new NoSuchMethodException(name)); }
@Override public Object invoke(String name, Object[] args, String[] signature) throws MBeanException, ReflectionException { if (name.equals("reset")) { reset(); return null; } throw new ReflectionException(new NoSuchMethodException(name)); }
public Object invoke(String operationName, Object params[], String signature[]) throws MBeanException, ReflectionException { if (operationName == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Operation name cannot be null"), "Cannot invoke a null operation in " + dClassName); } // Check for a recognized operation name and call the corresponding operation if(operationName.equals("addLoggerMBean")) { return addLoggerMBean((String)params[0]); } else { throw new ReflectionException( new NoSuchMethodException(operationName), "Cannot find the operation " + operationName + " in " + dClassName); } }
method = realTarget.getClass().getMethod(methodName, params); } catch (NoSuchMethodException x) { throw new ReflectionException(x); return value; } catch (IllegalAccessException x) { throw new ReflectionException(x); } catch (IllegalArgumentException x) { throw new MBeanException(x);
@Override public synchronized Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { throw new ReflectionException(new NoSuchMethodException(name)); }
} catch (ClassNotFoundException x) { logger.error("Cannot find operation's parameter classes", x); throw new ReflectionException(x);
public Object invoke(String operationName, Object params[], String signature[]) throws MBeanException, ReflectionException { if (operationName == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Operation name cannot be null"), "Cannot invoke a null operation in " + dClassName); } // Check for a recognized operation name and call the corresponding operation if(operationName.equals("addLoggerMBean")) { return addLoggerMBean((String)params[0]); } else { throw new ReflectionException( new NoSuchMethodException(operationName), "Cannot find the operation " + operationName + " in " + dClassName); } }
@Override public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { JmxOperation operation = this.operations.get(actionName); if (operation == null) { String message = "Endpoint with id '" + this.endpoint.getEndpointId() + "' has no operation named " + actionName; throw new ReflectionException(new IllegalArgumentException(message), message); } ClassLoader previousClassLoader = overrideThreadContextClassLoader( this.classLoader); try { return invoke(operation, params); } finally { overrideThreadContextClassLoader(previousClassLoader); } }
private Object invoke(JmxOperation operation, Object[] params) throws MBeanException, ReflectionException { try { String[] parameterNames = operation.getParameters().stream() .map(JmxOperationParameter::getName).toArray(String[]::new); Map<String, Object> arguments = getArguments(parameterNames, params); InvocationContext context = new InvocationContext(SecurityContext.NONE, arguments); Object result = operation.invoke(context); if (REACTOR_PRESENT) { result = ReactiveHandler.handle(result); } return this.responseMapper.mapResponse(result); } catch (InvalidEndpointRequestException ex) { throw new ReflectionException(new IllegalArgumentException(ex.getMessage()), ex.getMessage()); } catch (Exception ex) { throw new MBeanException(translateIfNecessary(ex), ex.getMessage()); } }
@Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { throw new ReflectionException(new NoSuchMethodException("set" + attribute)); }
@Override public Object invoke(String actionName, Object[] params, String[] signature) throws ReflectionException { throw new ReflectionException(new NoSuchMethodException(actionName)); }
@Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { throw new ReflectionException(new NoSuchMethodException("set" + attribute)); }
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("reset")) { reset(); return "Statistics reset"; } else { throw new ReflectionException(new NoSuchMethodException( actionName), "Cannot find the operation " + actionName); } }
public Object getAttribute(final String s) throws AttributeNotFoundException, MBeanException, ReflectionException { try { final Member member = attributesMap.get(s); if (member == null) { throw new AttributeNotFoundException(s); } return member.get(); } catch (final Exception e) { e.printStackTrace(); throw new ReflectionException(e); } }
@Override public Object getAttribute(Object o, String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { Method method = getGetter(attribute); if (method == null) throw new AttributeNotFoundException(attribute + "@" + name); try { return method.invoke(o, new Object[0]); } catch (Exception e) { throw new ReflectionException(e,attribute + "@" + name); } }
@Nullable public Object invoke(@NotNull String name, @Nullable Object[] args, @Nullable String[] sig) throws MBeanException, ReflectionException { if ((name.equals("reload")) && ((args == null) || (args.length == 0)) && ((sig == null) || (sig.length == 0))) { load(); return null; } throw new ReflectionException(new NoSuchMethodException(name)); }
public Object getAttribute(String s) throws AttributeNotFoundException, MBeanException, ReflectionException { try { Member member = map.get(s); if (member == null) throw new AttributeNotFoundException(s); return member.get(); } catch (Exception e) { e.printStackTrace(); throw new ReflectionException(e); } }
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("reset")) { reset(); return "Statistics reset"; } else { throw new ReflectionException(new NoSuchMethodException( actionName), "Cannot find the operation " + actionName); } }
@Override public Object get(Object managedResource) throws ReflectionException { if (!getMetadata().isReadable()) throw new ReflectionException(new IllegalAccessException("Attribute not readable: " + this), "Attribute not readable: " + this); if (!field.isAccessible()) field.setAccessible(true); try { return field.get(managedResource); } catch (Exception e) { throw JmxUtils.rethrow(e); } }
Object invoke(String name, String[] params, Object[] args, ObjectMBean mbean) throws ReflectionException, MBeanException { String signature = signature(name, params); OperationInfo info = findOperation(signature); if (info == null) throw new ReflectionException(new NoSuchMethodException(signature)); return info.invoke(args, mbean); }