@Override public synchronized void setAttribute(Attribute attribute) throws InvalidAttributeValueException, MBeanException, AttributeNotFoundException { throw new MBeanException(new RuntimeException("BTrace attributes are read-only")); }
@Override public Object invoke( String s, Object[] objects, String[] strings ) throws MBeanException { try { return getClass().getMethod( s ).invoke( this ); } catch ( InvocationTargetException e ) { throw new MBeanException( (Exception) e.getTargetException() ); } catch ( Exception e ) { throw new MBeanException( e ); } } }
@Override public void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { try { put(attr.getName(),attr.getValue()); } catch (Exception e) { throw new MBeanException(e); } }
throw new MBeanException(e); } catch (Exception e) { throw new MBeanException(e); } finally { if (!task.isDone()) {
@Override public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("activate")) { activateLogging(); return null; } else if (actionName.equals("disable")) { disableLogging(); return null; } throw new MBeanException(new RuntimeException("Not Supported")); }
public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { try { Class<?>[] classes=new Class[sig.length]; for(int i=0;i < classes.length;i++) classes[i]=getClassForName(sig[i]); Method method=null; if(objs != null) { for(Object o: objs) { try { method=o.getClass().getMethod(name, classes); } catch(Throwable t) { continue; } return method.invoke(o, args); } } method=obj.getClass().getMethod(name, classes); return method.invoke(obj, args); } catch(Exception e) { throw new MBeanException(e); } }
/** * This will get the data from Object state which is replicated across the hidden region * FederataionComponent being the carrier. * */ protected Object delegateToObjectState(String attributeName) throws Throwable { Object returnObj; try { FederationComponent fedComp = (FederationComponent) monitoringRegion.get(objectName.toString()); returnObj = fedComp.getValue(attributeName); } catch (IllegalArgumentException e) { throw new MBeanException(e); } catch (Exception e) { throw new MBeanException(e); } catch (VirtualMachineError e) { SystemFailure.initiateFailure(e); throw e; } catch (Throwable th) { SystemFailure.checkFailure(); throw new MBeanException(new Exception(th.getLocalizedMessage())); } return returnObj; }
Object invokeWithOpenReturn(Object obj, Object[] params) throws MBeanException, IllegalAccessException, InvocationTargetException { final Object[] javaParams; try { javaParams = fromOpenParameters(params); } catch (InvalidObjectException e) { final String msg = methodName() + ": cannot convert parameters " + "from open values: " + e; throw new MBeanException(e, msg); } final Object javaReturn = method.invoke(obj, javaParams); try { return returnTypeConverter.toOpenValue(javaReturn); } catch (OpenDataException e) { final String msg = methodName() + ": cannot convert return " + "value to open value: " + e; throw new MBeanException(e, msg); } }
throw new MBeanException(new ServiceNotFoundException( "Could not find target")); throw new ReflectionException(x); } catch (IllegalArgumentException x) { throw new MBeanException(x); } catch (InvocationTargetException x) { Throwable t = x.getTargetException(); if (t instanceof Error) throw new MBeanException(new RuntimeErrorException((Error) t)); else throw new MBeanException((Exception) t);
logger.trace( "Parameter value's class and attribute's declared return class are not assignable"); throw new MBeanException(new InvalidAttributeValueException( "Returned type and declared type are not assignable."));
throw new MBeanException(new ServiceNotFoundException( "ModelMBeanInfo is null")); if (logger.isEnabledFor(Logger.DEBUG)) throw new MBeanException(new ServiceNotFoundException( String.format("Cannot find ModelMBeanOperationInfo for operation %s", method))); throw new MBeanException(new ServiceNotFoundException( String.format("Operation descriptor for operation %s cannot be null", method))); String role = (String) operationDescriptor.getFieldValue("role"); if (role == null || !role.equals("operation")) throw new MBeanException(new ServiceNotFoundException( String.format("Operation descriptor field 'role' must be 'operation', not %s", role))); throw new MBeanException(new ServiceNotFoundException( "MBean descriptor cannot be null")); if (logger.isEnabledFor(Logger.DEBUG)) throw (MBeanException) x; else throw new MBeanException(x);
MBeanServer server = getMBeanServer(); if (server == null) throw new MBeanException(new IllegalStateException( "MX4JModelMBean is not registered.")); if (server.isRegistered(objectName)) {
throw (MBeanException) x; else throw new MBeanException(x);
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException { Logger logger = getLogger(); Object target = descriptor.getFieldValue("targetObject"); if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObject is: " + target); if (target == null) { target = getManagedResource(); } else { String targetObjectType = (String) descriptor.getFieldValue("targetObjectType"); if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObjectType is: " + targetObjectType); if (targetObjectType == null) { // Not defined, assume object reference targetObjectType = OBJECT_RESOURCE_TYPE; } if (!isResourceTypeSupported(targetObjectType)) throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType)); } return target; }
throw new MBeanException(new IllegalStateException( "MX4JModelMBean is not registered."));
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { throw new MBeanException( new UnsupportedOperationException("MBean operation setAttribute is not supported for " + getClass().getName())); }
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("update")) { return params[1]; } else { throw new MBeanException( new UnsupportedOperationException("MBean operation " + actionName + " is not supported for " + getClass().getName())); } }
private Object getTableData(TabularType tabularType) throws MBeanException { TabularDataSupport tableData = new TabularDataSupport(tabularType); for (String[] rowData : TABLE_DATA) { try { tableData.put(new CompositeDataSupport(tabularType.getRowType(), COLUMN_NAMES, rowData)); } catch (OpenDataException exc) { throw new MBeanException(exc, "Error creating table data"); } } return tableData; }
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()); } }
protected static Object newInstance(String type) throws MBeanException { try { return Class.forName(type).getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new MBeanException(e); } } }