1 22 package org.jboss.aop.microcontainer.beans; 23 24 import org.jboss.aop.Advisor; 25 import org.jboss.aop.InstanceAdvisor; 26 import org.jboss.aop.advice.AspectFactory; 27 import org.jboss.aop.joinpoint.Joinpoint; 28 import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory; 29 import org.jboss.logging.Logger; 30 31 37 public class GenericBeanAspectFactory implements AspectFactory 38 { 39 private static final Logger log = Logger.getLogger(GenericBeanAspectFactory.class); 40 41 protected GenericBeanFactory factory; 42 43 protected String name; 44 45 public GenericBeanAspectFactory(String name, GenericBeanFactory factory) 46 { 47 this.name = name; 48 this.factory = factory; 49 } 50 51 public void setBeanFactory(GenericBeanFactory factory) 52 { 53 this.factory = factory; 54 } 55 56 public String getName() 57 { 58 return name; 59 } 60 61 public Object createPerVM() 62 { 63 return doCreate(); 64 } 65 66 public Object createPerClass(Advisor advisor) 67 { 68 return doCreate(); 69 } 70 71 public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor) 72 { 73 return doCreate(); 74 } 75 76 public Object createPerJoinpoint(Advisor advisor, Joinpoint jp) 77 { 78 return doCreate(); 79 } 80 81 public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp) 82 { 83 return doCreate(); 84 } 85 86 protected Object doCreate() 87 { 88 try 89 { 90 log.debug("Creating advice " + name); 91 return factory.createBean(); 92 } 93 catch (Throwable throwable) 94 { 95 throw new RuntimeException (throwable); 96 } 97 } 98 } 99 | Popular Tags |