/** * Writes this attribute value to the MBEan server. * * @param connectionConfiguration the connection context. * @param objectName the ObjectName of the specified MBean * @param attributeInfo the AtributeInfo object. * @param attributeValue the new Value */ public void writeAttributeValue( IConnectionConfiguration connectionConfiguration, ObjectName objectName, MBeanAttributeInfo attributeInfo, String attributeValue) { // convert Object value = convertStringValueToObjectValue(attributeInfo.getType(), attributeValue); Attribute attribute = new Attribute(attributeInfo.getName(), value); JMXExplorerEvent event; try { mBeanServerConnection.setAttribute(objectName, attribute); event = new JMXExplorerEvent( connectionConfiguration, JMXExplorerEvent.ATTRIBUTE_VALUE_CHANGED, objectName, attribute, attributeInfo); } catch (Exception t) { // we fould exception, no mather what, the attribute value was not // set Activator.getDefault().error("writeAttributeValue failed", t); event = new JMXExplorerEvent( connectionConfiguration, JMXExplorerEvent.CHANGE_ATTRIBUTE_VALUE_ERROR, objectName, t, attributeInfo); return; } jmxExplorerMediator.notifyObserversWithJMXEvent(event); }
/** * Invokes the specified operationInfo in the given connection. The parameters follows the * MbeanServerConnection.invoke conventions; * * @param connectionConfiguration the connection context * @param objectName the ObjectName of the MBean * @param operationInfo The OperationInfo for this operation * @param parameterValues The parameterValues for the operation. * @param parameterSignatures The parameter signatures of the operation. */ public void invokeOperation( IConnectionConfiguration connectionConfiguration, ObjectName objectName, MBeanOperationInfo operationInfo, List<String> parameterValues, List<String> parameterSignatures) { JMXExplorerEvent event; try { List<Object> parameterObjectValues = new ArrayList<Object>(); for (int t = 0; t < parameterValues.size(); t++) { String textValue = parameterValues.get(t); Object value = convertStringValueToObjectValue(parameterSignatures.get(t), textValue); parameterObjectValues.add(value); } String[] parameterSignaturesString = new String[parameterSignatures.size()]; Object result = mBeanServerConnection.invoke( objectName, operationInfo.getName(), parameterObjectValues.toArray(), parameterSignatures.toArray(parameterSignaturesString)); event = new JMXExplorerEvent( connectionConfiguration, JMXExplorerEvent.INVOKE_OPERATION_RESULT, objectName, result, operationInfo); } catch (Throwable t) { Activator.getDefault().error("invokeOperation failed", t); event = new JMXExplorerEvent( connectionConfiguration, JMXExplorerEvent.INVOKE_OPERATION_ERROR, objectName, t, operationInfo); } jmxExplorerMediator.notifyObserversWithJMXEvent(event); }