private Object mapAndInvoke(String pOperation, Object[] pParams, String[] pSignature, OperationMapInfo pOpMapInfo) throws InstanceNotFoundException, MBeanException, ReflectionException { // Map parameters Object realParams[] = new Object[pSignature.length]; String realSignature[] = new String[pSignature.length]; for (int i = 0; i < pSignature.length; i++) { if (pOpMapInfo.isParamMapped(i)) { String origType = pOpMapInfo.getOriginalType(i); OpenType openType = pOpMapInfo.getOpenMBeanType(i); if (openType != null) { realParams[i] = fromJson(openType, (String) pParams[i]); } else { realParams[i] = fromJson(origType, (String) pParams[i]); } realSignature[i] = origType; } else { realParams[i] = pParams[i]; realSignature[i] = pSignature[i]; } } Object ret = jolokiaMBeanServer.invoke(objectName, pOperation, realParams, realSignature); return pOpMapInfo.isRetTypeMapped() ? toJson(ret) : ret; }
/** {@inheritDoc} */ public void setAttribute(Attribute pAttribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { try { if (!attributeInfoMap.containsKey(pAttribute.getName())) { jolokiaMBeanServer.setAttribute(objectName, pAttribute); } else { String name = pAttribute.getName(); MBeanAttributeInfo info = attributeInfoMap.get(name); Object value; if (info instanceof OpenMBeanAttributeInfo) { value = fromJson(((OpenMBeanAttributeInfo) info).getOpenType(), (String) pAttribute.getValue()); } else { value = fromJson(info.getType(), (String) pAttribute.getValue()); } Attribute attr = new Attribute(name, value); jolokiaMBeanServer.setAttribute(objectName, attr); } } catch (InstanceNotFoundException e) { AttributeNotFoundException exp = new AttributeNotFoundException("MBean " + objectName + " not found for attribute " + pAttribute); exp.initCause(e); throw exp; } }
private Object mapAndInvoke(String pOperation, Object[] pParams, String[] pSignature, OperationMapInfo pOpMapInfo) throws InstanceNotFoundException, MBeanException, ReflectionException { // Map parameters Object realParams[] = new Object[pSignature.length]; String realSignature[] = new String[pSignature.length]; for (int i = 0; i < pSignature.length; i++) { if (pOpMapInfo.isParamMapped(i)) { String origType = pOpMapInfo.getOriginalType(i); OpenType openType = pOpMapInfo.getOpenMBeanType(i); if (openType != null) { realParams[i] = fromJson(openType, (String) pParams[i]); } else { realParams[i] = fromJson(origType, (String) pParams[i]); } realSignature[i] = origType; } else { realParams[i] = pParams[i]; realSignature[i] = pSignature[i]; } } Object ret = jolokiaMBeanServer.invoke(objectName, pOperation, realParams, realSignature); return pOpMapInfo.isRetTypeMapped() ? toJson(ret) : ret; }
/** {@inheritDoc} */ public void setAttribute(Attribute pAttribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { try { if (!attributeInfoMap.containsKey(pAttribute.getName())) { jolokiaMBeanServer.setAttribute(objectName, pAttribute); } else { String name = pAttribute.getName(); MBeanAttributeInfo info = attributeInfoMap.get(name); Object value; if (info instanceof OpenMBeanAttributeInfo) { value = fromJson(((OpenMBeanAttributeInfo) info).getOpenType(), (String) pAttribute.getValue()); } else { value = fromJson(info.getType(), (String) pAttribute.getValue()); } Attribute attr = new Attribute(name, value); jolokiaMBeanServer.setAttribute(objectName, attr); } } catch (InstanceNotFoundException e) { AttributeNotFoundException exp = new AttributeNotFoundException("MBean " + objectName + " not found for attribute " + pAttribute); exp.initCause(e); throw exp; } }