1 22 package org.jboss.ejb3.metamodel; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 import java.util.Collection ; 27 import java.util.HashSet ; 28 import javax.ejb.TransactionManagementType ; 29 import org.jboss.logging.Logger; 30 31 import org.jboss.metamodel.descriptor.EnvironmentRefGroup; 32 import org.jboss.metamodel.descriptor.InjectionTarget; 33 import org.jboss.metamodel.descriptor.MessageDestinationRef; 34 import org.jboss.metamodel.descriptor.PersistenceUnitRef; 35 import org.jboss.metamodel.descriptor.ResourceEnvRef; 36 import org.jboss.metamodel.descriptor.ResourceRef; 37 import org.jboss.metamodel.descriptor.PersistenceContextRef; 38 39 46 public abstract class EnterpriseBean 47 extends EnvironmentRefGroup implements Injectable 48 { 49 private static final Logger log = Logger.getLogger(EnterpriseBean.class); 50 51 public static final String BEAN = "Bean"; 52 53 public static final String CONTAINER = "Container"; 54 55 private String ejbName = null; 57 58 private String home = null; 59 60 private String remote = null; 61 62 private String localHome = null; 63 64 private String local = null; 65 66 private String ejbClass = null; 67 68 private List <RemoteBinding> remoteBindings = new ArrayList (); 69 70 private SecurityIdentity securityIdentity; 71 72 protected TransactionManagementType tmType = null; 73 74 private String jndiName; 76 77 private String localJndiName; 78 79 private String securityDomain; 80 81 private boolean callByValue = false; 82 83 private String aopDomainName = null; 84 85 private MethodAttributes methodAttributes = null; 86 87 private Collection <String > dependencies = new HashSet <String >(); 88 89 private Collection <InjectionTarget> ignoreDependencies = new HashSet <InjectionTarget>(); 90 91 private Collection <XmlAnnotation> xmlAnnotations = new HashSet <XmlAnnotation>(); 92 93 private PoolConfig poolConfig = null; 94 95 public void addXmlAnnotation(XmlAnnotation annotation) 96 { 97 xmlAnnotations.add(annotation); 98 } 99 100 public Collection <XmlAnnotation> getXmlAnnotations() 101 { 102 return xmlAnnotations; 103 } 104 105 public void setPoolConfig(PoolConfig poolConfig) 106 { 107 this.poolConfig = poolConfig; 108 } 109 110 public PoolConfig getPoolConfig() 111 { 112 return poolConfig; 113 } 114 115 public void addRemoteBinding(RemoteBinding binding) 116 { 117 remoteBindings.add(binding); 118 } 119 120 public List <RemoteBinding> getRemoteBindings() 121 { 122 return remoteBindings; 123 } 124 125 public void addDependency(String depends) 126 { 127 dependencies.add(depends); 128 } 129 130 public Collection <String > getDependencies() 131 { 132 return dependencies; 133 } 134 135 public void addIgnoreDependency(InjectionTarget ignore) 136 { 137 ignoreDependencies.add(ignore); 138 } 139 140 public Collection <InjectionTarget> getIgnoreDependencies() 141 { 142 return ignoreDependencies; 143 } 144 145 public void mergeMessageDestinationRef(MessageDestinationRef ref) 146 { 147 MessageDestinationRef tmpRef = (MessageDestinationRef)messageDestinationRefs.get(ref.getMessageDestinationRefName()); 148 if (tmpRef != null) 149 tmpRef.merge(ref); 150 } 151 152 public void mergeResourceRef(ResourceRef ref) 153 { 154 ResourceRef tmpRef = (ResourceRef)resourceRefs.get(ref.getResRefName()); 155 if (tmpRef != null) 156 tmpRef.merge(ref); 157 } 158 159 public void mergeResourceEnvRef(ResourceEnvRef ref) 160 { 161 ResourceEnvRef tmpRef = (ResourceEnvRef)resourceEnvRefs.get(ref.getResRefName()); 162 if (tmpRef != null) 163 tmpRef.merge(ref); 164 } 165 166 public void setMethodAttributes(MethodAttributes methodAttributes) 167 { 168 this.methodAttributes = methodAttributes; 169 } 170 171 public MethodAttributes getMethodAttributes() 172 { 173 return methodAttributes; 174 } 175 176 public void setAopDomainName(String aopDomainName) 177 { 178 this.aopDomainName = aopDomainName; 179 } 180 181 public String getAopDomainName() 182 { 183 return aopDomainName; 184 } 185 186 public void setRunAsPrincipal(String principal) 187 { 188 if (securityIdentity != null) 189 securityIdentity.setRunAsPrincipal(principal); 190 } 191 192 public void setCallByValue(boolean callByValue) 193 { 194 this.callByValue = callByValue; 195 } 196 197 public boolean isCallByValue() 198 { 199 return callByValue; 200 } 201 202 public String getSecurityDomain() 203 { 204 return securityDomain; 205 } 206 207 public void setSecurityDomain(String securityDomain) 208 { 209 this.securityDomain = securityDomain; 210 } 211 212 public String getJndiName() 213 { 214 return jndiName; 215 } 216 217 public void setJndiName(String jndiName) 218 { 219 this.jndiName = jndiName; 220 } 221 222 public String getLocalJndiName() 223 { 224 return localJndiName; 225 } 226 227 public void setLocalJndiName(String localJndiName) 228 { 229 this.localJndiName = localJndiName; 230 } 231 232 public TransactionManagementType getTransactionManagementType() 233 { 234 return tmType; 235 } 236 237 public void setTransactionManagementType(String transactionType) 238 { 239 if (transactionType.equals(BEAN)) 240 tmType = TransactionManagementType.BEAN; 241 else if (transactionType.equals(CONTAINER)) 242 tmType = TransactionManagementType.CONTAINER; 243 } 244 245 public boolean isSessionBean() 246 { 247 return this instanceof SessionEnterpriseBean; 248 } 249 250 public boolean isConsumer() 251 { 252 return this instanceof Consumer; 253 } 254 255 public boolean isEntityBean() 256 { 257 return this instanceof EntityEnterpriseBean; 258 } 259 260 public boolean isMessageDrivenBean() 261 { 262 return this instanceof MessageDrivenBean; 263 } 264 265 public boolean isService() 266 { 267 return this instanceof Service; 268 } 269 270 public String getEjbName() 271 { 272 return ejbName; 273 } 274 275 public void setEjbName(String ejbName) 276 { 277 this.ejbName = ejbName; 278 } 279 280 public String getHome() 281 { 282 return home; 283 } 284 285 public void setHome(String home) 286 { 287 this.home = home; 288 } 289 290 public String getRemote() 291 { 292 return remote; 293 } 294 295 public void setRemote(String remote) 296 { 297 this.remote = remote; 298 } 299 300 public String getLocalHome() 301 { 302 return localHome; 303 } 304 305 public void setLocalHome(String localHome) 306 { 307 this.localHome = localHome; 308 } 309 310 public String getLocal() 311 { 312 return local; 313 } 314 315 public void setLocal(String local) 316 { 317 this.local = local; 318 } 319 320 public String getEjbClass() 321 { 322 return ejbClass; 323 } 324 325 public void setEjbClass(String ejbClass) 326 { 327 this.ejbClass = ejbClass; 328 } 329 330 public SecurityIdentity getSecurityIdentity() 331 { 332 return securityIdentity; 333 } 334 335 public void setSecurityIdentity(SecurityIdentity securityIdentity) 336 { 337 this.securityIdentity = securityIdentity; 338 } 339 340 public String toString() 341 { 342 StringBuffer sb = new StringBuffer (100); 343 sb.append("ejbName=").append(ejbName); 344 sb.append(",remoteBindings=").append(remoteBindings); 345 sb.append(",jndiName=").append(jndiName); 346 sb.append(",local=").append(local); 347 sb.append(",remote=").append(remote); 348 sb.append(",home=").append(home); 349 sb.append(",localHome=").append(localHome); 350 sb.append(",ejbClass=").append(ejbClass); 351 sb.append(",ejbRefs=").append(ejbRefs); 352 sb.append(",ejbLocalRefs=").append(ejbLocalRefs); 353 sb.append(",resourceRefs=").append(resourceRefs); 354 sb.append(",resourceEnvRefs=").append(resourceEnvRefs); 355 sb.append(",methodAttributes=").append(methodAttributes); 356 sb.append(",aopDomainName=").append(aopDomainName); 357 sb.append(",dependencies=").append(dependencies); 358 return sb.toString(); 359 } 360 361 } 362 | Popular Tags |