KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > remote > rmi > RMIConnectionProxy


1 /*
2  * Copyright (C) MX4J.
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.rmi;
10
11 import java.lang.reflect.InvocationHandler JavaDoc;
12 import java.lang.reflect.Method JavaDoc;
13 import java.lang.reflect.InvocationTargetException JavaDoc;
14
15 import javax.management.remote.rmi.RMIConnection JavaDoc;
16
17 /**
18  * Base class for RMIConnection dynamic proxies.
19  *
20  * @author <a HREF="mailto:biorn_steedom@users.sourceforge.net">Simone Bordet</a>
21  * @version $Revision: 1.3 $
22  */

23 public class RMIConnectionProxy implements InvocationHandler JavaDoc
24 {
25    private RMIConnection JavaDoc nested;
26
27    protected RMIConnectionProxy(RMIConnection JavaDoc nested)
28    {
29       this.nested = nested;
30    }
31
32    public Object JavaDoc invoke(Object JavaDoc proxy, Method JavaDoc method, Object JavaDoc[] args) throws Throwable JavaDoc
33    {
34       try
35       {
36          return method.invoke(nested, args);
37       }
38       catch (InvocationTargetException JavaDoc x)
39       {
40          throw x.getTargetException();
41       }
42    }
43 }
44
Popular Tags