Package org.jboss.aop.pointcut

Examples of org.jboss.aop.pointcut.PointcutExpression


   protected void updatePointcutStats(Pointcut pointcut)
   {
      // the following is for performance reasons.
      if (pointcut instanceof PointcutExpression)
      {
         PointcutExpression expr = (PointcutExpression) pointcut;
         expr.setManager(this);
         PointcutStats stats = expr.getStats();
         updateStats(stats);
      }
      else
      {
         // can't be sure so set all
View Full Code Here


    *                           syntax error
    */
   public void setPointcutExpression(String pointcutExpression)
           throws ParseException
   {
      pointcut = new PointcutExpression(Long.toString(System.currentTimeMillis()) + ":" + Long.toString(counter++), pointcutExpression);
   }
View Full Code Here

   private void updatePointcutStats(Pointcut pointcut, AspectManager manager)
   {
      // the following is for performance reasons.
      if (pointcut instanceof PointcutExpression)
      {
         PointcutExpression expr = (PointcutExpression) pointcut;
         expr.setManager(manager);
         PointcutStats stats = expr.getStats();
         updateStats(stats);
      }
      else
      {
         // can't be sure so set all
View Full Code Here

      ArrayList<InterceptorFactory> interceptors = loadInterceptors(element);
      InterceptorFactory[] inters = interceptors.toArray(new InterceptorFactory[interceptors.size()]);
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(getName("binding pointcut "), pointcut);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<bind> pointcut expression failed: " + pointcut, ex);
      }
View Full Code Here

         throw new RuntimeException("pointcut declaration must have an expr associated with it");
      }
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(name, expr);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<pointcut name='" + name + "' expr='" + expr + "'/> failed", ex);
      }
View Full Code Here

         throw new RuntimeException("pointcut declaration must have an expr associated with it");
      }
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(name, expr);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<prepare> failed: " + expr, ex);
      }
View Full Code Here

   private void updatePointcutStats(Pointcut pointcut, AspectManager manager)
   {
      // the following is for performance reasons.
      if (pointcut instanceof PointcutExpression)
      {
         PointcutExpression expr = (PointcutExpression) pointcut;
         expr.setManager(manager);
         PointcutStats stats = expr.getStats();
         updateStats(stats);
      }
      else
      {
         // can't be sure so set all
View Full Code Here

      createAndCheckPointcut("call(org.acme.Class->new()) AND withincode(* org.acme.Class->method())", false, false, false, false, false, false, true, true);
      createAndCheckPointcut("execution(org.acme.Class->new()) OR field(* org.acme.Class->fld)", false, true, true, true, false, false, false, false);
     
      //Check that named pointcuts work
      AspectManager manager = AspectManager.instance();
      PointcutExpression pointcut1 = new PointcutExpression("METHOD", "execution(void org.acme.Class->method())");
      manager.addPointcut(pointcut1);
      PointcutExpression pointcut2 = new PointcutExpression("CONSTRUCTOR", "execution(org.acme.Class->new())");
      manager.addPointcut(pointcut2);
      PointcutExpression pointcut3 = new PointcutExpression("COMPOSITION", "METHOD OR CONSTRUCTOR");
      manager.addPointcut(pointcut3);
      PointcutStats stats = pointcut3.getStats();
      assertTrue(stats.isMethodExecution());
      assertTrue(stats.isConstructorExecution());
      assertFalse(stats.isGet());
      assertFalse(stats.isSet());
      assertFalse(stats.isMethodCall());
View Full Code Here

         boolean methodCall,
         boolean constructorCall,
         boolean withincode) throws Exception
   {
      AspectManager manager = AspectManager.instance();
      PointcutExpression pointcut = new PointcutExpression("TEST", expression);
      manager.addPointcut(pointcut);
      PointcutStats stats = pointcut.getStats();
      AdviceBinding binding = new AdviceBinding(expression, null);
      manager.addBinding(binding);
     
      assertEquals(methodExecution, stats.isMethodExecution());
      assertEquals(methodExecution, BindingClassifier.isMethodExecution(binding));
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);
View Full Code Here

TOP

Related Classes of org.jboss.aop.pointcut.PointcutExpression

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.