[jboss-cvs] JBossAS SVN: r74274 - projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jun 7 00:56:35 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-06-07 00:56:35 -0400 (Sat, 07 Jun 2008)
New Revision: 74274

Added:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcherFactory.java
Removed:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcherFactory.java
Modified:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviorSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CallSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConjunctiveSearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/DisjunctiveSearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ParsedSearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/PointcutDelegateSearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Searcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SimpleSearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SubtypeSearcher.java
Log:
[JBAOP-508] Started adding support to aop domains.

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviorSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviorSearcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviorSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -55,6 +55,6 @@
       {
          searchResult.add(node.getExecution());
       }
-      node.searchCallers("*", searchResult);
+      node.searchCallees("*", searchResult);
    }
 }
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorFilter.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -68,7 +68,7 @@
    /**
     * Creates a disjunctive filter that will apply the restrictions represented by
     * both {@code filter1} and {@code filter2}.
-    * Always pick as filter1 the most likely one to fail for acception.
+    * Always pick as filter1 the most likely one to fail for acceptance.
     */
    public ConjunctiveBehaviorFilter(BehaviorFilter filter1, BehaviorFilter filter2)
    {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviorSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -163,7 +163,7 @@
     */
    public void search(ClassNode node, Collection<JoinPointInfo> result)
    {
-      Collection<BehaviorNode> behaviors = node.searchBehaviours(behaviorExpression);
+      Collection<BehaviorNode> behaviors = node.searchBehaviors(behaviorExpression);
       if (isMethod)
       {
          for (BehaviorNode behaviorNode: behaviors)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CallSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CallSearcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CallSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -32,29 +32,29 @@
  */
 class CallSearcher implements Searcher<BehaviorNode>
 {
-   private Collection<WithinSearcher> withinRestrictionList;
+   private Collection<CalleeSearcher> calleeRestrictionList;
    
    /**
     * Sets the l
-    * @param withinRestrictionList
+    * @param calleeRestrictionList
     */
-   public void setWithinRestrictionList(Collection<WithinSearcher> withinRestrictionList)
+   public void setCalleeRestrictionList(Collection<CalleeSearcher> calleeRestrictionList)
    {
-      this.withinRestrictionList = withinRestrictionList;
+      this.calleeRestrictionList = calleeRestrictionList;
    }
    
    
    public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
    {
-      if (withinRestrictionList.isEmpty())
+      if (calleeRestrictionList.isEmpty())
       {
-         node.searchCallers("*", searchResult);
+         node.searchCallees("*", searchResult);
       }
       else
       {
-         for (WithinSearcher withinRestriction: withinRestrictionList)
+         for (CalleeSearcher calleeRestriction: calleeRestrictionList)
          {
-            withinRestriction.search(node, searchResult);
+            calleeRestriction.search(node, searchResult);
          }
       }
    }

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -0,0 +1,276 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.joinpoint.graph;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.aop.CallerConstructorInfo;
+import org.jboss.aop.CallerMethodInfo;
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTException;
+
+/**
+ * Searcher for call joinpoints whose context matches a within expression. 
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+abstract class CalleeSearcher implements Searcher<BehaviorNode>
+{
+   String calleeExpression;
+   
+   /**
+    * Creates a searcher that searches for all calls whose callee matches
+    * {@code calleeExpression}.
+    * 
+    * @param calleeExpression search expression to be used on a search for callees.
+    */
+   public CalleeSearcher(String calleeExpression)
+   {
+      this.calleeExpression = calleeExpression;
+   }
+}
+
+/**
+ * Searcher that does not apply any extra check to the callee of the searched call
+ * joinpoints.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class OptimizedCalleeSearcher extends CalleeSearcher
+{
+   public OptimizedCalleeSearcher(String calleeExpression)
+   {
+      super(calleeExpression);
+   }
+   
+   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
+   {
+      node.searchCallees(calleeExpression, searchResult);
+   }
+}
+
+/**
+ * Searcher that applies an extra check on callees during search.
+ *  
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+abstract class NonOptimizedCalleeSearcher extends CalleeSearcher
+{
+   private static ThreadLocal<Collection<JoinPointInfo>> TEMP =
+         new ThreadLocal<Collection<JoinPointInfo>>()
+   {
+      protected synchronized Collection<JoinPointInfo> initialValue()
+      {
+         return new ArrayList<JoinPointInfo>(2);
+      }
+   };
+    
+   public NonOptimizedCalleeSearcher(String calleeExpression)
+   {
+      super(calleeExpression);
+   }
+   
+   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Collection<JoinPointInfo> temp = TEMP.get();
+      node.searchCallees(calleeExpression, temp);
+      for (JoinPointInfo joinPointInfo: temp)
+      {
+         if (joinPointInfo instanceof CallerConstructorInfo)
+         {
+            if (this.accept(((CallerConstructorInfo) joinPointInfo).getConstructor()))
+            {
+               searchResult.add(joinPointInfo);
+            }
+         }
+         else if (joinPointInfo instanceof CallerMethodInfo)
+         {
+            if (this.accept(((CallerMethodInfo) joinPointInfo).getMethod()))
+            {
+               searchResult.add(joinPointInfo);
+            }
+         }
+      }
+      temp.clear();
+   }
+   
+   protected abstract boolean accept(Method method);
+   protected abstract boolean accept(Constructor constructor);
+}
+
+
+/**
+ * Searcher that checks the attributes of a callee and the exceptions it declares to
+ * throw during search.
+ *  
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class AttExcCalleeSearcher extends NonOptimizedCalleeSearcher
+{
+   private Collection<ASTAttribute> attributes;
+   private Collection<ASTException> exceptions;
+   
+   public AttExcCalleeSearcher(String searchExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions)
+   {
+      super(searchExpression);
+      this.attributes = attributes;
+      this.exceptions = exceptions;
+   }
+   
+   protected boolean accept(Method method)
+   {
+      return Util.matchModifiers(attributes, method.getModifiers()) &&
+         Util.matchExceptions(exceptions, method.getExceptionTypes());
+   }
+   
+   protected boolean accept(Constructor constructor)
+   {
+      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
+         Util.matchExceptions(exceptions, constructor.getExceptionTypes());
+   }
+}
+
+/**
+ * Searcher that applies a {@link BehaviorFilter} to a callee during search.
+ *  
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class FilteredCalleeRestriction extends NonOptimizedCalleeSearcher
+{
+   private BehaviorFilter behaviourFilter;
+   
+   public FilteredCalleeRestriction(String searchExpression, BehaviorFilter filter)
+   {
+      super(searchExpression);
+      this.behaviourFilter = filter;
+   }
+   
+   protected boolean accept(Method method)
+   {
+      return behaviourFilter.accept(method);
+   }
+   
+   protected boolean accept(Constructor constructor)
+   {
+      return behaviourFilter.accept(constructor);
+   }
+}
+
+/**
+ * Searcher that checks the attributes of a callee, the exceptions it declares,
+ * and applies a {@link BehaviorFilter} as well, during search.
+ *  
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class AttExcFilteredCalleeRestriction extends NonOptimizedCalleeSearcher
+{
+   private Collection<ASTAttribute> attributes;
+   private Collection<ASTException> exceptions;
+   private BehaviorFilter behaviourFilter;
+   
+   public AttExcFilteredCalleeRestriction(String searchExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
+         BehaviorFilter behaviourFilter)
+   {
+      super(searchExpression);
+      this.attributes = attributes;
+      this.exceptions = exceptions;
+      this.behaviourFilter = behaviourFilter;
+   }
+   
+   protected boolean accept(Method method)
+   {
+      return Util.matchModifiers(attributes, method.getModifiers()) &&
+         Util.matchExceptions(exceptions, method.getExceptionTypes()) &&
+         behaviourFilter.accept(method);
+   }
+   
+   protected boolean accept(Constructor constructor)
+   {
+      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
+         Util.matchExceptions(exceptions, constructor.getExceptionTypes()) &&
+         behaviourFilter.accept(constructor);
+   }
+}
+
+/**
+ * Searcher that selects all the call joinpoints whose callee does not match a
+ * callee expression. 
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class NegativeCalleeSearcher extends CalleeSearcher
+{
+   private CalleeSearcher calleeRestriction;
+   
+   public NegativeCalleeSearcher(CalleeSearcher calleeRestriction)
+   {
+      super(null);
+      this.calleeRestriction = calleeRestriction;
+   }
+
+   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Set<JoinPointInfo> temp = new HashSet<JoinPointInfo>();
+      node.searchCallees("*", temp);
+      Collection<JoinPointInfo> toRemove = new ArrayList<JoinPointInfo>();
+      calleeRestriction.search(node, toRemove);
+      temp.removeAll(toRemove);
+      searchResult.addAll(temp);
+   }
+}
+
+/**
+ * Searcher that selectes all the call joinpoints whose context match one of two
+ * callee expressions. 
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class DisjunctiveCalleeSearcher extends CalleeSearcher
+{
+   private CalleeSearcher calleeSearcher1;
+   private CalleeSearcher calleeSearcher2;
+   
+   public DisjunctiveCalleeSearcher(CalleeSearcher calleeRestriction1,
+         CalleeSearcher calleeRestriction2)
+   {
+      super(null);
+      this.calleeSearcher1 = calleeRestriction1;
+      this.calleeSearcher2 = calleeRestriction2;
+   }
+
+   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Set<JoinPointInfo> temp = new HashSet<JoinPointInfo>();
+      calleeSearcher1.search(node, temp);
+      calleeSearcher2.search(node, temp);
+      searchResult.addAll(temp);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcherFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcherFactory.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CalleeSearcherFactory.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.joinpoint.graph;
+
+import java.util.Collection;
+
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTException;
+
+/**
+ * Creates {@link CalleeSearcher} instances accordingly to callee expressions.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class CalleeSearcherFactory
+{
+   /**
+    * Creates a {@code CalleeSearcher} that searches for all call joinpoints that
+    * match {@code calleeExpression}.
+    * 
+    * @param calleeExpression the callee expression
+    * @return                 a {@code CalleeSearcher} that searches for all call
+    *                         joinpoints that match {@code calleeExpression}
+    */
+   public static CalleeSearcher create(String calleeExpression)
+   {
+      return new OptimizedCalleeSearcher(calleeExpression);
+   }
+   
+   /**
+    * Creates a {@code CalleeSearcher} that searches for all call joinpoints that
+    * match {@code calleeExpression}, and whose callee satisfy the attribute and
+    * exception restrictions.
+    * 
+    * @param calleeExpression the callee expression
+    * @param attributes       a list of attribute restrictions the callee must follow.
+    *                         May be empty.
+    * @param exceptions       a list of exceptions the callee must declare to throw.
+    *                         May be empty.
+    * @return                 a {@code CalleeSearcher} that searches for all call
+    *                         joinpoints that match {@code calleeExpression}, and
+    *                         whose callee satisfy the attribute and exception
+    *                         restrictions
+    */
+   public static CalleeSearcher create(String calleeExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions)
+   {
+      if (attributes.isEmpty() && exceptions.isEmpty())
+      {
+         return new OptimizedCalleeSearcher(calleeExpression);
+      }
+      else
+      {
+         return new AttExcCalleeSearcher(calleeExpression, attributes, exceptions);
+      }
+   }
+   
+   /**
+    * Creates a {@code CalleeSearcher} that searches for all call joinpoints that
+    * match {@code calleeExpression}, and whose callee satisfy the attribute and
+    * exception restrictions. Besides, the call joinpoint callee must be accepted
+    * by {@code behaviorFilter}.
+    * 
+    * @param calleeExpression the callee expression
+    * @param attributes       a list of attribute restrictions the callee must follow.
+    *                         May be empty.
+    * @param exceptions       a list of exceptions the callee must declare to throw.
+    *                         May be empty.
+    * @param behaviorFilter   a filter that must be applied to each call joinpoint
+    *                         callee during search
+    * @return                 a {@code CalleeSearcher} that searches for all call
+    *                         joinpoints that match {@code calleeExpression}, and
+    *                         whose callee satisfy the attribute and exception
+    *                         restrictions, besides being accepted by
+    *                         {@code behaviorFilter}
+    */
+   public static CalleeSearcher create(String calleeExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
+         BehaviorFilter behaviorFilter)
+   {
+      if (attributes.isEmpty() && exceptions.isEmpty())
+      {
+         return new FilteredCalleeRestriction(calleeExpression, behaviorFilter);
+      }
+      else
+      {
+         return new AttExcFilteredCalleeRestriction(calleeExpression, attributes,
+                     exceptions, behaviorFilter);
+      }
+   }  
+}
\ No newline at end of file

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConjunctiveSearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConjunctiveSearchKey.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConjunctiveSearchKey.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -48,9 +48,9 @@
       ((ParsedSearchKey) searchKey2).addTypeFilter(typeRestriction);
    }
 
-   public void addWithinSearcher(WithinSearcher withinRestriction)
+   public void addCalleeSearcher(CalleeSearcher calleeRestriction)
    {
-      ((ParsedSearchKey) searchKey2).addWithinSearcher(withinRestriction);
+      ((ParsedSearchKey) searchKey2).addCalleeSearcher(calleeRestriction);
    }
 
    public boolean hasSearcher()
@@ -99,9 +99,9 @@
       ((ParsedSearchKey) searchKey2).replaceTypeFilter(restriction);
    }
 
