Package org.jboss.aop.advice

Examples of org.jboss.aop.advice.InterceptorFactory


   }

   @Override
   public InterceptorFactory getInterceptorFactory(String name)
   {
      InterceptorFactory factory = null;
      if (parentFirst)
      {
         factory = parent.getInterceptorFactory(name);
         if (factory != null) return factory;
      }
View Full Code Here


         {
            Element interceptorElement = (Element) children2.item(j);
            String tag2 = interceptorElement.getTagName();
            if (tag2.equals("interceptor"))
            {
               InterceptorFactory factory = deployInterceptor(interceptorElement);
               interceptors.add(factory);
            }
            else if (tag2.equals("interceptor-ref"))
            {
               String iname = interceptorElement.getAttribute("name");
               if (iname == null) throw new RuntimeException("interceptor-ref has null name attribute");
               InterceptorFactory factory = manager.getInterceptorFactory(iname);
               if (factory == null) throw new RuntimeException("unable to resolve interceptor-ref: " + iname);
               interceptors.add(factory);
            }
            else if (tag2.equals("stack-ref"))
            {
               String name = interceptorElement.getAttribute("name");
               AdviceStack stack = manager.getAdviceStack(name);
               if (stack == null) throw new Exception("there is no <stack> defined for name: " + name);
               interceptors.addAll(stack.getInterceptorFactories());
            }
            else
            {
               AdviceType type = null;
               if (!tag2.equals("advice"))
               {
                  try
                  {
                     type = Enum.valueOf(AdviceType.class, tag2.toUpperCase());
                  }
                  catch (IllegalArgumentException e)
                  {
                     StringBuffer message = new StringBuffer();
                     message.append("unexpected tag inside binding: \'");
                     message.append(tag2);
                     message.append("\'\n\t\t\t\t\t   should be one of: \n\t\t\t\t\t\t'interceptor\', \n\t\t\t\t\t\t'interceptor-ref\', \n\t\t\t\t\t\t'advice\', \n\t\t\t\t\t\t'");
                     for (AdviceType adviceType : AdviceType.values())
                     {
                        message.append(adviceType.getName());
                        message.append("\', \n\t\t\t\t\t\t'");
                     }
                     message.append("stack-ref\'.\n");
                     throw new RuntimeException(message.toString());
                  }
               }
               InterceptorFactory factory = deployAdvice(interceptorElement, type);
               interceptors.add(factory);
            }
         }
      }
      return interceptors;
View Full Code Here

   }

   @Override
   public InterceptorFactory getInterceptorFactory(String name)
   {
      InterceptorFactory factory = null;
      if (parentFirst)
      {
         factory = parent.getInterceptorFactory(name);
         if (factory != null) return factory;
      }
View Full Code Here

         }
        
         def = new AspectDefinition(name, scope, aspectFactory);
         manager.addAspectDefinition(def);
      }
      InterceptorFactory factory = manager.getInterceptorFactory(name);
      if (factory == null)
      {
         factory = new ScopedInterceptorFactory(def);
         manager.addInterceptorFactory(name, factory);
      }
View Full Code Here

         {
            Element interceptorElement = (Element) children2.item(j);
            String tag2 = interceptorElement.getTagName();
            if (tag2.equals("interceptor"))
            {
               InterceptorFactory factory = deployInterceptor(interceptorElement);
               interceptors.add(factory);
            }
            else if (tag2.equals("interceptor-ref"))
            {
               String iname = interceptorElement.getAttribute("name");
               if (iname == null) throw new RuntimeException("interceptor-ref has null name attribute");
               InterceptorFactory factory = manager.getInterceptorFactory(iname);
               if (factory == null) throw new RuntimeException("unable to resolve interceptor-ref: " + iname);
               interceptors.add(factory);
            }
            else if (tag2.equals("stack-ref"))
            {
               String name = interceptorElement.getAttribute("name");
               AdviceStack stack = manager.getAdviceStack(name);
               if (stack == null) throw new Exception("there is no <stack> defined for name: " + name);
               interceptors.addAll(stack.getInterceptorFactories());
            }
            else
            {
               AdviceType type = null;
               if (!tag2.equals("advice"))
               {
                  try
                  {
                     type = Enum.valueOf(AdviceType.class, tag2.toUpperCase());
                  }
                  catch (IllegalArgumentException e)
                  {
                     StringBuffer message = new StringBuffer();
                     message.append("unexpected tag inside binding: \'");
                     message.append(tag2);
                     message.append("\'\n\t\t\t\t\t   should be one of: \n\t\t\t\t\t\t'interceptor\', \n\t\t\t\t\t\t'interceptor-ref\', \n\t\t\t\t\t\t'advice\', \n\t\t\t\t\t\t'");
                     for (AdviceType adviceType : AdviceType.values())
                     {
                        message.append(adviceType.getName());
                        message.append("\', \n\t\t\t\t\t\t'");
                     }
                     message.append("stack-ref\'.\n");
                     throw new RuntimeException(message.toString());
                  }
               }
               InterceptorFactory factory = deployAdvice(interceptorElement, type);
               interceptors.add(factory);
            }
         }
      }
      return interceptors;
