Package org.jboss.aop.advice

Examples of org.jboss.aop.advice.AdviceBinding


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


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

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

   public synchronized void removeBinding(String name)
   {
      lock.lockWrite();
      try
      {
         AdviceBinding binding = internalRemoveBinding(name);
         if (binding != null)
         {
            binding.clearAdvisors();
            dynamicStrategy.interceptorChainsUpdated();
         }
      }
      finally
      {
View Full Code Here

    * Add an interceptor pointcut with a given name
    */
   public void addBinding(AdviceBinding binding)
   {
      Set<Advisor> affectedAdvisors = null;
      AdviceBinding removedBinding = null;
      // this locked variable is used in order to avoid breaking the try finally block in two pieces
      boolean locked = false;
      try
      {
         // EXTREMELY IMPORTANT: get this' lock before the bindingCollection's, or
         // we will end up with a deadlock
         synchronized(this)
         {
            lock.lockWrite();
            locked = true;
            removedBinding = internalRemoveBinding(binding.getName());
            affectedAdvisors = removedBinding == null ? null : new HashSet<Advisor>(removedBinding.getAdvisors());        
            bindingCollection.add(binding, this);
         }
         synchronized (advisors)
         {
            Set<Advisor> handledAdvisors = new HashSet<Advisor>();
View Full Code Here

    * Removes an AdviceBinding without notifying dynamic aop strategy.
    * @param name the binding to be removed.
    */
   private synchronized AdviceBinding internalRemoveBinding(String name)
   {
      AdviceBinding binding = bindingCollection.removeBinding(name);
      if (binding == null)
      {
         return null;
      }
      Pointcut pointcut = binding.getPointcut();
      this.removePointcut(pointcut.getName());
      return binding;
   }
View Full Code Here

   private void simplePopulateBindings(ArrayList<AdviceBinding> applicableBindings)
   {
      int size = bindings.size();
      for (int i = 0 ; i < size ; i++)
      {
         AdviceBinding binding = bindings.get(i);
         applyBinding(applicableBindings, binding);
      }
   }
View Full Code Here

      if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " all bindings");
      int size = bindings.size();
      int minMatchLevel = 1000000;
      for (int i = 0 ; i < size ; i++)
      {
         AdviceBinding binding = bindings.get(i);
         PointcutMethodMatch match = pointcutMethodMatches.get(i);
         if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug(match.getMatchLevel() + " " + match.getMatchedClass().getName() + " " + binding.getPointcut().getExpr() + " : " + binding.getInterceptorFactories().length);
        
         if (minMatchLevel > match.getMatchLevel() && !match.isInstanceOf())
         {
            minMatchLevel = match.getMatchLevel();
         }
      }

      if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " actual bindings");
      for (int i = 0 ; i < size ; i++)
      {
         AdviceBinding binding = bindings.get(i);
         PointcutMethodMatch match = pointcutMethodMatches.get(i);
        
         if (match.isInstanceOf() || match.getMatchLevel() == minMatchLevel)
         {
            if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug(match.getMatchLevel() + " " + match.getMatchedClass().getName() + " " + binding.getPointcut().getExpr() + " : " + binding.getInterceptorFactories().length);
            applyBinding(applicableBindings, binding);
         }
      }
   }
View Full Code Here

      }
     
      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

   {
      InterceptorFactory factory = loader.getAspectManager().getInterceptorFactory(name);
      InterceptorFactory[] inters = {factory};
      Pointcut p = null;
      p = new PointcutExpression(name, pointcutString);
      AdviceBinding binding = new AdviceBinding(name, p, cflowExpression, cflow, inters);
      loader.getAspectManager().addBinding(binding);

   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.advice.AdviceBinding

Copyright © 2018 www.massapicom. 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.