1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
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 java.lang.reflect.Method; |
18 | |
import java.net.UnknownHostException; |
19 | |
import java.rmi.Remote; |
20 | |
import java.rmi.RemoteException; |
21 | |
|
22 | |
import javax.ejb.EJBObject; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | 28 | public class EjbConnector extends RmiConnector |
29 | |
{ |
30 | |
|
31 | |
public static final int EJB_SERVICECLASS_INVOCATION_FAILED = 2; |
32 | |
|
33 | |
public String getProtocol() |
34 | |
{ |
35 | 98 | return "ejb"; |
36 | |
} |
37 | |
|
38 | |
public Remote getRemoteObject(UMOImmutableEndpoint endpoint) throws RemoteException, UnknownHostException |
39 | |
{ |
40 | |
EJBObject remoteObj; |
41 | |
|
42 | |
try |
43 | |
{ |
44 | 12 | Object ref = getRemoteRef(endpoint); |
45 | |
|
46 | 12 | Method method = ClassUtils.getMethod(ref.getClass(), "create", null); |
47 | |
|
48 | 12 | remoteObj = (EJBObject)method.invoke(ref, ClassUtils.NO_ARGS); |
49 | |
} |
50 | 0 | catch (Exception e) |
51 | |
{ |
52 | 0 | throw new RemoteException("Remote EJBObject lookup failed for '" + endpoint.getEndpointURI(), e); |
53 | 12 | } |
54 | |
|
55 | 12 | return remoteObj; |
56 | |
} |
57 | |
} |