-   public void replaceWithinSearcher(WithinSearcher restriction)
+   public void replaceCalleeSearcher(CalleeSearcher restriction)
    {
-      ((ParsedSearchKey) searchKey2).replaceWithinSearcher(restriction);
+      ((ParsedSearchKey) searchKey2).replaceCalleeSearcher(restriction);
    }
 
    public void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/DisjunctiveSearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/DisjunctiveSearchKey.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/DisjunctiveSearchKey.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -46,9 +46,9 @@
       ((ParsedSearchKey) searchKey2).addTypeFilter(typeRestriction);
    }
 
-   public void addWithinSearcher(WithinSearcher withinRestriction)
+   public void addCalleeSearcher(CalleeSearcher calleeRestriction)
    {
-      ((ParsedSearchKey) searchKey2).addWithinSearcher(withinRestriction);
+      ((ParsedSearchKey) searchKey2).addCalleeSearcher(calleeRestriction);
    }
 
    public boolean hasSearcher()
@@ -97,9 +97,9 @@
       ((ParsedSearchKey) searchKey2).replaceTypeFilter(restriction);
    }
 
-   public void replaceWithinSearcher(WithinSearcher restriction)
+   public void replaceCalleeSearcher(CalleeSearcher restriction)
    {
-      ((ParsedSearchKey) searchKey2).replaceWithinSearcher(restriction);
+      ((ParsedSearchKey) searchKey2).replaceCalleeSearcher(restriction);
    }
 
    public void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ParsedSearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ParsedSearchKey.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ParsedSearchKey.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -69,12 +69,12 @@
    
    
    abstract void addTypeFilter(TypeFilter typeFilter);
