pull invoke and setAttribute methods up to superclass
This commit is contained in:
parent
e0b67cf3fa
commit
e6bb9c7f7e
|
@ -22,7 +22,6 @@ import javax.management.Attribute;
|
|||
import javax.management.AttributeList;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.InvalidAttributeValueException;
|
||||
import javax.management.MBeanException;
|
||||
import javax.management.MBeanRegistration;
|
||||
import javax.management.MBeanServer;
|
||||
|
@ -202,12 +201,6 @@ public abstract class AbstractMBean implements DynamicMBean, MBeanRegistration {
|
|||
result.add(next);
|
||||
} catch (AttributeNotFoundException e) {
|
||||
// ignore, as we cannot throw this exception
|
||||
} catch (InvalidAttributeValueException e) {
|
||||
// ignore, as we cannot throw this exception
|
||||
} catch (MBeanException e) {
|
||||
// ignore, as we cannot throw this exception
|
||||
} catch (ReflectionException e) {
|
||||
// ignore, as we cannot throw this exception
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -233,7 +226,7 @@ public abstract class AbstractMBean implements DynamicMBean, MBeanRegistration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Empty implementation, allowing aubclasses to ignore the interface.
|
||||
* Empty implementation, allowing subclasses to ignore the interface.
|
||||
*
|
||||
* <p><b>Note:</b> Make sure any subclass does a super call to this method,
|
||||
* otherwise the implementation might be broken.</p>
|
||||
|
@ -244,7 +237,7 @@ public abstract class AbstractMBean implements DynamicMBean, MBeanRegistration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Empty implementation, allowing aubclasses to ignore the interface.
|
||||
* Empty implementation, allowing subclasses to ignore the interface.
|
||||
*
|
||||
* <p><b>Note:</b> Make sure any subclass does a super call to this method,
|
||||
* otherwise the implementation might be broken.</p>
|
||||
|
@ -255,7 +248,7 @@ public abstract class AbstractMBean implements DynamicMBean, MBeanRegistration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Empty implementation, allowing aubclasses to ignore the interface.
|
||||
* Empty implementation, allowing subclasses to ignore the interface.
|
||||
*
|
||||
* <p><b>Note:</b> Make sure any subclass does a super call to this method,
|
||||
* otherwise the implementation might be broken.</p>
|
||||
|
@ -265,4 +258,15 @@ public abstract class AbstractMBean implements DynamicMBean, MBeanRegistration {
|
|||
public void postDeregister() {
|
||||
this.mbeanServer = null;
|
||||
}
|
||||
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
public Object invoke(String name, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
|
||||
throw new ReflectionException(new NoSuchMethodException(name),
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
|
||||
package org.hyperic.sigar.jmx;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanParameterInfo;
|
||||
import javax.management.ReflectionException;
|
||||
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
@ -303,26 +301,6 @@ public class SigarCpu extends AbstractMBean {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see DynamicMBean#setAttribute(Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see DynamicMBean#invoke(String, Object[], String[])
|
||||
*/
|
||||
public Object invoke(String actionName, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
throw new ReflectionException(new NoSuchMethodException(actionName),
|
||||
actionName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
|
||||
package org.hyperic.sigar.jmx;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanParameterInfo;
|
||||
import javax.management.ReflectionException;
|
||||
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
@ -258,24 +256,6 @@ public class SigarCpuInfo extends AbstractMBean {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#setAttribute(Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#invoke(String, Object[], String[])
|
||||
*/
|
||||
public Object invoke(String actionName, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
throw new ReflectionException(new NoSuchMethodException(actionName),
|
||||
actionName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#getMBeanInfo()
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
|
||||
package org.hyperic.sigar.jmx;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanParameterInfo;
|
||||
import javax.management.ReflectionException;
|
||||
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
@ -305,24 +303,6 @@ public class SigarCpuPerc extends AbstractMBean {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#setAttribute(Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#invoke(String, Object[], String[])
|
||||
*/
|
||||
public Object invoke(String actionName, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
throw new ReflectionException(new NoSuchMethodException(actionName),
|
||||
actionName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see DynamicMBean#getMBeanInfo()
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.hyperic.sigar.jmx;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
|
@ -222,25 +221,6 @@ public class SigarMem extends AbstractMBean {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#invoke(java.lang.String,
|
||||
* java.lang.Object[], java.lang.String[])
|
||||
*/
|
||||
public Object invoke(String actionName, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
throw new ReflectionException(new NoSuchMethodException(actionName),
|
||||
actionName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#getMBeanInfo()
|
||||
|
|
|
@ -23,17 +23,14 @@ import java.util.Iterator;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
import javax.management.MBeanException;
|
||||
import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanParameterInfo;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.ReflectionException;
|
||||
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
@ -182,26 +179,6 @@ public class SigarRegistry extends AbstractMBean {
|
|||
return obj;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#invoke(java.lang.String, java.lang.Object[], java.lang.String[])
|
||||
*/
|
||||
public Object invoke(String action, Object[] params, String[] signatures)
|
||||
throws MBeanException, ReflectionException {
|
||||
|
||||
/* if (MBEAN_OPER_LISTPROCESSES.getName().equals(action))
|
||||
return listProcesses();
|
||||
|
||||
else */
|
||||
throw new ReflectionException(new NoSuchMethodException(action), action);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#getMBeanInfo()
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.hyperic.sigar.jmx;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanConstructorInfo;
|
||||
|
@ -170,25 +169,6 @@ public class SigarSwap extends AbstractMBean {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
|
||||
*/
|
||||
public void setAttribute(Attribute attr) throws AttributeNotFoundException {
|
||||
throw new AttributeNotFoundException(attr.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#invoke(java.lang.String,
|
||||
* java.lang.Object[], java.lang.String[])
|
||||
*/
|
||||
public Object invoke(String actionName, Object[] params, String[] signature)
|
||||
throws ReflectionException {
|
||||
throw new ReflectionException(new NoSuchMethodException(actionName),
|
||||
actionName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.management.DynamicMBean#getMBeanInfo()
|
||||
|
|
Loading…
Reference in New Issue