1 29 30 package com.caucho.iiop.orb; 31 32 import java.lang.reflect.*; 33 import java.util.*; 34 35 38 public class IiopProxyHandler implements InvocationHandler { 39 private final HashMap<String ,MethodMarshal> _methodMap 40 = new HashMap<String ,MethodMarshal>(); 41 42 private ORBImpl _orb; 43 private org.omg.CORBA.portable.ObjectImpl _stub; 44 private StubMarshal _stubMarshal; 45 46 IiopProxyHandler(ORBImpl orb, 47 org.omg.CORBA.portable.ObjectImpl stub, 48 StubMarshal stubMarshal) 49 { 50 _orb = orb; 51 _stub = stub; 52 _stubMarshal = stubMarshal; 53 } 54 55 62 public Object invoke(Object proxy, Method method, Object []args) 63 throws Throwable 64 { 65 String methodName = method.getName(); 66 67 MethodMarshal marshal = _stubMarshal.get(method); 68 69 if (marshal != null) { 70 return marshal.invoke(_stub, args); 71 } 72 73 Class []params = method.getParameterTypes(); 74 75 if (methodName.equals("toString") && params.length == 0) 76 return "IiopProxy[" + _orb + "]"; 77 78 throw new RuntimeException ("method not found: " + methodName); 79 } 80 } 81 | Popular Tags |