/** {@inheritDoc} */ public Object invoke(String pOperation, Object[] pParams, String[] pSignature) throws MBeanException, ReflectionException { OperationMapInfo opMapInfo = getOperationMapInfo(pOperation, pSignature); try { if (opMapInfo == null) { return jolokiaMBeanServer.invoke(objectName, pOperation, pParams, pSignature); } else { return mapAndInvoke(pOperation, pParams, pSignature, opMapInfo); } } catch (InstanceNotFoundException e) { // Should not happen, since the Jolokia MBeanServer and the delegate MBeanServer this bean is registered // at are in sync. throw new IllegalStateException("Internal: Could find MBean " + objectName + " on Jolokia MBeanServer. Should be in sync",e); } }
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 Object invoke(String pOperation, Object[] pParams, String[] pSignature) throws MBeanException, ReflectionException { OperationMapInfo opMapInfo = getOperationMapInfo(pOperation, pSignature); try { if (opMapInfo == null) { return jolokiaMBeanServer.invoke(objectName, pOperation, pParams, pSignature); } else { return mapAndInvoke(pOperation, pParams, pSignature, opMapInfo); } } catch (InstanceNotFoundException e) { // Should not happen, since the Jolokia MBeanServer and the delegate MBeanServer this bean is registered // at are in sync. throw new IllegalStateException("Internal: Could find MBean " + objectName + " on Jolokia MBeanServer. Should be in sync",e); } }
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; }