1 25 26 package org.objectweb.easybeans.deployment.annotations.metadata; 27 28 import java.util.List ; 29 import java.util.Map ; 30 31 import javax.ejb.Remove ; 32 import javax.ejb.TransactionAttributeType ; 33 34 import org.objectweb.easybeans.deployment.annotations.InterceptorType; 35 import org.objectweb.easybeans.deployment.annotations.JClassInterceptor; 36 import org.objectweb.easybeans.deployment.annotations.JMethod; 37 import org.objectweb.easybeans.deployment.annotations.impl.JInterceptors; 38 import org.objectweb.easybeans.deployment.annotations.metadata.interfaces.IAnnotationSecurityPermitAll; 39 import org.objectweb.easybeans.deployment.annotations.metadata.interfaces.IAnnotationSecurityRolesAllowed; 40 import org.objectweb.easybeans.deployment.annotations.metadata.interfaces.IEJBInterceptors; 41 import org.objectweb.easybeans.deployment.annotations.metadata.interfaces.ITransactionAttribute; 42 43 47 public class MethodAnnotationMetadata extends CommonAnnotationMetadata 48 implements Cloneable , ITransactionAttribute, IEJBInterceptors, IAnnotationSecurityRolesAllowed, IAnnotationSecurityPermitAll { 49 50 53 55 58 private JMethod jMethod = null; 59 60 63 private ClassAnnotationMetadata classAnnotationMetadata = null; 64 65 66 69 private ClassAnnotationMetadata originalClassAnnotationMetadata = null; 70 71 74 private TransactionAttributeType transactionAttributeType = null; 75 76 79 private Remove remove = null; 80 81 84 private boolean businessMethod = false; 85 86 89 private boolean postConstruct = false; 90 91 94 private boolean preDestroy = false; 95 96 99 private boolean postActivate = false; 100 101 104 private boolean prePassivate = false; 105 106 109 private boolean aroundInvoke = false; 110 111 115 private boolean inherited = false; 116 117 120 private boolean excludeClassInterceptors = false; 121 122 125 private boolean timeout = false; 126 127 132 private List <JClassInterceptor> globalEasyBeansInterceptors = null; 133 134 137 private List <JClassInterceptor> interceptors = null; 138 139 142 private JInterceptors annotationInterceptors = null; 143 144 148 private Map <InterceptorType, List <JClassInterceptor>> userInterceptors = null; 149 150 153 private List <String > rolesAllowed = null; 154 155 158 private boolean permitAll = false; 159 160 163 private boolean denyAll = false; 164 165 166 171 public MethodAnnotationMetadata(final JMethod jMethod, final ClassAnnotationMetadata classAnnotationMetadata) { 172 this.jMethod = jMethod; 173 this.classAnnotationMetadata = classAnnotationMetadata; 174 } 175 176 179 public String getMethodName() { 180 return this.jMethod.getName(); 181 } 182 183 186 public JMethod getJMethod() { 187 return this.jMethod; 188 } 189 190 194 public TransactionAttributeType getTransactionAttributeType() { 195 return transactionAttributeType; 196 } 197 198 203 public void setTransactionAttributeType(final TransactionAttributeType transactionAttributeType) { 204 this.transactionAttributeType = transactionAttributeType; 205 } 206 207 210 public boolean isBusinessMethod() { 211 return businessMethod; 212 } 213 214 218 public void setBusinessMethod(final boolean flag) { 219 this.businessMethod = flag; 220 } 221 222 225 public boolean isLifeCycleMethod() { 226 return isPostActivate() || isPostConstruct() || isPreDestroy() || isPrePassivate(); 227 } 228 229 232 public Remove getJRemove() { 233 return this.remove; 234 } 235 236 240 public void setRemove(final Remove remove) { 241 this.remove = remove; 242 } 243 244 245 246 249 @Override 250 public String toString() { 251 StringBuilder sb = new StringBuilder (); 252 String titleIndent = " "; 253 254 sb.append(titleIndent); 256 sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1)); 257 sb.append("[\n"); 258 259 sb.append(super.toString()); 261 262 concatStringBuilder("jMethod", jMethod, sb); 264 265 concatStringBuilder("inherited", Boolean.valueOf(inherited), sb); 267 268 concatStringBuilder("transactionAttributeType", transactionAttributeType, sb); 270 271 concatStringBuilder("remove", remove, sb); 273 274 concatStringBuilder("businessMethod", Boolean.valueOf(businessMethod), sb); 276 277 concatStringBuilder("aroundInvoke", Boolean.valueOf(aroundInvoke), sb); 279 280 concatStringBuilder("postConstruct", Boolean.valueOf(postConstruct), sb); 282 283 concatStringBuilder("preDestroy", Boolean.valueOf(preDestroy), sb); 285 286 concatStringBuilder("postActivate", Boolean.valueOf(postActivate), sb); 288 289 concatStringBuilder("prePassivate", Boolean.valueOf(prePassivate), sb); 291 292 concatStringBuilder("timeout", Boolean.valueOf(timeout), sb); 294 295 concatStringBuilder("annotationInterceptors", annotationInterceptors, sb); 297 298 concatStringBuilder("interceptors", interceptors, sb); 300 301 concatStringBuilder("rolesAllowed", rolesAllowed, sb); 303 304 concatStringBuilder("permitAll", Boolean.valueOf(permitAll), sb); 306 307 concatStringBuilder("denyAll", Boolean.valueOf(denyAll), sb); 309 310 sb.append(titleIndent); 311 sb.append("]\n"); 312 return sb.toString(); 313 } 314 315 318 public boolean isPostActivate() { 319 return postActivate; 320 } 321 322 326 public void setPostActivate(final boolean postActivate) { 327 this.postActivate = postActivate; 328 } 329 330 333 public boolean isPostConstruct() { 334 return postConstruct; 335 } 336 337 341 public void setPostConstruct(final boolean postConstruct) { 342 this.postConstruct = postConstruct; 343 } 344 345 348 349 public boolean isPreDestroy() { 350 return preDestroy; 351 } 352 353 357 public void setPreDestroy(final boolean preDestroy) { 358 this.preDestroy = preDestroy; 359 } 360 361 364 365 public boolean isPrePassivate() { 366 return prePassivate; 367 } 368 369 373 public void setPrePassivate(final boolean prePassivate) { 374 this.prePassivate = prePassivate; 375 } 376 377 380 public boolean isTimeout() { 381 return timeout; 382 } 383 384 388 public void setTimeout(final boolean timeout) { 389 this.timeout = timeout; 390 } 391 392 395 public boolean isAroundInvoke() { 396 return aroundInvoke; 397 } 398 399 403 public void setAroundInvoke(final boolean aroundInvoke) { 404 this.aroundInvoke = aroundInvoke; 405 } 406 407 410 public boolean isInherited() { 411 return inherited; 412 } 413 414 419 public void setInherited(final boolean inherited, final ClassAnnotationMetadata originalClassAnnotationMetadata) { 420 this.inherited = inherited; 421 this.originalClassAnnotationMetadata = originalClassAnnotationMetadata; 422 } 423 424 427 public boolean isExcludedClassInterceptors() { 428 return excludeClassInterceptors; 429 } 430 431 435 public void setExcludeClassInterceptors(final boolean excludeClassInterceptors) { 436 this.excludeClassInterceptors = excludeClassInterceptors; 437 } 438 439 440 441 444 public ClassAnnotationMetadata getClassAnnotationMetadata() { 445 return classAnnotationMetadata; 446 } 447 448 451 public ClassAnnotationMetadata getOriginalClassAnnotationMetadata() { 452 return originalClassAnnotationMetadata; 453 } 454 455 458 public List <JClassInterceptor> getInterceptors() { 459 return interceptors; 460 } 461 462 467 public void setInterceptors(final List <JClassInterceptor> interceptors) { 468 this.interceptors = interceptors; 469 } 470 471 474 public JInterceptors getAnnotationInterceptors() { 475 return annotationInterceptors; 476 } 477 478 482 public void setAnnotationsInterceptors(final JInterceptors annotationInterceptors) { 483 this.annotationInterceptors = annotationInterceptors; 484 } 485 486 490 public Map <InterceptorType, List <JClassInterceptor>> getUserEasyBeansInterceptors() { 491 return userInterceptors; 492 } 493 494 499 public void setUserInterceptors(final Map <InterceptorType, List <JClassInterceptor>> userInterceptors) { 500 this.userInterceptors = userInterceptors; 501 } 502 503 506 public List <JClassInterceptor> getGlobalEasyBeansInterceptors() { 507 return globalEasyBeansInterceptors; 508 } 509 510 514 public void setGlobalEasyBeansInterceptors(final List <JClassInterceptor> globalEasyBeansInterceptors) { 515 this.globalEasyBeansInterceptors = globalEasyBeansInterceptors; 516 } 517 518 521 @Override 522 public Object clone() { 523 MethodAnnotationMetadata newMethodAnnotationMetadata = new MethodAnnotationMetadata(jMethod, classAnnotationMetadata); 524 newMethodAnnotationMetadata.setAnnotationsInterceptors(annotationInterceptors); 525 newMethodAnnotationMetadata.setAroundInvoke(aroundInvoke); 526 newMethodAnnotationMetadata.setBusinessMethod(businessMethod); 527 newMethodAnnotationMetadata.setExcludeClassInterceptors(excludeClassInterceptors); 528 newMethodAnnotationMetadata.setInherited(inherited, originalClassAnnotationMetadata); 529 newMethodAnnotationMetadata.setInterceptors(interceptors); 530 newMethodAnnotationMetadata.setJAnnotationResource(getJAnnotationResource()); 531 newMethodAnnotationMetadata.setJEjbEJB(getJEjbEJB()); 532 newMethodAnnotationMetadata.setJavaxPersistenceContext(getJavaxPersistenceContext()); 533 newMethodAnnotationMetadata.setJavaxPersistenceUnit(getJavaxPersistenceUnit()); 534 newMethodAnnotationMetadata.setPostActivate(postActivate); 535 newMethodAnnotationMetadata.setPostConstruct(postConstruct); 536 newMethodAnnotationMetadata.setPreDestroy(preDestroy); 537 newMethodAnnotationMetadata.setPrePassivate(prePassivate); 538 newMethodAnnotationMetadata.setRemove(remove); 539 newMethodAnnotationMetadata.setTimeout(timeout); 540 newMethodAnnotationMetadata.setTransactionAttributeType(transactionAttributeType); 541 newMethodAnnotationMetadata.setUserInterceptors(userInterceptors); 542 newMethodAnnotationMetadata.setGlobalEasyBeansInterceptors(globalEasyBeansInterceptors); 543 newMethodAnnotationMetadata.setDenyAll(denyAll); 544 newMethodAnnotationMetadata.setPermitAll(permitAll); 545 newMethodAnnotationMetadata.setRolesAllowed(rolesAllowed); 546 return newMethodAnnotationMetadata; 547 } 548 549 550 554 public void setClassAnnotationMetadata(final ClassAnnotationMetadata classAnnotationMetadata) { 555 this.classAnnotationMetadata = classAnnotationMetadata; 556 } 557 558 562 public void setRolesAllowed(final List <String > rolesAllowed) { 563 this.rolesAllowed = rolesAllowed; 564 } 565 566 569 public List <String > getRolesAllowed() { 570 return rolesAllowed; 571 } 572 573 577 public void setPermitAll(final boolean permitAll) { 578 this.permitAll = permitAll; 579 } 580 581 584 public boolean hasPermitAll() { 585 return permitAll; 586 } 587 588 592 public void setDenyAll(final boolean denyAll) { 593 this.denyAll = denyAll; 594 } 595 596 599 public boolean hasDenyAll() { 600 return denyAll; 601 } 602 } 603 | Popular Tags |