1 7 package org.jboss.ejb3.dd; 8 9 import java.util.ArrayList ; 10 import java.util.Iterator ; 11 import java.util.List ; 12 13 import org.jboss.logging.Logger; 14 15 24 public class EnterpriseBeans 25 { 26 private static final Logger log = Logger.getLogger(EnterpriseBeans.class); 27 28 private List enterpriseBeans = new ArrayList (); 29 30 private EnterpriseBean currentEjb; 31 32 public void setCurrentEjbName(String currentEjbName) 33 { 34 currentEjb = findEjbByEjbName(currentEjbName); 35 } 36 37 public void updateEjbRef(EjbRef ref) 38 { 39 currentEjb.updateEjbRef(ref); 40 } 41 42 public void updateEjbLocalRef(EjbLocalRef ref) 43 { 44 currentEjb.updateEjbLocalRef(ref); 45 } 46 47 public void updateResourceRef(ResourceRef ref) 48 { 49 currentEjb.updateResourceRef(ref); 50 } 51 52 public void setAopDomainName(String aopDomainName) 53 { 54 currentEjb.setAopDomainName(aopDomainName); 55 } 56 57 public void setRunAsPrincipal(String principal) 58 { 59 currentEjb.setRunAsPrincipal(principal); 60 } 61 62 public void setClusterConfig(ClusterConfig config) 63 { 64 currentEjb.setClusterConfig(config); 65 } 66 67 public void setCallByValue(boolean callByValue) 68 { 69 currentEjb.setCallByValue(callByValue); 70 } 71 72 public void setJndiName(String jndiName) 73 { 74 currentEjb.setJndiName(jndiName); 75 } 76 77 public void setSecurityDomain(String securityDomain) 78 { 79 currentEjb.setSecurityDomain(securityDomain); 80 } 81 82 public void setLocalJndiName(String jndiName) 83 { 84 currentEjb.setLocalJndiName(jndiName); 85 } 86 87 public EnterpriseBean findEjbByEjbName(String ejbName) 88 { 89 Iterator ejbs = enterpriseBeans.iterator(); 90 while (ejbs.hasNext()) 91 { 92 EnterpriseBean ejb = (EnterpriseBean) ejbs.next(); 93 if (ejb.getEjbName().equals(ejbName)) 94 return ejb; 95 } 96 return null; 97 } 98 99 public List <EnterpriseBean> findEjbsByClass(String className) 100 { 101 ArrayList result = new ArrayList (); 102 103 Iterator ejbs = enterpriseBeans.iterator(); 104 while (ejbs.hasNext()) 105 { 106 EnterpriseBean ejb = (EnterpriseBean) ejbs.next(); 107 String ejbClassName = ejb.getEjbClass(); 108 if (ejbClassName != null && ejbClassName.equals(className)) 109 result.add(ejb); 110 } 111 return result; 112 } 113 114 public EnterpriseBean findEjbByRemote(String remote) 115 { 116 Iterator ejbs = enterpriseBeans.iterator(); 117 while (ejbs.hasNext()) 118 { 119 EnterpriseBean ejb = (EnterpriseBean) ejbs.next(); 120 if (ejb.getRemote() != null && ejb.getRemote().equals(remote)) 121 return ejb; 122 } 123 return null; 124 } 125 126 public EnterpriseBean findEjbByLocal(String local) 127 { 128 Iterator ejbs = enterpriseBeans.iterator(); 129 while (ejbs.hasNext()) 130 { 131 EnterpriseBean ejb = (EnterpriseBean) ejbs.next(); 132 if (ejb.getLocal() != null && ejb.getLocal().equals(local)) 133 return ejb; 134 } 135 return null; 136 } 137 138 public List getEnterpriseBeans() 139 { 140 return enterpriseBeans; 141 } 142 143 public void setEnterpriseBeans(List enterpriseBeans) 144 { 145 this.enterpriseBeans = enterpriseBeans; 146 } 147 148 public void addEnterpriseBean(EnterpriseBean ejb) 149 { 150 enterpriseBeans.add(ejb); 151 } 152 153 public String toString() 154 { 155 StringBuffer sb = new StringBuffer (100); 156 sb.append("["); 157 sb.append("enterpriseBeans=").append(enterpriseBeans); 158 sb.append("]"); 159 return sb.toString(); 160 } 161 162 public boolean equals(Object o) 163 { 164 if (this == o) 165 return true; 166 if (!(o instanceof EnterpriseBeans)) 167 return false; 168 169 final EnterpriseBeans ejbs = (EnterpriseBeans) o; 170 171 if (enterpriseBeans != null ? !enterpriseBeans 172 .equals(ejbs.enterpriseBeans) : ejbs.enterpriseBeans != null) 173 return false; 174 175 return true; 176 } 177 178 public int hashCode() 179 { 180 int result; 181 result = (enterpriseBeans != null ? enterpriseBeans.hashCode() : 0); 182 return result; 184 } 185 } 186 | Popular Tags |