package org.jboss.test.jbossnet.jmx.server;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.DynamicMBean;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanConstructorInfo;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.ReflectionException;
public class JMXDynamicTest implements DynamicMBean
{
private String testString = "JMX_TEST_STRING";
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException
{
return testString;
}
public void setAttribute(Attribute attribute)
throws
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException
{
testString = (String) attribute.getValue();
}
public AttributeList getAttributes(String[] attributes)
{
return null;
}
public AttributeList setAttributes(AttributeList attributes)
{
return null;
}
public Object invoke(String actionName, Object[] params, String[] signature)
throws MBeanException, ReflectionException
{
return null;
}
public MBeanInfo getMBeanInfo()
{
MBeanAttributeInfo[] attrs =
new MBeanAttributeInfo[] {
new MBeanAttributeInfo(
"TestString",
"java.lang.String",
"shit",
true,
true,
false)};
MBeanOperationInfo[] ops =
new MBeanOperationInfo[] {
new MBeanOperationInfo(
"noopOperation",
"shit",
new MBeanParameterInfo[0],
"void",
MBeanOperationInfo.UNKNOWN)};
MBeanInfo result =
new MBeanInfo(
getClass().getName(),
"shit",
attrs,
new MBeanConstructorInfo[0],
ops,
new MBeanNotificationInfo[0]);
return result;
}
}