-   abstract void addWithinSearcher(WithinSearcher withinSearcher);
+   abstract void addCalleeSearcher(CalleeSearcher calleeSearcher);
    
    abstract void addNegativeSearchKey(SearchKey searchKey);
    abstract Object getLastAddedElement();
    abstract void replaceTypeFilter(TypeFilter typeFilter);
-   abstract void replaceWithinSearcher(WithinSearcher restriction);
+   abstract void replaceCalleeSearcher(CalleeSearcher restriction);
    abstract void replaceNegativeSearchKey(ParsedSearchKey searchKey);
    abstract void merge(SimpleSearchKey simpleSearchKey);
    abstract SearchKey finishParsing();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/PointcutDelegateSearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/PointcutDelegateSearchKey.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/PointcutDelegateSearchKey.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -85,7 +85,7 @@
       Collection<ClassNode> allClasses = classTree.search("*");
       for (ClassNode classNode: allClasses)
       {
-         Collection<BehaviorNode> behaviourNodes = classNode.searchBehaviours("*");
+         Collection<BehaviorNode> behaviourNodes = classNode.searchBehaviors("*");
          for (BehaviorNode behaviourNode: behaviourNodes)
          {
             if (behaviourNode.hasConstruction() &&
@@ -117,9 +117,9 @@
                   }
                }
             }
