Examples of AdviceFactory


Examples of org.jboss.aop.advice.AdviceFactory

  
   protected void addAspectBinding(AspectManager manager, int index, Scope scope, String aspectClass, String adviceName, String pointcut) throws ParseException
   {
      AspectDefinition def = new AspectDefinition("aspect" + index, scope, new GenericAspectFactory(aspectClass, null));
     
      InterceptorFactory advice = (adviceName != null) ? new AdviceFactory(def, "advice") : new ScopedInterceptorFactory(def);
      PointcutExpression pc = new PointcutExpression("pc2" + index, pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("binding" + index, pc, null, null, interceptors);

      manager.addAspectDefinition(def);
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

      domain.addInterfaceIntroduction(intro);

     
      AspectDefinition def = new AspectDefinition("aspect", Scope.PER_VM, new GenericAspectFactory(EchoInterceptor.class.getName(), null));
      domain.addAspectDefinition(def);
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      domain.addInterceptorFactory(advice.getName(), advice);
      //PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(java.lang.String $instanceof{" + POJO.class.getName() + "}->helloWorld(..))");
      {
      PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(java.lang.String " + POJO.class.getName() + "->helloWorld(..))");
      domain.addPointcut(pointcut);
      InterceptorFactory[] interceptors = {advice};
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

   public void testContainerProxyWithFinalMethods() throws Exception
   {
      InstanceDomain domain = new InstanceDomain(AspectManager.instance(), "test", false);
      AspectDefinition def = new AspectDefinition("aspect", Scope.PER_VM, new GenericAspectFactory(EchoInterceptor.class.getName(), null));
      domain.addAspectDefinition(def);
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      domain.addInterceptorFactory(advice.getName(), advice);
      {
      PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(* " + POJOWithFinalMethods.class.getName() + "->*(..))");
      domain.addPointcut(pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("pojo-binding", pointcut, null, null, interceptors);
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

  
   public void testProxyWithPerInstanceAspects() throws Exception
   {
      AspectManager manager = AspectManager.instance();
      AspectDefinition def = new AspectDefinition("perinstanceaspect", Scope.PER_INSTANCE, new GenericAspectFactory(TestInterceptor.class.getName(), null));
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      PointcutExpression pointcut = new PointcutExpression("perinstancepointcut", "execution(* $instanceof{" + SomeInterface.class.getName() + "}->*(..))");
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("perinstancebinding", pointcut, null, null, interceptors);
      try
      {
         manager.addAspectDefinition(def);
         manager.addInterceptorFactory(advice.getName(), advice);
         manager.addPointcut(pointcut);
         manager.addBinding(binding);
        
         AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
         params.setInterfaces(new Class[] {SomeInterface.class});
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

   public void testProxyWithPerJoinpointAspects() throws Exception
   {
      AspectManager manager = AspectManager.instance();
      AspectDefinition def = new AspectDefinition("perinstanceaspect", Scope.PER_JOINPOINT, new GenericAspectFactory(TestInterceptor.class.getName(), null));
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      PointcutExpression pointcut = new PointcutExpression("perinstancepointcut", "execution(* $instanceof{" + SomeInterface.class.getName() + "}->*(..))");
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("perinstancebinding", pointcut, null, null, interceptors);
      try
      {
         manager.addAspectDefinition(def);
         manager.addInterceptorFactory(advice.getName(), advice);
         manager.addPointcut(pointcut);
         manager.addBinding(binding);
        
         AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
         params.setInterfaces(new Class[] {SomeInterface.class});
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

  
   public void testProxyWithMetaData() throws Exception
   {
      AspectManager manager = AspectManager.instance();
      AspectDefinition def = new AspectDefinition("aspect", Scope.PER_INSTANCE, new GenericAspectFactory(TestInterceptor.class.getName(), null));
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(* " + Annotation.class.getName() + "->*(..))");
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("binding", pointcut, null, null, interceptors);
      try
      {
         manager.addAspectDefinition(def);
         manager.addInterceptorFactory(advice.getName(), advice);
         manager.addPointcut(pointcut);
         manager.addBinding(binding);
        
         AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
         params.setTarget(new POJO());
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

         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);
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

      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;
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

         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);
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceFactory

/*     */     }
/*  98 */     if (this.aspect == null)
/*     */     {
/* 100 */       throw new IllegalArgumentException("Null aspect");
/*     */     }
/* 102 */     this.interceptorFactory = (this.aspectMethod == null ? new ScopedInterceptorFactory(this.aspect.getDefinition()) : new AdviceFactory(this.aspect.getDefinition(), this.aspectMethod));
/*     */
/* 105 */     this.manager.addInterceptorFactory(this.name, this.interceptorFactory);
/* 106 */     if (this.binding != null)
/*     */     {
/* 108 */       this.aspect.addBinding(this.binding);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.