public InterceptorFactory deployAdvice(Element element, AdviceType type) throws Exception { String name = element.getAttribute("name"); String aspect = element.getAttribute("aspect"); if(aspect == null || aspect.length() < 1) throw new RuntimeException("Aspect couldnt be found for element: "+element.getNodeName()+", typo perhaps?"); AspectDefinition def = manager.getAspectDefinition(aspect); if (def == null) throw new RuntimeException("advice " + name + " cannot find aspect " + aspect); AdviceFactory factory = null; if (type == null) { // use default advice type factory = new AdviceFactory(def, name); } else { factory = new AdviceFactory(def, name, type); } manager.addInterceptorFactory(factory.getName(), factory); return factory; }
manager.addInterceptorFactory(name, factory);
public void deployInterceptor(AspectAnnotationLoader loader, boolean isFactory, String name, Scope scope) { deployAspect(loader, isFactory, name, scope); AspectDefinition def = loader.getAspectManager().getAspectDefinition(name); ScopedInterceptorFactory factory = new ScopedInterceptorFactory(def); loader.getAspectManager().addInterceptorFactory(factory.getName(), factory); }
public void deployAspectMethodBinding( AspectAnnotationLoader loader, org.jboss.aop.advice.AdviceType internalAdviceType, String aspectDefName, String methodName, String bindingName, String pointcutString, String cflow, ASTCFlowExpression cflowExpression)throws Exception { AspectDefinition def = loader.getAspectManager().getAspectDefinition(aspectDefName); AdviceFactory factory = null; if (internalAdviceType == org.jboss.aop.advice.AdviceType.AROUND) { factory = new AdviceFactory(def, methodName); } else { factory = new AdviceFactory(def, methodName, internalAdviceType); } loader.getAspectManager().addInterceptorFactory(factory.getName(), factory); InterceptorFactory[] fact = {factory}; PointcutExpression pointcut = new PointcutExpression(bindingName, pointcutString); AdviceBinding abinding = new AdviceBinding(bindingName, pointcut, cflowExpression, cflow, fact); loader.getAspectManager().addBinding(abinding); }