1 28 29 package com.caucho.ejb.protocol; 30 31 import javax.ejb.EJBHome ; 32 import java.rmi.RemoteException ; 33 34 37 public class HomeHandleImpl extends AbstractHomeHandle { 38 protected String serverId; 39 protected transient EJBHome home; 40 41 44 public HomeHandleImpl() {} 45 46 51 public HomeHandleImpl(String url) 52 { 53 if (url.endsWith("/")) 54 url = url.substring(url.length() - 1); 55 56 this.serverId = url; 57 } 58 59 64 public HomeHandleImpl(EJBHome home, String url) 65 { 66 this(url); 67 68 this.home = home; 69 } 70 71 public EJBHome getEJBHome() 72 throws RemoteException 73 { 74 if (home == null) 75 home = SameJVMClientContainer.find(serverId).getEJBHome(); 76 77 return home; 78 } 79 80 83 public String getServerId() 84 { 85 return serverId; 86 } 87 88 public String getURL(String protocol) 89 { 90 return serverId; 91 } 92 93 96 public int hashCode() 97 { 98 return serverId.hashCode(); 99 } 100 101 104 public boolean equals(Object o) 105 { 106 if (o == null || ! o.getClass().equals(getClass())) 107 return false; 108 109 HomeHandleImpl handle = (HomeHandleImpl) o; 110 111 return serverId.equals(handle.serverId); 112 } 113 } 114 | Popular Tags |