1 16 17 package org.springframework.remoting.rmi; 18 19 import java.lang.reflect.InvocationTargetException ; 20 import java.rmi.RemoteException ; 21 22 import org.springframework.remoting.support.RemoteInvocation; 23 import org.springframework.util.Assert; 24 25 36 class RmiInvocationWrapper implements RmiInvocationHandler { 37 38 private final Object wrappedObject; 39 40 private final RmiBasedExporter rmiExporter; 41 42 43 48 public RmiInvocationWrapper(Object wrappedObject, RmiBasedExporter rmiExporter) { 49 Assert.notNull(wrappedObject, "Object to wrap is required"); 50 Assert.notNull(rmiExporter, "RMI exporter is required"); 51 this.wrappedObject = wrappedObject; 52 this.rmiExporter = rmiExporter; 53 } 54 55 56 60 public String getTargetInterfaceName() { 61 Class ifc = this.rmiExporter.getServiceInterface(); 62 return (ifc != null ? ifc.getName() : null); 63 } 64 65 69 public Object invoke(RemoteInvocation invocation) 70 throws RemoteException , NoSuchMethodException , IllegalAccessException , InvocationTargetException { 71 72 return this.rmiExporter.invoke(invocation, this.wrappedObject); 73 } 74 75 } 76 | Popular Tags |