-            Collection<JoinPointInfo> callers = new ArrayList<JoinPointInfo> ();
-            behaviourNode.searchCallers("*", callers);
-            for (JoinPointInfo caller: callers)
+            Collection<JoinPointInfo> callees = new ArrayList<JoinPointInfo> ();
+            behaviourNode.searchCallees("*", callees);
+            for (JoinPointInfo caller: callees)
             {
                boolean matches = false;
                if (caller instanceof MethodCall)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -67,7 +67,7 @@
 
    public SearchKey finishParsing()
    {
-      if (this.withinSearchers != null)
+      if (this.calleeSearchers != null)
       {
          if (this.classExpression == null)
          {
@@ -77,7 +77,7 @@
                      ParsedSearchKey.EMPTY_EXCEPTIONS, null, true);
             behaviourSearcher.setSearchType(BehaviorSearcher.SearchType.CALL);
             ((CallSearcher) behaviourSearcher.getInternalSearcher()).
-               setWithinRestrictionList(this.withinSearchers);
+               setCalleeRestrictionList(this.calleeSearchers);
             this.searcher = behaviourSearcher;
             return this;
          }
@@ -87,7 +87,7 @@
          {
             CallSearcher callSearcher = (CallSearcher) ((BehaviorSearcher)
                   this.searcher).getInternalSearcher();
-            callSearcher.setWithinRestrictionList(this.withinSearchers);
+            callSearcher.setCalleeRestrictionList(this.calleeSearchers);
             return this;
          }
          return new EmptySearchKey();

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -120,9 +120,9 @@
          {
             return new NegativeTypeFilter((TypeFilter) result);
          }
-         else if (result instanceof WithinSearcher)
+         else if (result instanceof CalleeSearcher)
          {
-            return new NegativeWithinSearcher((WithinSearcher) result);
+            return new NegativeCalleeSearcher((CalleeSearcher) result);
          }
          searchKey.addNegativeSearchKey(negativeSearchKey.finishParsing());
       }
@@ -159,9 +159,9 @@
          {
             searchKey.addTypeFilter((TypeFilter) result);
          }
-         else if (result instanceof WithinSearcher)
+         else if (result instanceof CalleeSearcher)
          {
-            searchKey.addWithinSearcher((WithinSearcher) result);
+            searchKey.addCalleeSearcher((CalleeSearcher) result);
          }
          else // result intanceof ParsedSearchKey
          {
@@ -187,13 +187,13 @@
                   (TypeFilter) result));
             return searchKey;
          }
-         else if (result instanceof WithinSearcher && 
+         else if (result instanceof CalleeSearcher && 
                searchKey.getLastAddedElement() != null &&
-               searchKey.getLastAddedElement() instanceof WithinSearcher)
+               searchKey.getLastAddedElement() instanceof CalleeSearcher)
          {
-            searchKey.replaceWithinSearcher(new DisjunctiveWithinSearcher(
-                  (WithinSearcher)  searchKey.getLastAddedElement(),
-                  (WithinSearcher)  result));
+            searchKey.replaceCalleeSearcher(new DisjunctiveCalleeSearcher(
+                  (CalleeSearcher)  searchKey.getLastAddedElement(),
+                  (CalleeSearcher)  result));
             return searchKey;
          }
          else if(result instanceof ParsedSearchKey)
