1 /*
2 * Created on 11.jul.2003
3 *
4 */
5 package net.sf.panoptes.module.jmx.connector;
6
7 import java.lang.reflect.InvocationHandler;
8 import java.lang.reflect.Method;
9
10 import mx4j.connector.MBeanServerConnection;
11
12 /***
13 * Since MX4J provides their own <code>MBeanServerConnection</code> instead of using
14 * the interface from Sun, we need a proxy.
15 *
16 * @author Dag Liodden
17 * @version 0.1
18 */
19 public class MX4JInvocationHandler implements InvocationHandler {
20
21 private MBeanServerConnection mxConnection;
22
23 public MX4JInvocationHandler(MBeanServerConnection mxConnection) {
24 this.mxConnection = mxConnection;
25 }
26
27 /* (non-Javadoc)
28 * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
29 */
30 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
31
32 Method mxMethod = MBeanServerConnection.class.getMethod(method.getName(), method.getParameterTypes());
33 return mxMethod.invoke(mxConnection, args);
34 }
35
36 }
This page was automatically generated by Maven