1 7 package org.jboss.ejb3.entity; 8 9 import org.jboss.aop.Advisor; 10 import org.jboss.aop.InstanceAdvisor; 11 import org.jboss.aop.joinpoint.Joinpoint; 12 import org.jboss.aop.joinpoint.MethodJoinpoint; 13 14 import javax.persistence.FlushMode; 15 import javax.persistence.FlushMode; 16 17 23 public class FlushModeInterceptorFactory implements org.jboss.aop.advice.AspectFactory 24 { 25 public Object createPerVM() 26 { 27 throw new RuntimeException ("NOT ALLOWED"); 28 } 29 30 public Object createPerClass(Advisor advisor) 31 { 32 throw new RuntimeException ("NOT ALLOWED"); 33 } 34 35 public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor) 36 { 37 throw new RuntimeException ("NOT ALLOWED"); 38 } 39 40 public Object createPerJoinpoint(Advisor advisor, Joinpoint jp) 41 { 42 MethodJoinpoint m = (MethodJoinpoint)jp; 43 FlushMode mode = (FlushMode)advisor.resolveAnnotation(m.getMethod(), FlushMode.class); 44 if (mode == null) throw new RuntimeException ("FLUSH MODE WAS NULL!!!!"); 45 return new FlushModeInterceptor(mode.value()); 46 } 47 48 public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp) 49 { 50 throw new RuntimeException ("NOT ALLOWED"); 51 } 52 53 public String getName() 54 { 55 return getClass().getName(); 56 } 57 } 58 | Popular Tags |