@@ -208,7 +208,7 @@
             }
             else
             {
-               newSearchKey.addWithinSearcher((WithinSearcher) result);
+               newSearchKey.addCalleeSearcher((CalleeSearcher) result);
             }
             return new DisjunctiveSearchKey(searchKey.finishParsing(), newSearchKey);
          }
@@ -322,41 +322,58 @@
     */
    public Object visit(ASTCall node, Object data)
    {
+      return node.jjtGetChild(0).jjtAccept(this, null);
+   }
+   
+   
+   /* RESTRICTION NODES ************************************************************/
+   
+   public Object visit(ASTWithin node, Object data)
+   {
+      // set class expression
       ParsedSearchKey key = (ParsedSearchKey) data;
+      this.setClassExpression(key, node.getClazz());
+      // create behaviour searcher
       ParsedSearchKey returnValue = null;
       if (key.hasSearcher())
       {
          returnValue = key = new SearchKeyImpl();
       }
-      BehaviorSearcher searcher = (BehaviorSearcher) node.jjtGetChild(0)
-            .jjtAccept(this, key);
+      BehaviorSearcher searcher = new BehaviorSearcher("*",
+            ParsedSearchKey.EMPTY_ATTRIBUTES, ParsedSearchKey.EMPTY_EXCEPTIONS, null,
+            // this attribute is ireelevant in this scenario
+            true);
       searcher.setSearchType(BehaviorSearcher.SearchType.CALL);
-      
       key.setSearcher(searcher);
       return returnValue;
-   }
-   
-   
-   /* RESTRICTION NODES ************************************************************/
-   
-   public Object visit(ASTWithin node, Object data)
-   {
+      /*
       StringBuffer callerExpression = new StringBuffer();
       callerExpression.append("*");
       ClassExpression restriction = appendType(node.getClazz(), callerExpression);
       callerExpression.append(".*(*)");
       if (restriction != null)
       {
-         return WithinSearcherFactory.create(callerExpression.toString(),
+         return CalleeSearcherFactory.create(callerExpression.toString(),
                   ParsedSearchKey.EMPTY_ATTRIBUTES, ParsedSearchKey.EMPTY_EXCEPTIONS,
                   new TargetTypeFilter(restriction));
       }
-      return WithinSearcherFactory.create(callerExpression.toString());
+      return CalleeSearcherFactory.create(callerExpression.toString());*/
    }
 
    public Object visit(ASTWithincode node, Object data)
    {
-      return node.jjtGetChild(0).jjtAccept(this, null);
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.hasSearcher())
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      BehaviorSearcher searcher = (BehaviorSearcher) node.jjtGetChild(0)
+            .jjtAccept(this, key);
+      searcher.setSearchType(BehaviorSearcher.SearchType.CALL);
+      
+      key.setSearcher(searcher);
+      return returnValue;
    }
 
    public Object visit(ASTHas node, Object data)
@@ -375,14 +392,7 @@
    public Object visit(ASTPointcut node, Object data)
    {
       Pointcut pointcut = AspectManager.instance().getPointcut(node.getPointcutName());
-      if (pointcut instanceof PointcutExpression)
-      {
-         return parse((PointcutExpression) pointcut);
-      }
-      else
-      {
-         return new PointcutDelegateSearchKey(pointcut);
-      }
+      return parse((PointcutExpression) pointcut);
    }
    
    public FieldSearcher visit(ASTField node, Object data)
