1 22 package org.jboss.ejb3.test.interceptors2; 23 24 import javax.ejb.EJB ; 25 import javax.annotation.PostConstruct; 26 import javax.interceptor.AroundInvoke; 27 import javax.interceptor.ExcludeDefaultInterceptors; 28 import javax.interceptor.InvocationContext; 29 import javax.ejb.PostActivate ; 30 import javax.annotation.PreDestroy; 31 import javax.ejb.PrePassivate ; 32 import javax.ejb.Remove ; 33 import javax.ejb.Stateful ; 34 35 import org.jboss.annotation.ejb.cache.simple.CacheConfig; 36 37 42 @Stateful 43 @CacheConfig(maxSize = 1) 44 public class InheritingSFSB extends InheritingBaseMiddle implements InheritingSFSBRemote 45 { 46 @EJB 47 StatusRemote status; 48 49 public void method() 50 { 51 System.out.println("method"); 52 } 53 54 @ExcludeDefaultInterceptors 55 public void methodNoDefault() 56 { 57 System.out.println("methodNoDefault"); 58 } 59 60 @Remove 61 public void kill() 62 { 63 System.out.println("kill"); 64 } 65 66 @AroundInvoke 67 public Object intercept(InvocationContext ctx) throws Exception 68 { 69 status.addInterception(new Interception(this, "intercept")); 70 return ctx.proceed(); 71 } 72 73 @PostConstruct 74 void postConstruct() 75 { 76 status.addLifecycle(PostConstruct.class, new Interception(this, "postConstruct")); 77 } 78 79 @PostActivate 80 void postActivate() 81 { 82 status.addLifecycle(PostActivate .class, new Interception(this, "postActivate")); 83 } 84 85 @PrePassivate () 86 void prePassivate() 87 { 88 status.addLifecycle(PrePassivate .class, new Interception(this, "prePassivate")); 89 } 90 91 @PreDestroy() 92 void preDestroy() 93 { 94 status.addLifecycle(PreDestroy.class, new Interception(this, "preDestroy")); 95 } 96 97 public Object intercept2(InvocationContext ctx) throws Exception 98 { 99 throw new RuntimeException ("Should not be called"); 100 } 101 102 void postConstruct2() 103 { 104 throw new RuntimeException ("Should not be called"); 105 } 106 107 void postActivate2() 108 { 109 throw new RuntimeException ("Should not be called"); 110 } 111 112 void prePassivate2() 113 { 114 throw new RuntimeException ("Should not be called"); 115 } 116 117 void preDestroy2() 118 { 119 throw new RuntimeException ("Should not be called"); 120 } 121 122 } 123 | Popular Tags |