View Full Code Here

   }

   @Override
   public InterceptorFactory getInterceptorFactory(String name)
   {
      InterceptorFactory factory = null;
      if (parentFirst)
      {
         factory = parent.getInterceptorFactory(name);
         if (factory != null) return factory;
      }
View Full Code Here

         }
        
         def = new AspectDefinition(name, scope, aspectFactory);
         manager.addAspectDefinition(def);
      }
      InterceptorFactory factory = manager.getInterceptorFactory(name);
      if (factory == null)
      {
         factory = new ScopedInterceptorFactory(def);
         manager.addInterceptorFactory(name, factory);
      }
View Full Code Here

         {
            Element interceptorElement = (Element) children2.item(j);
            String tag2 = interceptorElement.getTagName();
            if (tag2.equals("interceptor"))
            {
               InterceptorFactory factory = deployInterceptor(interceptorElement);
               interceptors.add(factory);
            }
            else if (tag2.equals("interceptor-ref"))
            {
               String iname = interceptorElement.getAttribute("name");
               if (iname == null) throw new RuntimeException("interceptor-ref has null name attribute");
               InterceptorFactory factory = manager.getInterceptorFactory(iname);
               if (factory == null) throw new RuntimeException("unable to resolve interceptor-ref: " + iname);
               interceptors.add(factory);
            }
            else if (tag2.equals("stack-ref"))
            {
               String name = interceptorElement.getAttribute("name");
               AdviceStack stack = manager.getAdviceStack(name);
               if (stack == null) throw new Exception("there is no <stack> defined for name: " + name);
               interceptors.addAll(stack.getInterceptorFactories());
            }
            else
            {
               AdviceType type = null;
               if (!tag2.equals("advice"))
               {
                  try
                  {
                     type = Enum.valueOf(AdviceType.class, tag2.toUpperCase());
                  }
                  catch (IllegalArgumentException e)
                  {
                     StringBuffer message = new StringBuffer();
                     message.append("unexpected tag inside binding: \'");
                     message.append(tag2);
                     message.append("\'\n\t\t\t\t\t   should be one of: \n\t\t\t\t\t\t'interceptor\', \n\t\t\t\t\t\t'interceptor-ref\', \n\t\t\t\t\t\t'advice\', \n\t\t\t\t\t\t'");
                     for (AdviceType adviceType : AdviceType.values())
                     {
                        message.append(adviceType.getName());
                        message.append("\', \n\t\t\t\t\t\t'");
                     }
                     message.append("stack-ref\'.\n");
                     throw new RuntimeException(message.toString());
                  }
               }
               InterceptorFactory factory = deployAdvice(interceptorElement, type);
               interceptors.add(factory);
            }
         }
      }
      return interceptors;
View Full Code Here

   }

   @Override
   public InterceptorFactory getInterceptorFactory(String name)
   {
      InterceptorFactory factory = null;
      if (parentFirst)
      {
         factory = parent.getInterceptorFactory(name);
         if (factory != null) return factory;
      }
View Full Code Here

  
   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);
      manager.addInterceptorFactory(advice.getName(), advice);
      manager.addPointcut(pc);
      manager.addBinding(binding);
   }
View Full Code Here

TOP

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

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.