@@ -408,12 +418,12 @@
       {
          if (behaviourFilter == null)
          {
-            return WithinSearcherFactory.create(expression.toString(),
+            return CalleeSearcherFactory.create(expression.toString(),
                   node.getAttributes(), node.getExceptions());
          }
          else
          {
-            return WithinSearcherFactory.create(expression.toString(),
+            return CalleeSearcherFactory.create(expression.toString(),
                   node.getAttributes(), node.getExceptions(), behaviourFilter);
          }
       }
@@ -429,12 +439,12 @@
       {
          if (behaviourFilter != null)
          {
-            return WithinSearcherFactory.create(expression.toString(),
+            return CalleeSearcherFactory.create(expression.toString(),
                   node.getAttributes(), node.getExceptions(), behaviourFilter);
          }
          else
          {
-            return WithinSearcherFactory.create(expression.toString(),
+            return CalleeSearcherFactory.create(expression.toString(),
                   node.getAttributes(), node.getExceptions());
          }
       }
@@ -631,17 +641,20 @@
       {
          searchKey.setClassExpression(classExpression.getOriginal(), false);
       }
-      if (classExpression.isInstanceOf() || classExpression.isInstanceOfAnnotated())
+      else if (classExpression.isInstanceOf() || classExpression.isInstanceOfAnnotated())
       {
          String expression = classExpression.getOriginal();
          expression = expression.substring("$instanceof{".length(), expression.length() - 1);
          searchKey.setClassExpression(expression, true);
       }
       // expression is typedef
-      Typedef typedef = TypedefParser.getTypedef(classExpression);
-      String expression = TypedefParser.parse(typedef);
-      searchKey.setClassExpression(expression, false);
-      searchKey.addTypeFilter(new TypedefFilter(typedef));
+      else
+      {
+         Typedef typedef = TypedefParser.getTypedef(classExpression);
+         String expression = TypedefParser.parse(typedef);
+         searchKey.setClassExpression(expression, false);
+         searchKey.addTypeFilter(new TypedefFilter(typedef));
+      }
    }
 
    private BehaviorFilter printParameters(StringBuffer expression,

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Searcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Searcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Searcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -30,7 +30,7 @@
  * 
  * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
  *
- * @param <N> the target of the searcher
+ * @param <T> the target of the searcher
  */
 interface Searcher<T>
 {

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SimpleSearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SimpleSearchKey.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SimpleSearchKey.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -31,7 +31,7 @@
 abstract class SimpleSearchKey extends ParsedSearchKey
 {
    protected ArrayList<TypeFilter> typeFilters;
-   protected ArrayList<WithinSearcher> withinSearchers;
+   protected ArrayList<CalleeSearcher> calleeSearchers;
    protected ArrayList<SearchKey> negativeSearchKeys;
    protected Object lastElementAdded = null;
    
@@ -47,14 +47,14 @@
    }
    
    
-   public void addWithinSearcher(WithinSearcher withinSearcher)
+   public void addCalleeSearcher(CalleeSearcher calleeSearcher)
    {
-      if (withinSearchers == null)
+      if (calleeSearchers == null)
       {
-         withinSearchers = new ArrayList<WithinSearcher>(1);
+         calleeSearchers = new ArrayList<CalleeSearcher>(1);
       }
-      withinSearchers.add(withinSearcher);
-      lastElementAdded = withinSearcher;
+      calleeSearchers.add(calleeSearcher);
+      lastElementAdded = calleeSearcher;
    }
    
    public void addNegativeSearchKey(SearchKey searchKey)
@@ -78,10 +78,10 @@
       this.lastElementAdded = typeFilter;
    }
 
-   public void replaceWithinSearcher(WithinSearcher withinSearcher)
+   public void replaceCalleeSearcher(CalleeSearcher calleeSearcher)
    {
-      this.withinSearchers.set(withinSearchers.size() -1, withinSearcher);
-      this.lastElementAdded = withinSearcher;
+      this.calleeSearchers.set(calleeSearchers.size() -1, calleeSearcher);
+      this.lastElementAdded = calleeSearcher;
    }
    
    public void replaceNegativeSearchKey(ParsedSearchKey searchKey)
@@ -103,15 +103,15 @@
             this.typeFilters.addAll(simpleSearchKey.typeFilters);
          }
       }
-      if (simpleSearchKey.withinSearchers != null)
+      if (simpleSearchKey.calleeSearchers != null)
       {
-         if (this.withinSearchers == null)
+         if (this.calleeSearchers == null)
          {
-            this.withinSearchers = simpleSearchKey.withinSearchers;
+            this.calleeSearchers = simpleSearchKey.calleeSearchers;
          }
          else
          {
-            this.withinSearchers.addAll(simpleSearchKey.withinSearchers);
+            this.calleeSearchers.addAll(simpleSearchKey.calleeSearchers);
          }
       }
       if (simpleSearchKey.negativeSearchKeys != null)

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SubtypeSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SubtypeSearcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SubtypeSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -49,7 +49,7 @@
    
    public void search(ClassNode node, Collection<JoinPointInfo> searchResult)
    {
-      for (ClassNode classNode: node.getDirectSubtypes())
+      for (ClassNode classNode: node.getSubtypes())
       {
          this.search(classNode, searchResult);
          internalSearcher.search(classNode, searchResult);

Deleted: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcher.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcher.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -1,292 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.aop.joinpoint.graph;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.aop.ConByConInfo;
-import org.jboss.aop.ConByMethodInfo;
-import org.jboss.aop.JoinPointInfo;
-import org.jboss.aop.MethodByConInfo;
-import org.jboss.aop.MethodByMethodInfo;
-import org.jboss.aop.pointcut.Util;
-import org.jboss.aop.pointcut.ast.ASTAttribute;
-import org.jboss.aop.pointcut.ast.ASTException;
-
-/**
- * Searcher for call joinpoints whose context matches a within expression. 
- * 
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-abstract class WithinSearcher implements Searcher<BehaviorNode>
-{
-   String withinExpression;
-   
-   /**
-    * Creates a searcher that searches for all calls whose context match
-    * {@code withinExpression}.
-    * 
-    * @param withinExpression search expression to be used on a search for callers.
-    */
-   public WithinSearcher(String withinExpression)
-   {
-      this.withinExpression = withinExpression;
-   }
-}
-
-/**
- * Searcher that does not apply any extra check to the caller of the searched call
- * joinpoints.
- * 
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class OptimizedWithinSearcher extends WithinSearcher
-{
-   public OptimizedWithinSearcher(String withinExpression)
-   {
-      super(withinExpression);
-   }
-   
-   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
-   {
-      node.searchCallers(withinExpression, searchResult);
-   }
-}
-
-/**
- * Searcher that applies an extra check on callers during search.
- *  
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-abstract class NonOptimizedWithinSearcher extends WithinSearcher
-{
-   private static ThreadLocal<Collection<JoinPointInfo>> TEMP =
-         new ThreadLocal<Collection<JoinPointInfo>>()
-   {
-      protected synchronized Collection<JoinPointInfo> initialValue()
-      {
-         return new ArrayList<JoinPointInfo>(2);
-      }
-   };
-    
-   public NonOptimizedWithinSearcher(String withinExpression)
-   {
-      super(withinExpression);
-   }
-   
-   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
-   {
-      Collection<JoinPointInfo> temp = TEMP.get();
-      node.searchCallers(withinExpression, temp);
-      for (JoinPointInfo joinPointInfo: temp)
-      {
-         if (joinPointInfo instanceof ConByConInfo)
-         {
-            if (this.accept(((ConByConInfo) joinPointInfo).getCallingConstructor()))
-            {
-               searchResult.add(joinPointInfo);
-            }
-         }
-         else if (joinPointInfo instanceof ConByMethodInfo)
-         {
-            if (this.accept(((ConByMethodInfo) joinPointInfo).getCallingMethod()))
-            {
-               searchResult.add(joinPointInfo);
-            }
-         }
-         if (joinPointInfo instanceof MethodByConInfo)
-         {
-            if (this.accept(((MethodByConInfo) joinPointInfo).getCallingConstructor()))
-            {
-               searchResult.add(joinPointInfo);
-            }
-         }
-         else if (joinPointInfo instanceof MethodByMethodInfo)
-         {
-            if (this.accept(((MethodByMethodInfo) joinPointInfo).getCallingMethod()))
-            {
-               searchResult.add(joinPointInfo);
-            }
-         }
-      }
-      temp.clear();
-   }
-   
-   protected abstract boolean accept(Method method);
-   protected abstract boolean accept(Constructor constructor);
-}
-
-
-/**
- * Searcher that checks the attributes of a caller and the exceptions it declares to
- * throw during search.
- *  
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class AttExcWithinSearcher extends NonOptimizedWithinSearcher
-{
-   private Collection<ASTAttribute> attributes;
-   private Collection<ASTException> exceptions;
-   
-   public AttExcWithinSearcher(String searchExpression,
-         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions)
-   {
-      super(searchExpression);
-      this.attributes = attributes;
-      this.exceptions = exceptions;
-   }
-   
-   protected boolean accept(Method method)
-   {
-      return Util.matchModifiers(attributes, method.getModifiers()) &&
-         Util.matchExceptions(exceptions, method.getExceptionTypes());
-   }
-   
-   protected boolean accept(Constructor constructor)
-   {
-      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
-         Util.matchExceptions(exceptions, constructor.getExceptionTypes());
-   }
-}
-
-/**
- * Searcher that applies a {@link BehaviorFilter} to a caller during search.
- *  
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class FilteredWithinRestriction extends NonOptimizedWithinSearcher
-{
-   private BehaviorFilter behaviourFilter;
-   
-   public FilteredWithinRestriction(String searchExpression, BehaviorFilter filter)
-   {
-      super(searchExpression);
-      this.behaviourFilter = filter;
-   }
-   
-   protected boolean accept(Method method)
-   {
-      return behaviourFilter.accept(method);
-   }
-   
-   protected boolean accept(Constructor constructor)
-   {
-      return behaviourFilter.accept(constructor);
-   }
-}
-
-/**
- * Searcher that checks the attributes of a caller, the exceptions it declares,
- * and applies a {@link BehaviorFilter} as well, during search.
- *  
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class AttExcFilteredWithinRestriction extends NonOptimizedWithinSearcher
-{
-   private Collection<ASTAttribute> attributes;
-   private Collection<ASTException> exceptions;
-   private BehaviorFilter behaviourFilter;
-   
-   public AttExcFilteredWithinRestriction(String searchExpression,
-         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
-         BehaviorFilter behaviourFilter)
-   {
-      super(searchExpression);
-      this.attributes = attributes;
-      this.exceptions = exceptions;
-      this.behaviourFilter = behaviourFilter;
-   }
-   
-   protected boolean accept(Method method)
-   {
-      return Util.matchModifiers(attributes, method.getModifiers()) &&
-         Util.matchExceptions(exceptions, method.getExceptionTypes()) &&
-         behaviourFilter.accept(method);
-   }
-   
-   protected boolean accept(Constructor constructor)
-   {
-      return Util.matchModifiers(attributes, constructor.getModifiers()) &&
-         Util.matchExceptions(exceptions, constructor.getExceptionTypes()) &&
-         behaviourFilter.accept(constructor);
-   }
-}
-
-/**
- * Searcher that selects all the call joinpoints whose context does not matche a
- * within expression. 
- * 
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class NegativeWithinSearcher extends WithinSearcher
-{
-   private WithinSearcher withinRestriction;
-   
-   public NegativeWithinSearcher(WithinSearcher withinRestriction)
-   {
-      super(null);
-      this.withinRestriction = withinRestriction;
-   }
-
-   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
-   {
-      Set<JoinPointInfo> temp = new HashSet<JoinPointInfo>();
-      node.searchCallers("*", temp);
-      Collection<JoinPointInfo> toRemove = new ArrayList<JoinPointInfo>();
-      withinRestriction.search(node, toRemove);
-      temp.removeAll(toRemove);
-      searchResult.addAll(temp);
-   }
-}
-
-/**
- * Searcher that selectes all the call joinpoints whose context match one of two
- * within expressions. 
- * 
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class DisjunctiveWithinSearcher extends WithinSearcher
-{
-   private WithinSearcher withinSearcher1;
-   private WithinSearcher withinSearcher2;
-   
-   public DisjunctiveWithinSearcher(WithinSearcher withinRestriction1,
-         WithinSearcher withinRestriction2)
-   {
-      super(null);
-      this.withinSearcher1 = withinRestriction1;
-      this.withinSearcher2 = withinRestriction2;
-   }
-
-   public void search(BehaviorNode node, Collection<JoinPointInfo> searchResult)
-   {
-      Set<JoinPointInfo> temp = new HashSet<JoinPointInfo>();
-      withinSearcher1.search(node, temp);
-      withinSearcher2.search(node, temp);
-      searchResult.addAll(temp);
-   }
-}
\ No newline at end of file

Deleted: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcherFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcherFactory.java	2008-06-06 19:48:59 UTC (rev 74273)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinSearcherFactory.java	2008-06-07 04:56:35 UTC (rev 74274)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.aop.joinpoint.graph;
-
-import java.util.Collection;
-
-import org.jboss.aop.pointcut.ast.ASTAttribute;
-import org.jboss.aop.pointcut.ast.ASTException;
-
-/**
- * Creates {@link WithinSearcher} instances accordingly to within expressions.
- * 
- * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-class WithinSearcherFactory
-{
-   /**
-    * Creates a {@code WithinSearcher} that searches for all call joinpoints that
-    * match {@code withinExpression}.
-    * 
-    * @param withinExpression the within expression
-    * @return                 a {@code WithinSearcher} that searches for all call
-    *                         joinpoints that match {@code withinExpression}
-    */
-   public static WithinSearcher create(String withinExpression)
-   {
-      return new OptimizedWithinSearcher(withinExpression);
-   }
-   
-   /**
-    * Creates a {@code WithinSearcher} that searches for all call joinpoints that
-    * match {@code withinExpression}, and whose contexts satisfy the attribute and
-    * exception restrictions.
-    * 
-    * @param withinExpression the within expression
-    * @param attributes       a list of attribute restrictions the caller must follow.
-    *                         May be empty.
-    * @param exceptions       a list of exceptions the caller must declare to throw.
-    *                         May be empty.
-    * @return                 a {@code WithinSearcher} that searches for all call
-    *                         joinpoints that match {@code withinExpression}, and
-    *                         whose contexts satisfy the attribute and exception
-    *                         restrictions
-    */
-   public static WithinSearcher create(String withinExpression,
-         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions)
-   {
-      if (attributes.isEmpty() && exceptions.isEmpty())
-      {
-         return new OptimizedWithinSearcher(withinExpression);
-      }
-      else
-      {
-         return new AttExcWithinSearcher(withinExpression, attributes, exceptions);
-      }
-   }
-   
-   /**
-    * Creates a {@code WithinSearcher} that searches for all call joinpoints that
-    * match {@code withinExpression}, and whose contexts satisfy the attribute and
-    * exception restrictions. Besides, the call joinpoint context must be accepted
-    * by {@code behaviorFilter}.
-    * 
-    * @param withinExpression the within expression
-    * @param attributes       a list of attribute restrictions the caller must follow.
-    *                         May be empty.
-    * @param exceptions       a list of exceptions the caller must declare to throw.
-    *                         May be empty.
-    * @param behaviorFilter   a filter that must be applied to each call joinpoint
-    *                         context during search
-    * @return                 a {@code WithinSearcher} that searches for all call
-    *                         joinpoints that match {@code withinExpression}, and
-    *                         whose contexts satisfy the attribute and exception
-    *                         restrictions, besides being accepted by
-    *                         {@code behaviorFilter}
-    */
-   public static WithinSearcher create(String withinExpression,
-         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
-         BehaviorFilter behaviorFilter)
-   {
-      if (attributes.isEmpty() && exceptions.isEmpty())
-      {
-         return new FilteredWithinRestriction(withinExpression, behaviorFilter);
-      }
-      else
-      {
-         return new AttExcFilteredWithinRestriction(withinExpression, attributes,
-                     exceptions, behaviorFilter);
-      }
-   }  
-}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list