1 22 package org.jboss.test.aop.jdk15.annotated; 23 24 import org.jboss.aop.Aspect; 25 import org.jboss.aop.Advisor; 26 import org.jboss.aop.InstanceAdvisor; 27 import org.jboss.aop.advice.AspectFactory; 28 import org.jboss.aop.advice.Scope; 29 import org.jboss.aop.joinpoint.Joinpoint; 30 31 35 @Aspect (scope = Scope.PER_VM) 36 public class AnnotatedAspectFactory implements AspectFactory 37 { 38 public static final String NAME = "Annotated Aspect Factory"; 39 private static AspectFromFactory aspectCreated = null; 40 41 public Object createPerVM() 42 { 43 aspectCreated = new AspectFromFactory(); 44 return aspectCreated; 45 } 46 47 public Object createPerClass(Advisor advisor) 48 { 49 throw new RuntimeException ("Invalid scope PER_CLASS"); 50 } 51 52 public Object createPerInstance(Advisor advisor, 53 InstanceAdvisor instanceAdvisor) 54 { 55 throw new RuntimeException ("Invalid scope PER_INSTANCE"); 56 } 57 58 public Object createPerJoinpoint(Advisor advisor, Joinpoint jp) 59 { 60 throw new RuntimeException ("Invalid scope PER_JOINPOINT"); 61 } 62 63 public Object createPerJoinpoint(Advisor advisor, 64 InstanceAdvisor instanceAdvisor, Joinpoint jp) 65 { 66 throw new RuntimeException ("Invalid scope PER_JOINPOINT"); 67 } 68 69 public String getName() 70 { 71 return NAME; 72 } 73 74 public static boolean isAspectCreated() 75 { 76 return aspectCreated != null; 77 } 78 79 static AspectFromFactory getAspectCreated() 80 { 81 return aspectCreated; 82 } 83 84 } | Popular Tags |