1 10 11 package org.mule.providers.ejb; 12 13 import org.mule.providers.rmi.RmiConnector; 14 import org.mule.umo.endpoint.UMOImmutableEndpoint; 15 import org.mule.util.ClassUtils; 16 17 import javax.ejb.EJBObject ; 18 import java.lang.reflect.Method ; 19 import java.net.UnknownHostException ; 20 import java.rmi.Remote ; 21 import java.rmi.RemoteException ; 22 23 26 27 public class EjbConnector extends RmiConnector 28 { 29 public static final int EJB_SERVICECLASS_INVOCATION_FAILED = 2; 31 32 public String getProtocol() 33 { 34 return "ejb"; 35 } 36 37 public Remote getRemoteObject(UMOImmutableEndpoint endpoint) throws RemoteException , UnknownHostException 38 { 39 EJBObject remoteObj; 40 41 try 42 { 43 Object ref = getRemoteRef(endpoint); 44 45 Method method = ClassUtils.getMethod("create", null, ref.getClass()); 46 47 remoteObj = (EJBObject )method.invoke(ref, ClassUtils.NO_ARGS); 48 } 49 catch (Exception e) 50 { 51 throw new RemoteException ("Remote EJBObject lookup failed for '" + endpoint.getEndpointURI(), e); 52 } 53 54 return remoteObj; 55 } 56 } 57 | Popular Tags |