Examples of AdviceBinding


Examples of org.jboss.aop.advice.AdviceBinding

   /**
    * Tests the annotation of an aspect factory as @Aspect.
    */
   public void testAspectFactory() throws Exception
   {
      AdviceBinding binding = new AdviceBinding(
            "execution(void *PreparedPOJO->someMethod(..))", null);
      AspectDefinition aspectDefinition = AspectManager.instance()
            .getAspectDefinition(AnnotatedAspectFactory.class.getName());
      assertNotNull(aspectDefinition);
      binding.addInterceptorFactory(new AdviceFactory(aspectDefinition,
            "advice"));
      AspectManager.instance().addBinding(binding);

      PreparedPOJO pojo = new PreparedPOJO();
      pojo.someMethod();
      assertTrue(AnnotatedAspectFactory.isAspectCreated());
      assertTrue(AnnotatedAspectFactory.getAspectCreated().isAdvised());
      AspectManager.instance().removeBinding(binding.getName());
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

      ClassLoader classLoader = new UserDefinedCL(jarURL,
               currentThread.getContextClassLoader());
      currentThread.setContextClassLoader(classLoader);
      Class<?> clazz = Class.forName(INTERCEPTOR_CLASS, false, classLoader);
     
      AdviceBinding binding = new AdviceBinding("userdefinedclbinding",
               "execution(* *->*(..))", null);
      binding.addInterceptor(clazz);
      AspectManager.instance().addBinding(binding);

      Method resetStatus = clazz.getDeclaredMethod("resetInvokeStatus");
      Method getStatus = clazz.getDeclaredMethod("getInvoked");
     
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

      if (manager == null)
         throw new IllegalArgumentException("Null manager");
      if (name == null)
         name = GUID.asString();

      AdviceBinding binding = new AdviceBinding(name, pointcut, cflow);

      if (advices != null)
      {
         for (BindingEntry entry : advices)
         {
            entry.start();
            InterceptorFactory[] factories = entry.getInterceptorFactories();
            for (InterceptorFactory ifac : factories)
            {
               binding.addInterceptorFactory(ifac);
            }
         }
      }
      manager.addBinding(binding);
      log.debug("Bound binding " + name);
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

*/
public class DynamicAspectDeployer
{
   public static String addBinding(String pointcut, Class<?> interceptor) throws ParseException
   {
      AdviceBinding binding = new AdviceBinding(pointcut, null);
      String name = binding.getName();
      binding.addInterceptor(interceptor);
      AspectManager.instance().addBinding(binding);
      return name;
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

   /**
    * Remove an interceptor pointcut with a given name
    */
   public void removeBinding(String name)
   {
      AdviceBinding binding = internalRemoveBinding(name);
      if (binding != null)
      {
         binding.clearAdvisors();
         dynamicStrategy.interceptorChainsUpdated();
      }
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

         int bindSize = binds.size();

         for (int i = 0; i < bindSize; i++)
         {

            AdviceBinding binding = bindings.get(binds.get(i));
            if (binding == null)
            {
               logger.debug("AspectManager.removeBindings() no binding found with name " + binds.get(i));
               continue;
            }
            ArrayList<Advisor> ads = binding.getAdvisors();
            bindingAdvisors.addAll(ads);
            bindings.remove(binding.getName());
            Pointcut pointcut = binding.getPointcut();
            this.removePointcut(pointcut.getName());
            removedBindings.add(binding);
         }
      }
      Iterator<Advisor> it = bindingAdvisors.iterator();
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

    * Add an interceptor pointcut with a given name
    */
   public void addBinding(AdviceBinding binding)
   {
      Set<Advisor> affectedAdvisors = null;
      AdviceBinding removedBinding = null;
      synchronized(this)
      {
         removedBinding = internalRemoveBinding(binding.getName());
         affectedAdvisors = removedBinding == null ? null : new HashSet<Advisor>(removedBinding.getAdvisors());
         initBindingsMap();
         synchronized (bindings)
         {
            bindings.put(binding.getName(), binding);
         }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

    */
   private synchronized AdviceBinding internalRemoveBinding(String name)
   {
      synchronized (bindings)
      {
         AdviceBinding binding = bindings.remove(name);
         if (binding == null)
         {
            return null;
         }
         Pointcut pointcut = binding.getPointcut();
         this.removePointcut(pointcut.getName());
         return binding;
      }
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

         synchronized(this.adviceBindings)
         {
            this.adviceBindings.addAll(classAdvisor.adviceBindings);
            for (Iterator it = this.adviceBindings.iterator() ; it.hasNext() ; )
            {
               AdviceBinding binding = (AdviceBinding)it.next();
               binding.addAdvisor(this);
            }
         }
      }
      super.finalizeChains(newMethodInfos, newFieldReadInfos, newFieldWriteInfos, newConstructorInfos, newConstructionInfos);
   }
View Full Code Here

Examples of org.jboss.aop.advice.AdviceBinding

   /**
    * Remove an interceptor pointcut with a given name
    */
   public synchronized void removeBinding(String name)
   {
      AdviceBinding binding = internalRemoveBinding(name);
      if (binding != null)
      {
         binding.clearAdvisors();
         dynamicStrategy.interceptorChainsUpdated();
      }
   }
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.