User: user57
Date: 01/07/19 22:08:56
Modified:src/main/org/jboss/util MBeanProxy.java
Log:
o cleaned up added javadoc
o added methods that take a MBeanServer
o decoding a few more jmx exceptions
Revision ChangesPath
1.6 +131 -36 jboss/src/main/org/jboss/util/MBeanProxy.java
Index: MBeanProxy.java
===
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/MBeanProxy.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MBeanProxy.java 2001/06/18 20:01:28 1.5
+++ MBeanProxy.java 2001/07/20 05:08:56 1.6
@@ -6,23 +6,27 @@
*/
package org.jboss.util;
-import java.io.*;
-import java.net.*;
import java.lang.reflect.Method;
-import javax.management.*;
-import javax.management.loading.MLet;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeErrorException;
-import org.jboss.logging.Log;
import org.jboss.proxy.Proxy;
import org.jboss.proxy.InvocationHandler;
/**
- * description
+ * A factory for producing MBean proxies.
*
- * @see related
- * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
- * @version $Revision: 1.5 $
+ * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
+ * @author a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
+ * @version $Revision: 1.6 $
*/
public class MBeanProxy
implements InvocationHandler
@@ -30,60 +34,151 @@
// Constants -
// Attributes
- ObjectName name;
- MBeanServer server;
+
+ /** The server to proxy invoke calls to. */
+ private final MBeanServer server;
+
+ /** The name of the object to invoke. */
+ private final ObjectName name;
// Static
- public static Object create(Class intf, String name)
+
+ /**
+* Create an MBean proxy.
+*
+* @param intfThe interface which the proxy will implement.
+* @param nameA string used to construct the ObjectName of the
+*MBean to proxy to.
+* @returnA MBean proxy.
+*
+* @throws MalformedObjectNameExceptionInvalid object name.
+*/
+ public static Object create(final Class intf, final String name)
+ throws MalformedObjectNameException
+ {
+ return Proxy.newProxyInstance(intf.getClassLoader(),
+new Class[] { intf },
+new MBeanProxy(new ObjectName(name)));
+ }
+
+ /**
+* Create an MBean proxy.
+*
+* @param intf The interface which the proxy will implement.
+* @param name A string used to construct the ObjectName of the
+* MBean to proxy to.
+* @param serverThe MBeanServer that contains the MBean to proxy to.
+* @return A MBean proxy.
+*
+* @throws MalformedObjectNameExceptionInvalid object name.
+*/
+ public static Object create(final Class intf,
+ final String name,
+ final MBeanServer server)
throws MalformedObjectNameException
{
+ return Proxy.newProxyInstance
+ (intf.getClassLoader(),
+ new Class[] { intf },
+ new MBeanProxy(new ObjectName(name), server));
+ }
+
+ /**
+* Create an MBean proxy.
+*
+* @param intfThe interface which the proxy will implement.
+* @param nameThe name of the MBean to proxy invocations to.
+* @returnA MBean proxy.
+*/
+ public static Object create(final Class intf, final ObjectName name)
+ {
return Proxy.newProxyInstance(intf.getClassLoader(),
- new Class[] { intf },
- new MBeanProxy(name));
+new Class[] { intf },
+new MBeanProxy(name));
}
- public static Object create(Class intf, ObjectName name)
+ /**
+* Create an MBean proxy.
+*
+* @param intf The interface which the proxy will implement.
+* @param name The name of the MBean to proxy invocations to.
+* @param serverThe MBeanServer that contains the MBean to proxy to.
+* @return A