KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > remote > ClientProxy


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.remote;
10
11 import java.lang.reflect.InvocationHandler JavaDoc;
12 import java.lang.reflect.InvocationTargetException JavaDoc;
13 import java.lang.reflect.Method JavaDoc;
14 import javax.management.MBeanServerConnection JavaDoc;
15
16 /**
17  * @version $Revision: 1.3 $
18  */

19 public class ClientProxy implements InvocationHandler JavaDoc
20 {
21    private final MBeanServerConnection JavaDoc target;
22
23    protected ClientProxy(MBeanServerConnection JavaDoc target)
24    {
25       this.target = target;
26    }
27
28    public Object JavaDoc invoke(Object JavaDoc proxy, Method JavaDoc method, Object JavaDoc[] args) throws Throwable JavaDoc
29    {
30       try
31       {
32          return method.invoke(target, args);
33       }
34       catch (InvocationTargetException JavaDoc x)
35       {
36          throw x.getTargetException();
37       }
38    }
39 }
40
Popular Tags