1 15 16 package com.jdon.bussinessproxy.meta; 17 18 22 23 public class EJBTargetMetaDef extends DistributedTargetMetaDef { 24 25 private boolean isLocal = true; 26 27 private String home; 28 29 private String remote; 30 31 private String local; 32 33 36 public EJBTargetMetaDef(String name, String p_jndiName, 37 String p_homeClassName, String p_remoteClassName) { 38 super(name, p_jndiName); 39 this.home = p_homeClassName; 40 this.remote = p_remoteClassName; 41 this.isLocal = false; 42 } 43 44 47 public EJBTargetMetaDef(String name, String p_jndiName, 48 String p_localClassName) { 49 super(name, p_jndiName); 50 this.local = p_localClassName; 51 } 52 53 public boolean isEJB() { 54 return true; 55 } 56 57 public boolean isLocal() { 58 return isLocal; 59 } 60 61 public Class getHomeClass() { 62 try { 63 return Class.forName(home); 64 } catch (ClassNotFoundException ex) { 65 throw new RuntimeException ("Unable to load the class : " + home); 66 } 67 } 68 69 public Class getRemoteClass() { 70 try { 71 return Class.forName(remote); 72 } catch (ClassNotFoundException ex) { 73 throw new RuntimeException ("Unable to load the class : " + remote); 74 } 75 } 76 77 public String getClassName() { 78 if (isLocal) 79 return getLocalName(); 80 else 81 return getRemoteName(); 82 83 } 84 85 public String getLocalName() { 86 return local; 87 } 88 89 public String getRemoteName() { 90 return remote; 91 } 92 93 public String getHomeName() { 94 return home; 95 } 96 97 public boolean equals(Object obj) { 98 if (obj instanceof EJBTargetMetaDef) { 99 EJBTargetMetaDef definition = (EJBTargetMetaDef) obj; 100 if (isLocal) { 101 if (!(definition.getLocalName().equals(local)) 102 || !(definition.getJndiName().equals(jndiName))) 103 return false; 104 105 } else { 106 if (!(definition.getHomeName().equals(home)) 107 || !(definition.getJndiName().equals(jndiName)) 108 || !(definition.getRemoteName().equals(remote))) 109 return false; 110 } 111 return true; 112 } 113 return false; 114 } 115 116 public String toString() { 117 StringBuffer buffer = new StringBuffer ("EJB"); 118 buffer.append(jndiName); 119 buffer.append("Home/Local class :"); 120 if (isLocal) 121 buffer.append(local); 122 else 123 buffer.append(home); 124 125 return buffer.toString(); 126 } 127 128 public int hashCode() { 129 return jndiName.hashCode(); 130 } 131 132 135 public String getName() { 136 return name; 137 } 138 139 143 public void setName(String name) { 144 this.name = name; 145 } 146 147 151 public String getCacheKey() { 152 return jndiName; 153 } 154 155 } 156 | Popular Tags |