[jboss-cvs] JBossAS SVN: r70726 - 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
Tue Mar 11 00:51:15 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-03-11 00:51:15 -0400 (Tue, 11 Mar 2008)
New Revision: 70726

Added:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviourSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AnnotationRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourNode.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourSearcher.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/ClassNodeSearcher.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/ConstructionSearcher.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/EmptySearchKey.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ExecutionSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasBlockRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasFieldRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/InstanceOfRestriction.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/SearchKey.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
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefParser.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestriction.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestrictionFactory.java
Log:
[JBAOP-508] First, untested version of the graph search mechanism.

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviourSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviourSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllBehaviourSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,55 @@
+/*
+ * 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.JoinPointInfo;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+class AllBehaviourSearcher implements Searcher<BehaviourNode>
+{
+   private static AllBehaviourSearcher INSTANCE = new AllBehaviourSearcher(); 
+
+   public static AllBehaviourSearcher getInstance()
+   {
+      return INSTANCE;
+   }
+   
+   private AllBehaviourSearcher() {}
+   
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      if (node.hasConstruction())
+      {
+         searchResult.add(node.getConstruction());
+      }
+      if (node.hasExecution())
+      {
+         searchResult.add(node.getExecution());
+      }
+      node.searchCallers("*", searchResult);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AllSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,34 @@
+package org.jboss.aop.joinpoint.graph;
+
+import java.util.Collection;
+
+import org.jboss.aop.JoinPointInfo;
+
+
+class AllSearcher implements ClassNodeSearcher
+{
+   private static AllSearcher INSTANCE = new AllSearcher();
+   
+   public static AllSearcher getInstance()
+   {
+      return INSTANCE;
+   }
+
+   private BehaviourSearcher allMethodExecutions;
+   private FieldSearcher allFieldAccesses;
+   
+   public AllSearcher()
+   {
+      this.allMethodExecutions = new BehaviourSearcher("* *(*)",
+            SearchKeyParser.EMPTY_ATTRIBUTES, SearchKeyParser.EMPTY_EXCEPTIONS, null, true);
+      this.allMethodExecutions.setSearchType(BehaviourSearcher.SearchType.EXECUTION);
+      this.allFieldAccesses = new FieldSearcher("*", SearchKeyParser.EMPTY_ATTRIBUTES, null);
+      this.allFieldAccesses.setAccessType(FieldSearcher.SearchType.ALL);
+   }
+
+   public void search(ClassNode node, Collection<JoinPointInfo> searchResult)
+   {
+      this.allFieldAccesses.search(node, searchResult);
+      this.allMethodExecutions.search(node, searchResult);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AnnotationRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AnnotationRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/AnnotationRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,56 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+import org.jboss.aop.annotation.AnnotationElement;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class AnnotationRestriction implements TypeRestriction
+{
+   private String annotation;
+   public AnnotationRestriction(ClassExpression classExpression)
+   {
+      this.annotation = classExpression.getOriginal().substring(1);
+      
+   }
+
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      try
+      {
+         return AnnotationElement.isAnyAnnotationPresent(target, annotation);
+      }
+      catch (Exception e)
+      {
+         if (e instanceof RuntimeException)
+         {
+            throw (RuntimeException) e;
+         }
+         throw new RuntimeException(e);
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourFilter.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourFilter.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,241 @@
+/*
+ * 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 org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTBehaviour;
+import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTMethod;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+import org.jboss.aop.pointcut.ast.IdentifierExpression;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+interface BehaviourFilter
+{
+   public boolean accept(Method method);
+   public boolean accept(Constructor constructor);
+}
+
+class CompositeFilter implements BehaviourFilter
+{
+   private BehaviourFilter filter1;
+   private BehaviourFilter filter2;
+   
+   // always use filter1 as the more likely to fail for acception
+   public CompositeFilter(BehaviourFilter filter1, BehaviourFilter filter2)
+   {
+      this.filter1 = filter1;
+      this.filter2 = filter2;
+   }
+   
+   public boolean accept(Method method)
+   {
+      return filter1.accept(method) && filter2.accept(method);
+   }
+   
+   public boolean accept(Constructor constructor)
+   {
+      return filter1.accept(constructor) && filter2.accept(constructor);
+   }
+}
+
+class ReturnTypeFilter implements BehaviourFilter
+{
+   ClassExpression classExpression;
+   
+   public ReturnTypeFilter(ClassExpression classExpression)
+   {
+      this.classExpression = classExpression;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.BehaviourFilter#accept(java.lang.reflect.Method)
+    */
+   public boolean accept(Method method)
+   {
+      return Util.matchesClassExpr(classExpression, method.getReturnType());
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.BehaviourFilter#accept(java.lang.reflect.Constructor)
+    */
+   public boolean accept(Constructor constructor)
+   {
+      throw new RuntimeException ("Should never be called");
+   }
+}
+
+class TargetTypeFilter implements BehaviourFilter
+{
+   ClassExpression classExpression;
+   
+   public TargetTypeFilter(ClassExpression classExpression)
+   {
+      this.classExpression = classExpression;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.BehaviourFilter#accept(java.lang.reflect.Method)
+    */
+   public boolean accept(Method method)
+   {
+      return Util.matchesClassExpr(classExpression, method.getDeclaringClass());
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.BehaviourFilter#accept(java.lang.reflect.Constructor)
+    */
+   public boolean accept(Constructor constructor)
+   {
+      return Util.matchesClassExpr(classExpression, constructor.getDeclaringClass());
+   }
+}
+
+class OverridenMethodFilter implements BehaviourFilter
+{
+   boolean exactSuper;
+   ClassExpression expression;
+   
+   public OverridenMethodFilter(IdentifierExpression identifierExpression)
+   {
+      this.exactSuper = (identifierExpression.getType() == (IdentifierExpression.Type.IMPLEMENTS));
+      this.expression = identifierExpression.getImplementsExpression();
+   }
+   
+   public boolean accept(Method method)
+   {
+      try
+      {
+         return Util.methodExistsInSuperClassOrInterface(method, expression, exactSuper, null);
+      }
+      catch (Exception e)
+      {
+         if (e instanceof RuntimeException)
+         {
+            throw (RuntimeException) e;
+         }
+         throw new RuntimeException(e);
+      }
+   }
+   
+   public boolean accept(Constructor constructor)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+}
+
+// filters everything
+class FullParameterFilter implements BehaviourFilter
+{
+   private ASTBehaviour astBehaviour;
+   
+   public FullParameterFilter(ASTBehaviour astBehaviour)
+   {
+      this.astBehaviour = astBehaviour;
+   }
+   
+   public boolean accept(Method method)
+   {
+      return Util.matchesParameters(null, (ASTMethod) astBehaviour, method);
+   }
+   
+   public boolean accept(Constructor constructor)
+   {
+      return Util.matchesParameters(null, (ASTConstructor) astBehaviour, constructor);
+   }
+}
+
+
+abstract class PartialParameterFilter implements BehaviourFilter
+{
+   protected ClassExpression[] classExpressions;
+   public PartialParameterFilter(int parameterLength)
+   {
+      classExpressions = new ClassExpression[parameterLength];
+   }
+   
+   public void addExpression(ClassExpression expression, int index)
+   {
+      classExpressions[index] = expression;
+   }
+   
+   public boolean accept(Method method)
+   {
+      return checkParameters(method.getParameterTypes());
+   }
+   
+   public boolean accept(Constructor constructor)
+   {
+      return checkParameters(constructor.getParameterTypes());
+   }
+   
+   abstract protected boolean checkParameters(Class[] parameters);
+}
+
+class CrescentPartialParameterFilter extends PartialParameterFilter
+{
+   public CrescentPartialParameterFilter(int parameterLength)
+   {
+      super(parameterLength);
+   }
+   
+   protected boolean checkParameters(Class[] parameters)
+   {
+      for (int i = 0; i < classExpressions.length; i++)
+      {
+         if (classExpressions[i] != null &&
+               !Util.matchesClassExpr(classExpressions[i], parameters[i], null))
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+}
+
+class DecrescentPartialParameterFilter extends PartialParameterFilter
+{
+   public DecrescentPartialParameterFilter(int parameterLength)
+   {
+      super(parameterLength);
+   }
+   
+   protected boolean checkParameters(Class[] parameters)
+   {
+      int paramIndex = parameters.length - 1;
+      for (int i = classExpressions.length; i >= 0 ; i--,paramIndex--)
+      {
+         if (classExpressions[i] != null &&
+               !Util.matchesClassExpr(classExpressions[i], parameters[paramIndex], null))
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourNode.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourNode.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,229 @@
+/*
+ * 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.Member;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.ConstructionInfo;
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+/**
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class BehaviourNode implements Node
+{
+   private ClassNode classNode;
+   private BehaviourType behaviourType;
+   private Member member;
+   private JoinPointInfo execution;
+   private ConstructionInfo construction;
+   private Tree<JoinPointInfo> calls;
+   
+   public BehaviourNode(ClassNode classNode, Method member)
+   {
+      this.classNode = classNode;
+      this.member = member;
+      this.behaviourType = BehaviourType.METHOD;
+   }
+   
+   public BehaviourNode(ClassNode classNode, Constructor member)
+   {
+      this.classNode = classNode;
+      this.member = member;
+      this.behaviourType = BehaviourType.CONSTRUCTOR;
+   }
+
+   // TODO Flavia
+   public ClassNode getClassNode()
+   {
+      return this.classNode;
+   }
+ 
+   public static final String getDefaultKey(Method member)
+   {
+      return getDefaultKey(member, BehaviourType.METHOD);
+   }
+   
+   public static final String getDefaultKey(Constructor member)
+   {
+      return getDefaultKey(member, BehaviourType.CONSTRUCTOR);
+   }
+   
+   private static final String getDefaultKey(Member member, BehaviourType type)
+   {
+      return type.getName(member) + getParameterList(member, type);
+   }
+   
+   private static final String getParameterList(Member member, BehaviourType type)
+   {
+      Class[] parameterTypes = type.getParameterTypes(member);
+      if (parameterTypes.length == 0)
+      {
+         return "()";
+      }
+      StringBuffer paramList = new StringBuffer(type.getName(member));
+      paramList.append('(');
+      for (int i = 0; i < parameterTypes.length; i++)
+      {
+         paramList.append(parameterTypes[i].getName()).append(' ');
+      }
+      paramList.append(')');
+      return paramList.toString();
+   }
+   
+   public String getDefaultKey()
+   {
+      return getDefaultKey(this.member, this.behaviourType);
+   }
+   
+   public void loadMetaDataKeys(Collection<String> keys)
+   {
+      String commonPrefix = behaviourType.getReturnType(member) + "@";
+      String commonSuffix = getParameterList(member, behaviourType);
+      Collection<String> metaDataTags =
+            behaviourType.getMetaDataTags(classNode.getAdvisor(), member);
+      for (String metaDataTag: metaDataTags)
+      {
+         keys.add(commonPrefix + metaDataTag + commonSuffix);
+      }
+   }
+   
+   public Member getMember()
+   {
+      return this.member;
+   }
+   
+   public Class[] getExceptionTypes()
+   {
+      return this.behaviourType.getExceptionTypes(member);
+   }
+   
+   public boolean hasExecution()
+   {
+      return this.execution != null;
+   }
+   
+   public JoinPointInfo getExecution()
+   {
+      return this.execution;
+   }
+   
+   public void setExecution(JoinPointInfo execution)
+   {
+      this.execution = execution;
+   }
+   
+   public boolean hasConstruction()
+   {
+      return this.construction != null;
+   }
+   
+   public ConstructionInfo getConstruction()
+   {
+      return this.construction;
+   }
+   
+   public void setConstruction(ConstructionInfo construction)
+   {
+      this.construction = construction;
+   }
+   
+   public void insertCaller(String callerName, JoinPointInfo callNode)
+   {
+      calls.insert(callerName, callNode);
+   }
+   
+   public void searchCallers(String callerExpression, Collection<JoinPointInfo> result)
+   {
+      calls.search(callerExpression, result);
+   }
+   
+   private enum BehaviourType
+   {
+      CONSTRUCTOR
+      {
+         public String getName(Member member)
+         {
+            return "new";
+         }
+         
+         public String getReturnType(Member member)
+         {
+            return "";
+         }
+         
+         public Class[] getParameterTypes(Member member)
+         {
+            return ((Constructor) member).getParameterTypes();
+         }
+         
+         public Class[] getExceptionTypes(Member member)
+         {
+            return ((Constructor) member).getExceptionTypes();
+         }
+         
+         public Collection<String> getMetaDataTags(Advisor advisor, Member member)
+         {
+            return advisor.getMetaDataTags((Constructor) member);
+         }
+      },
+      METHOD
+      {
+         public String getName(Member member)
+         {
+            return ((Method) member).getReturnType().getName() + " " + member.getName();
+         }
+         
+         public String getReturnType(Member member)
+         {
+            return ((Method) member).getReturnType().getName() + " ";
+         }
+         
+         public Class[] getParameterTypes(Member member)
+         {
+            return ((Method) member).getParameterTypes();
+         }
+         
+         public Class[] getExceptionTypes(Member member)
+         {
+            return ((Method) member).getExceptionTypes();
+         }
+         
+         public Collection<String> getMetaDataTags(Advisor advisor, Member member)
+         {
+            return advisor.getMetaDataTags((Method) member);
+         }
+      };
+      
+      public abstract String getName(Member member);
+      public abstract Class[] getExceptionTypes(Member member);
+      public abstract Class[] getParameterTypes(Member member);
+      public abstract Collection<String> getMetaDataTags(Advisor advisor, Member member);
+      public abstract String getReturnType(Member member);
+   };
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/BehaviourSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,131 @@
+/*
+ * 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 org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTException;
+
+/**
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+class BehaviourSearcher implements ClassNodeSearcher
+{
+   
+   
+   public enum SearchType {
+      EXECUTION
+      {
+         public Searcher<BehaviourNode> getSearcher()
+         {
+            return ExecutionSearcher.getInstance();
+         }
+      },
+      CONSTRUCTION
+      {
+         public Searcher<BehaviourNode> getSearcher()
+         {
+            return ConstructionSearcher.getInstance();
+         }
+      },
+      CALL
+      {
+         public Searcher<BehaviourNode> getSearcher()
+         {
+            return new CallSearcher();
+         }
+      },
+      ALL
+      {
+         public Searcher<BehaviourNode> getSearcher()
+         {
+            return AllBehaviourSearcher.getInstance();
+         }
+      };
+      
+      public abstract Searcher<BehaviourNode> getSearcher();
+   }
+   private String behaviourExpression;
+   private Collection<ASTAttribute> attributes;
+   private Collection<ASTException> exceptions;
+   private BehaviourFilter behaviourFilter;
+   private boolean isMethod;
+   private Searcher<BehaviourNode> internalSearcher;
+   
+   public BehaviourSearcher(String behaviourExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
+         BehaviourFilter behaviourFilter, boolean isMethod)
+   {
+      
+      this.behaviourExpression = behaviourExpression;
+      this.attributes = attributes;
+      this.exceptions = exceptions;
+      this.behaviourFilter = behaviourFilter;
+      this.isMethod = isMethod;
+   }
+
+   public void setSearchType(SearchType searchType)
+   {
+      this.internalSearcher = searchType.getSearcher();
+   }
+   
+   Searcher<BehaviourNode> getInternalSearcher()
+   {
+      return this.internalSearcher;
+   }
+   
+   public void search(ClassNode node, Collection<JoinPointInfo> result)
+   {
+      Collection<BehaviourNode> behaviours = node.searchBehaviours(behaviourExpression);
+      if (isMethod)
+      {
+         for (BehaviourNode behaviourNode: behaviours)
+         {
+            if (Util.matchModifiers(attributes, behaviourNode.getMember().getModifiers())
+               && Util.matchExceptions(exceptions, behaviourNode.getExceptionTypes())
+               && (behaviourFilter == null || behaviourFilter.accept((Method) behaviourNode.getMember())))
+            {
+               this.internalSearcher.search(behaviourNode, result);
+            }
+         }
+      }
+      else
+      {
+         for (BehaviourNode behaviourNode: behaviours)
+         {
+            if (Util.matchModifiers(attributes, behaviourNode.getMember().getModifiers())
+               && Util.matchExceptions(exceptions, behaviourNode.getExceptionTypes())
+               && (behaviourFilter == null || behaviourFilter.accept((Constructor) behaviourNode.getMember())))
+            {
+               this.internalSearcher.search(behaviourNode, result);
+            }
+         }
+      }
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/CallSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,54 @@
+/*
+ * 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.JoinPointInfo;
+
+class CallSearcher implements Searcher<BehaviourNode>
+{
+   private Collection<WithinRestriction> withinRestrictionList;
+   
+   void setWithinRestrictionList(Collection<WithinRestriction> withinRestrictionList)
+   {
+      this.withinRestrictionList = withinRestrictionList;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.Searcher#search(java.lang.Object, java.util.Collection)
+    */
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      if (withinRestrictionList.isEmpty())
+      {
+         node.searchCallers("*", searchResult);
+      }
+      else
+      {
+         for (WithinRestriction withinRestriction: withinRestrictionList)
+         {
+            withinRestriction.search(node, searchResult);
+         }
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ClassNodeSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ClassNodeSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ClassNodeSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public interface ClassNodeSearcher extends Searcher<ClassNode>
+{
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConjunctiveSearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,120 @@
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class ConjunctiveSearchKey extends ParsedSearchKey
+{
+   private ParsedSearchKey searchKey1;
+   private ParsedSearchKey searchKey2;
+   
+   public ConjunctiveSearchKey(ParsedSearchKey searchKey1, ParsedSearchKey searchKey2)
+   {
+      this.searchKey1 = searchKey1;
+      this.searchKey2 = searchKey2;
+   }
+
+   public void addTypeRestriction(TypeRestriction typeRestriction)
+   {
+      searchKey2.addTypeRestriction(typeRestriction);
+   }
+
+   public void addWithinRestriction(WithinRestriction withinRestriction)
+   {
+      searchKey2.addWithinRestriction(withinRestriction);
+   }
+
+   public String getClassExpression()
+   {
+      return searchKey2.getClassExpression();
+   }
+
+   public void setClassExpression(String className, boolean instanceOf)
+   {
+      searchKey2.setClassExpression(className, instanceOf);
+   }
+
+   public void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher)
+   {
+      searchKey2.setClassNodeSearcher(classNodeSearcher);
+   }
+
+   public void addNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      searchKey2.addNegativeSearchKey(searchKey);
+   }
+
+   public ParsedSearchKey finishParsing()
+   {
+      this.searchKey2 = this.searchKey2.finishParsing();
+      return this;
+   }
+
+   public Object getLastAddedElement()
+   {
+      return this.searchKey2.getLastAddedElement();
+   }
+
+   public void merge(SimpleSearchKey simpleSearchKey)
+   {
+      this.searchKey2.merge(simpleSearchKey);
+   }
+
+   public void replaceNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      this.searchKey2.replaceNegativeSearchKey(searchKey);
+   }
+
+   public void replaceTypeRestriction(TypeRestriction restriction)
+   {
+      this.searchKey2.replaceTypeRestriction(restriction);
+   }
+
+   public void replaceWithinRestriction(WithinRestriction restriction)
+   {
+      this.searchKey2.replaceWithinRestriction(restriction);
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#search(org.jboss.aop.joinpoint.graph.tree.Tree, java.util.Collection)
+    */
+   @Override
+   void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)
+   {
+      Set<JoinPointInfo> firstResult = new HashSet<JoinPointInfo>();
+      this.searchKey1.search(classTree, firstResult);
+      Set<JoinPointInfo> secondResult = new HashSet<JoinPointInfo>();
+      this.searchKey2.search(classTree, secondResult);
+      firstResult.retainAll(secondResult);
+      result.addAll(firstResult);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConstructionSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConstructionSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ConstructionSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,25 @@
+package org.jboss.aop.joinpoint.graph;
+
+import java.util.Collection;
+
+import org.jboss.aop.JoinPointInfo;
+
+class ConstructionSearcher implements Searcher<BehaviourNode>
+{
+   private static final ConstructionSearcher INSTANCE = new ConstructionSearcher();
+   
+   public static ConstructionSearcher getInstance()
+   {
+      return INSTANCE;
+   }
+   
+   private ConstructionSearcher() {}
+   
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      if (node.hasConstruction())
+      {
+         searchResult.add(node.getConstruction());
+      }
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/DisjunctiveSearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,111 @@
+/*
+ * 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.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class DisjunctiveSearchKey extends ParsedSearchKey
+{
+   private ParsedSearchKey searchKey1;
+   private ParsedSearchKey searchKey2;
+   
+   public DisjunctiveSearchKey(ParsedSearchKey searchKey1, ParsedSearchKey searchKey2)
+   {
+      this.searchKey1 = searchKey1;
+      this.searchKey2 = searchKey2;
+   }
+
+   public void addTypeRestriction(TypeRestriction typeRestriction)
+   {
+      searchKey2.addTypeRestriction(typeRestriction);
+   }
+
+   public void addWithinRestriction(WithinRestriction withinRestriction)
+   {
+      searchKey2.addWithinRestriction(withinRestriction);
+   }
+
+   public String getClassExpression()
+   {
+      return searchKey2.getClassExpression();
+   }
+
+   public void setClassExpression(String className, boolean instanceOf)
+   {
+      searchKey2.setClassExpression(className, instanceOf);
+   }
+
+   public void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher)
+   {
+      searchKey2.setClassNodeSearcher(classNodeSearcher);
+   }
+
+   public void addNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      searchKey2.addNegativeSearchKey(searchKey);
+   }
+
+   public ParsedSearchKey finishParsing()
+   {
+      this.searchKey2 = this.searchKey2.finishParsing();
+      return this;
+   }
+
+   public Object getLastAddedElement()
+   {
+      return this.searchKey2.getLastAddedElement();
+   }
+
+   public void merge(SimpleSearchKey simpleSearchKey)
+   {
+      this.searchKey2.merge(simpleSearchKey);
+   }
+
+   public void replaceNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      this.searchKey2.replaceNegativeSearchKey(searchKey);
+   }
+
+   public void replaceTypeRestriction(TypeRestriction restriction)
+   {
+      this.searchKey2.replaceTypeRestriction(restriction);
+   }
+
+   public void replaceWithinRestriction(WithinRestriction restriction)
+   {
+      this.searchKey2.replaceWithinRestriction(restriction);
+   }
+
+   @Override
+   void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)
+   {
+      this.searchKey1.search(classTree, result);
+      this.searchKey2.search(classTree, result);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/EmptySearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/EmptySearchKey.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/EmptySearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,143 @@
+/*
+ * 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.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+class EmptySearchKey extends ParsedSearchKey
+{
+   public void addNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+   }
+
+   public void addTypeRestriction(TypeRestriction typeRestriction)
+   {
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#addWithinRestriction(org.jboss.aop.joinpoint.graph.WithinRestriction)
+    */
+   public void addWithinRestriction(WithinRestriction withinRestriction)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#getClassExpression()
+    */
+   public String getClassExpression()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#getLastAddedElement()
+    */
+   public Object getLastAddedElement()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#parsed()
+    */
+   public void parsed()
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#replaceNegativeSearchKey(org.jboss.aop.joinpoint.graph.ParsedSearchKey)
+    */
+   public void replaceNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#replaceTypeRestriction(org.jboss.aop.joinpoint.graph.TypeRestriction)
+    */
+   public void replaceTypeRestriction(TypeRestriction restriction)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#replaceWithinRestriction(org.jboss.aop.joinpoint.graph.WithinRestriction)
+    */
+   public void replaceWithinRestriction(WithinRestriction restriction)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#setClassExpression(java.lang.String, boolean)
+    */
+   public void setClassExpression(String className, boolean instanceOf)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#setClassNodeSearcher(org.jboss.aop.joinpoint.graph.ClassNodeSearcher)
+    */
+   public void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher)
+   {
+      // TODO Auto-generated method stub
+
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#finishParsing()
+    */
+   public ParsedSearchKey finishParsing()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#merge(org.jboss.aop.joinpoint.graph.SearchKeyImpl)
+    */
+   public void merge(SimpleSearchKey simpleSearchKey){}
+
+   @Override
+   void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)
+   {
+      // do nothing  
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ExecutionSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ExecutionSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ExecutionSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,46 @@
+/*
+ * 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.JoinPointInfo;
+
+public class ExecutionSearcher implements Searcher<BehaviourNode>
+{
+   private static final ExecutionSearcher INSTANCE = new ExecutionSearcher();
+   
+   public static ExecutionSearcher getInstance()
+   {
+      return INSTANCE;
+   }
+   
+   private ExecutionSearcher() {}
+   
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      if (node.hasExecution())
+      {
+         searchResult.add(node.getExecution());
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldFilter.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,55 @@
+/*
+ * 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.Field;
+
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+interface FieldFilter
+{
+   public boolean accept(Field field);
+}
+
+class FieldTypeFilter implements FieldFilter
+{
+   private ClassExpression classExpression;
+   
+   public FieldTypeFilter(ClassExpression classExpression)
+   {
+      this.classExpression = classExpression;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.FieldFilter#accept(java.lang.reflect.Field)
+    */
+   public boolean accept(Field field)
+   {
+      return Util.matchesClassExpr(classExpression, field.getType());
+   }
+   
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/FieldSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,107 @@
+/*
+ * 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.Field;
+import java.util.Collection;
+
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+class FieldSearcher implements ClassNodeSearcher
+{
+   public enum SearchType implements Searcher<FieldNode>
+   {
+      READ
+      {
+         public void search(FieldNode node, Collection<JoinPointInfo> searchResult)
+         {
+            if (node.hasFieldRead())
+            {
+               searchResult.add(node.getFieldRead());
+            }
+         }
+      },
+      WRITE
+      {
+         public void search(FieldNode node, Collection<JoinPointInfo> searchResult)
+         {
+            if (node.hasFieldWrite())
+            {
+               searchResult.add(node.getFieldWrite());
+            }
+         }
+       
+      },
+      ALL
+      {
+         public void search(FieldNode node, Collection<JoinPointInfo> searchResult)
+         {
+            if (node.hasFieldRead())
+            {
+               searchResult.add(node.getFieldRead());
+            }
+            if (node.hasFieldWrite())
+            {
+               searchResult.add(node.getFieldWrite());
+            }
+         }
+      }
+   }
+   
+   private SearchType accessType;
+   private String fieldExpression;
+   private FieldFilter fieldFilter;
+   private Collection<ASTAttribute> attributes;
+   
+   
+   public FieldSearcher(String fieldExpression, Collection<ASTAttribute> attributes, FieldFilter fieldFilter)
+   {
+      this.fieldExpression = fieldExpression;
+      this.attributes = attributes;
+      this.fieldFilter = fieldFilter;
+   }
+   
+   public void setAccessType(SearchType accessType)
+   {
+      this.accessType = accessType;
+   }
+   
+   public void search(ClassNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Collection<FieldNode> fieldNodes = node.searchFields(fieldExpression);
+      for (FieldNode fieldNode: fieldNodes)
+      {
+         Field field = fieldNode.getField();
+         if (Util.matchModifiers(attributes, field.getModifiers()) &&
+            (fieldFilter == null || fieldFilter.accept(field)))
+         {
+            accessType.search(fieldNode, searchResult);
+         }
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasBlockRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasBlockRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasBlockRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,48 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTMethod;
+import org.jboss.aop.pointcut.ast.SimpleNode;
+
+
+class HasBlockRestriction implements TypeRestriction {
+
+	private SimpleNode behaviourASTNode;
+	
+	public HasBlockRestriction(SimpleNode behaviourASTNode)
+	{
+		this.behaviourASTNode = behaviourASTNode;
+	}
+   
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      if (behaviourASTNode instanceof ASTConstructor)
+      {
+         return Util.has(target, (ASTConstructor) behaviourASTNode, advisor);
+      }
+      return Util.has(target, (ASTMethod) behaviourASTNode, advisor);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasFieldRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasFieldRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/HasFieldRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,41 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ASTField;
+
+class HasFieldRestriction implements TypeRestriction
+{
+   private ASTField fieldASTNode;
+   
+   public HasFieldRestriction(ASTField fieldASTNode)
+   {
+      this.fieldASTNode = fieldASTNode;
+   }
+   
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      return Util.has(target, fieldASTNode, advisor);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/InstanceOfRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/InstanceOfRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/InstanceOfRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,45 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+import org.jboss.aop.pointcut.Util;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class InstanceOfRestriction implements TypeRestriction
+{
+   private ClassExpression classExpression;
+   
+   public InstanceOfRestriction(ClassExpression classExpression)
+   {
+      this.classExpression = classExpression;
+   }
+   
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      return Util.subtypeOf(target, classExpression, advisor);
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/ParsedSearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,25 @@
+package org.jboss.aop.joinpoint.graph;
+
+import java.util.Collection;
+
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+
+abstract class ParsedSearchKey extends SearchKey
+{
+   abstract String getClassExpression();
+	
+   abstract void setClassExpression(String className, boolean instanceOf);
+   abstract void addTypeRestriction(TypeRestriction typeRestriction);
+   abstract void addWithinRestriction(WithinRestriction withinRestriction);
+   abstract void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher);
+   abstract void addNegativeSearchKey(ParsedSearchKey searchKey);
+   abstract Object getLastAddedElement();
+   abstract void replaceTypeRestriction(TypeRestriction restriction);
+   abstract void replaceWithinRestriction(WithinRestriction restriction);
+   abstract void replaceNegativeSearchKey(ParsedSearchKey searchKey);
+   abstract void merge(SimpleSearchKey simpleSearchKey);
+   abstract ParsedSearchKey finishParsing();
+   abstract void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/PointcutDelegateSearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,129 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+import org.jboss.aop.pointcut.Pointcut;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class PointcutDelegateSearchKey extends SimpleSearchKey
+{
+   private Pointcut pointcut;
+   
+   public PointcutDelegateSearchKey(Pointcut pointcut)
+   {
+      this.pointcut = pointcut;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#finishParsing()
+    */
+   @Override
+   ParsedSearchKey finishParsing()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   @Override
+   String getClassExpression()
+   {
+      return "*";
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#setClassExpression(java.lang.String, boolean)
+    */
+   @Override
+   void setClassExpression(String className, boolean instanceOf)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#setClassNodeSearcher(org.jboss.aop.joinpoint.graph.ClassNodeSearcher)
+    */
+   @Override
+   void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.ParsedSearchKey#search(org.jboss.aop.joinpoint.graph.tree.Tree, java.util.Collection)
+    */
+   @Override
+   void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)
+   {
+      Collection<ClassNode> allClasses = classTree.search("*");
+      for (ClassNode classNode: allClasses)
+      {
+         Collection<BehaviourNode> behaviourNodes = classNode.searchBehaviours("*");
+         for (BehaviourNode behaviourNode: behaviourNodes)
+         {
+            if (behaviourNode.hasConstruction() &&
+                  behaviourNode.getConstruction().matches(pointcut))
+            {
+               result.add(behaviourNode.getConstruction());
+            }
+            if (behaviourNode.hasExecution())
+            {
+               JoinPointInfo executionInfo = behaviourNode.getExecution();
+               if (executionInfo.matches(pointcut))
+               {
+                  result.add(executionInfo);
+               }
+            }
+            Collection<JoinPointInfo> callers = new ArrayList<JoinPointInfo> ();
+            behaviourNode.searchCallers("*", callers);
+            for (JoinPointInfo caller: callers)
+            {
+               if (caller.matches(pointcut))
+               {
+                  result.add(caller);
+               }
+            }
+         }
+         Collection<FieldNode> fieldNodes = classNode.searchFields("*");
+         for (FieldNode fieldNode: fieldNodes)
+         {
+            if (fieldNode.hasFieldRead() && fieldNode.getFieldRead().matches(pointcut))
+            {
+               result.add(fieldNode.getFieldRead());
+            }
+            if (fieldNode.hasFieldWrite() && fieldNode.getFieldWrite().matches(pointcut))
+            {
+               result.add(fieldNode.getFieldWrite());
+            }
+         }
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKey.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class SearchKey
+{
+   SearchKey(){}
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyImpl.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,146 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.joinpoint.graph.tree.Tree;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+class SearchKeyImpl extends SimpleSearchKey
+{
+   private String classExpression;
+   private ClassNodeSearcher classNodeSearcher;
+   private boolean instanceOf;
+   
+   
+   public void search(Tree<ClassNode> classTree, Collection<JoinPointInfo> result)
+   {
+      Collection<ClassNode> classes = new LinkedList<ClassNode>();
+      classTree.search(classExpression, classes);
+      if (isInstanceOf())
+      {
+         Collection<ClassNode> superClasses = classes;
+         classes = new ArrayList<ClassNode>(superClasses.size() * 2);
+         for (Iterator<ClassNode> iterator = superClasses.iterator(); iterator.hasNext(); )
+         {
+            ClassNode superClassNode = iterator.next();
+            classes.add(superClassNode);
+            iterator.remove();
+            classes.addAll(superClassNode.getDirectSubtypes());
+            superClasses.addAll(superClassNode.getDirectSubtypes());
+         }
+      }
+      outer: for (ClassNode classNode: classes)
+      {
+         for (TypeRestriction restriction: typeRestrictions)
+         {
+            if (!restriction.satisfies(classNode.getRepresentedClass(), classNode.getAdvisor()))
+            {
+               continue outer;
+            }
+         }
+         classNodeSearcher.search(classNode, result);
+      }
+   }
+   
+   public String getClassExpression()
+   {
+      return this.classExpression;
+   }
+   
+   boolean isInstanceOf()
+   {
+      return this.instanceOf;
+   }
+   
+   public void setClassExpression(String className, boolean instanceOf)
+   {
+      this.classExpression = className;
+      this.instanceOf = instanceOf;
+   }
+   
+      ClassNodeSearcher getClassNodeSearcher()
+   {
+      return classNodeSearcher;
+   }
+
+   public void setClassNodeSearcher(ClassNodeSearcher classNodeSearcher)
+   {
+      this.classNodeSearcher = classNodeSearcher;
+   }
+
+   public ParsedSearchKey finishParsing()
+   {
+      if (this.withinRestrictions != null)
+      {
+         if (this.classExpression == null)
+         {
+            this.classExpression = "*";
+            BehaviourSearcher behaviourSearcher =
+               new BehaviourSearcher("*", SearchKeyParser.EMPTY_ATTRIBUTES,
+                     SearchKeyParser.EMPTY_EXCEPTIONS, null, true);
+            behaviourSearcher.setSearchType(BehaviourSearcher.SearchType.CALL);
+            ((CallSearcher) behaviourSearcher.getInternalSearcher()).
+               setWithinRestrictionList(this.withinRestrictions);
+            this.classNodeSearcher = behaviourSearcher;
+            return this;
+         }
+         if (this.classNodeSearcher instanceof BehaviourSearcher &&
+            ((BehaviourSearcher) this.classNodeSearcher).getInternalSearcher()
+            instanceof CallSearcher)
+         {
+            CallSearcher callSearcher = (CallSearcher) ((BehaviourSearcher)
+                  this.classNodeSearcher).getInternalSearcher();
+            callSearcher.setWithinRestrictionList(this.withinRestrictions);
+            return this;
+         }
+         return new EmptySearchKey();
+      }
+      if (this.classExpression == null)
+      {
+         this.classExpression = "*";
+         BehaviourSearcher behaviourSearcher =
+            new BehaviourSearcher("*", SearchKeyParser.EMPTY_ATTRIBUTES,
+                  SearchKeyParser.EMPTY_EXCEPTIONS, null, true);
+         behaviourSearcher.setSearchType(BehaviourSearcher.SearchType.ALL);
+         this.classNodeSearcher = behaviourSearcher;
+         SearchKeyImpl fieldSearchKey = new SearchKeyImpl();
+         fieldSearchKey.classExpression = "*";
+         FieldSearcher fieldSearcher = new FieldSearcher("*",
+               SearchKeyParser.EMPTY_ATTRIBUTES, null);
+         fieldSearcher.setAccessType(FieldSearcher.SearchType.ALL);
+         fieldSearchKey.classNodeSearcher = fieldSearcher;
+         fieldSearchKey.typeRestrictions = this.typeRestrictions;
+         fieldSearchKey.negativeSearchKeys = this.negativeSearchKeys;
+         return new DisjunctiveSearchKey(this, fieldSearchKey);
+      }
+      return this;
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SearchKeyParser.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,788 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.pointcut.Pointcut;
+import org.jboss.aop.pointcut.PointcutExpression;
+import org.jboss.aop.pointcut.Typedef;
+import org.jboss.aop.pointcut.ast.ASTAll;
+import org.jboss.aop.pointcut.ast.ASTAllParameter;
+import org.jboss.aop.pointcut.ast.ASTAnd;
+import org.jboss.aop.pointcut.ast.ASTAndCFlow;
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTBehaviour;
+import org.jboss.aop.pointcut.ast.ASTBoolean;
+import org.jboss.aop.pointcut.ast.ASTCFlow;
+import org.jboss.aop.pointcut.ast.ASTCFlowBoolean;
+import org.jboss.aop.pointcut.ast.ASTCFlowExpression;
+import org.jboss.aop.pointcut.ast.ASTCall;
+import org.jboss.aop.pointcut.ast.ASTComposite;
+import org.jboss.aop.pointcut.ast.ASTCompositeCFlow;
+import org.jboss.aop.pointcut.ast.ASTConstruction;
+import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTException;
+import org.jboss.aop.pointcut.ast.ASTExecution;
+import org.jboss.aop.pointcut.ast.ASTExecutionOnly;
+import org.jboss.aop.pointcut.ast.ASTField;
+import org.jboss.aop.pointcut.ast.ASTFieldExecution;
+import org.jboss.aop.pointcut.ast.ASTGet;
+import org.jboss.aop.pointcut.ast.ASTHas;
+import org.jboss.aop.pointcut.ast.ASTHasField;
+import org.jboss.aop.pointcut.ast.ASTMethod;
+import org.jboss.aop.pointcut.ast.ASTNot;
+import org.jboss.aop.pointcut.ast.ASTNotCFlow;
+import org.jboss.aop.pointcut.ast.ASTOr;
+import org.jboss.aop.pointcut.ast.ASTOrCFlow;
+import org.jboss.aop.pointcut.ast.ASTParameter;
+import org.jboss.aop.pointcut.ast.ASTPointcut;
+import org.jboss.aop.pointcut.ast.ASTSet;
+import org.jboss.aop.pointcut.ast.ASTStart;
+import org.jboss.aop.pointcut.ast.ASTSub;
+import org.jboss.aop.pointcut.ast.ASTSubCFlow;
+import org.jboss.aop.pointcut.ast.ASTWithin;
+import org.jboss.aop.pointcut.ast.ASTWithincode;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+import org.jboss.aop.pointcut.ast.IdentifierExpression;
+import org.jboss.aop.pointcut.ast.PointcutExpressionParserVisitor;
+import org.jboss.aop.pointcut.ast.SimpleNode;
+
+public class SearchKeyParser implements PointcutExpressionParserVisitor
+{
+   private static SearchKeyParser INSTANCE = new SearchKeyParser();
+   
+   static final Collection<ASTAttribute> EMPTY_ATTRIBUTES = new ArrayList<ASTAttribute>(0);
+   static final Collection<ASTException> EMPTY_EXCEPTIONS = new ArrayList<ASTException>(0);
+   
+   public static SearchKey parse(PointcutExpression pointcutExpression)
+   {
+      return INSTANCE.visit(pointcutExpression.getParsedExpression(), null);
+   }
+   
+   private SearchKeyParser() {}
+   
+   /* START AST NODE ***************************************************************/
+   
+   public ParsedSearchKey visit(ASTStart node, Object data)
+   {
+      ParsedSearchKey searchKey = new SearchKeyImpl();
+      searchKey = this.visitSubNode(node, searchKey);
+      return searchKey.finishParsing();
+   }
+
+   /* COMPOSITE AST NODES **********************************************************/
+   
+   public Object visit(ASTComposite node, Object data)
+   {
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      ParsedSearchKey result = (ParsedSearchKey)
+         node.jjtGetChild(0).jjtAccept(this,  new SearchKeyImpl());
+      if (result.getClassExpression() == null && result instanceof SearchKeyImpl)
+      {
+         searchKey.merge((SearchKeyImpl) result);
+         return searchKey;
+      }
+      return result;
+   }
+
+   public Object visit(ASTNot node, Object data)
+   {
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      ParsedSearchKey negativeSearchKey = new SearchKeyImpl();
+      Object result = node.jjtGetChild(0).jjtAccept(this, negativeSearchKey);
+      if (result!= null)
+      {
+         if (result instanceof TypeRestriction)
+         {
+            return new NegativeTypeRestriction((TypeRestriction) result);
+         }
+         else if (result instanceof WithinRestriction)
+         {
+            return new NegativeWithinRestriction((WithinRestriction) result);
+         }
+         searchKey.addNegativeSearchKey(negativeSearchKey.finishParsing());
+      }
+      return null;
+   }
+
+   public Object visit(ASTSub node, Object data)
+   {
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      Object result = visitSubNode(node, searchKey);
+      if (result != null)
+      {
+         searchKey = (ParsedSearchKey) result;
+      }
+      
+      for (int i = 1; i < node.jjtGetNumChildren(); i++)
+      {
+         searchKey = (ParsedSearchKey) node.jjtGetChild(i).jjtAccept(this, searchKey);  
+      }
+      return searchKey;
+   }
+
+   public Object visit(ASTAnd node, Object data)
+   {
+      return visitSubNode(node, (ParsedSearchKey) data);
+   }
+      
+   private ParsedSearchKey visitSubNode(SimpleNode node, ParsedSearchKey searchKey)
+   {
+      Object result = node.jjtGetChild(0).jjtAccept(this, searchKey);
+      if (result!= null)
+      {
+         if (result instanceof TypeRestriction)
+         {
+            searchKey.addTypeRestriction((TypeRestriction) result);
+         }
+         else if (result instanceof WithinRestriction)
+         {
+            searchKey.addWithinRestriction((WithinRestriction) result);
+         }
+         else // result intanceof ParsedSearchKey
+         {
+            return new ConjunctiveSearchKey(searchKey.finishParsing(), (ParsedSearchKey) result);
+         }
+      }
+      return searchKey;
+   }
+
+   public Object visit(ASTOr node, Object data)
+   {
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      ParsedSearchKey newSearchKey = new SearchKeyImpl();
+      Object result = node.jjtGetChild(0).jjtAccept(this, newSearchKey);
+      if (result!= null)
+      {
+         if (result instanceof TypeRestriction && 
+               searchKey.getLastAddedElement() != null &&
+                  searchKey.getLastAddedElement() instanceof TypeRestriction)
+         {
+            searchKey.replaceTypeRestriction(new DisjunctiveTypeRestriction(
+                  (TypeRestriction) searchKey.getLastAddedElement(),
+                  (TypeRestriction) result));
+            return searchKey;
+         }
+         else if (result instanceof WithinRestriction && 
+               searchKey.getLastAddedElement() != null &&
+               searchKey.getLastAddedElement() instanceof WithinRestriction)
+         {
+            searchKey.replaceWithinRestriction(new DisjunctiveWithinRestriction(
+                  (WithinRestriction)  searchKey.getLastAddedElement(),
+                  (WithinRestriction)  result));
+            return searchKey;
+         }
+         else if(result instanceof ParsedSearchKey)
+         {
+            ParsedSearchKey resultSearchKey = (ParsedSearchKey) result;
+            return new DisjunctiveSearchKey(searchKey.finishParsing(), (ParsedSearchKey) result);
+         }
+         else // partially filled ParsedSearchKey
+         {
+            if (result instanceof TypeRestriction)
+            {
+               newSearchKey.addTypeRestriction((TypeRestriction) result);
+            }
+            else
+            {
+               newSearchKey.addWithinRestriction((WithinRestriction) result);
+            }
+            return new DisjunctiveSearchKey(searchKey.finishParsing(), newSearchKey);
+         }
+      }
+      return new DisjunctiveSearchKey(searchKey.finishParsing(), newSearchKey);
+   }
+
+
+   /* MAIN AST NODES ***************************************************************/
+
+   /**
+    * @param data the search key
+    */
+   public Object visit(ASTAll node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      this.setClassExpression(key, node.getClazz());
+      key.setClassNodeSearcher(AllSearcher.getInstance());
+      return returnValue;
+   }
+
+
+   public Object visit(ASTGet node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      FieldSearcher searcher = (FieldSearcher) node.jjtGetChild(0).jjtAccept(this,
+            key);
+      searcher.setAccessType(FieldSearcher.SearchType.READ);
+      key.setClassNodeSearcher(searcher);
+      return returnValue;
+   }
+
+   public Object visit(ASTSet node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      FieldSearcher searcher = (FieldSearcher) node.jjtGetChild(0).jjtAccept(this,
+            key);
+      searcher.setAccessType(FieldSearcher.SearchType.WRITE);
+      key.setClassNodeSearcher(searcher);
+      return returnValue;
+   }
+
+   public Object visit(ASTFieldExecution node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      FieldSearcher searcher = (FieldSearcher) node.jjtGetChild(0).jjtAccept(this,
+            key);
+      searcher.setAccessType(FieldSearcher.SearchType.ALL);
+      key.setClassNodeSearcher(searcher);
+      return returnValue;
+   }
+
+   /**
+    * @param data the search key
+    */
+   public Object visit(ASTConstruction node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      BehaviourSearcher searcher = (BehaviourSearcher) node.jjtGetChild(0)
+            .jjtAccept(this, key);
+      searcher.setSearchType(BehaviourSearcher.SearchType.CONSTRUCTION);
+      key.setClassNodeSearcher(searcher);
+      return returnValue;
+   }
+   
+   /**
+    * @param data the search key
+    */
+   public Object visit(ASTExecution node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      BehaviourSearcher searcher = (BehaviourSearcher) node.jjtGetChild(0)
+            .jjtAccept(this, key);
+      searcher.setSearchType(BehaviourSearcher.SearchType.EXECUTION);
+      key.setClassNodeSearcher(searcher);
+      return returnValue;
+   }
+
+   /**
+    * @param data the search key
+    */
+   public Object visit(ASTCall node, Object data)
+   {
+      ParsedSearchKey key = (ParsedSearchKey) data;
+      ParsedSearchKey returnValue = null;
+      if (key.getClassExpression() != null)
+      {
+         returnValue = key = new SearchKeyImpl();
+      }
+      BehaviourSearcher searcher = (BehaviourSearcher) node.jjtGetChild(0)
+            .jjtAccept(this, key);
+      searcher.setSearchType(BehaviourSearcher.SearchType.CALL);
+      
+      key.setClassNodeSearcher(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 WithinRestrictionFactory.create(callerExpression.toString(),
+                  EMPTY_ATTRIBUTES, EMPTY_EXCEPTIONS,
+                  new TargetTypeFilter(restriction));
+      }
+      return WithinRestrictionFactory.create(callerExpression.toString());
+   }
+
+   public Object visit(ASTWithincode node, Object data)
+   {
+      return node.jjtGetChild(0).jjtAccept(this, null);
+   }
+
+   public Object visit(ASTHas node, Object data)
+   {
+      SimpleNode n = (SimpleNode) node.jjtGetChild(0);
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      searchKey.addTypeRestriction(new HasBlockRestriction(n));
+      return null;
+   }
+
+   public Object visit(ASTHasField node, Object data)
+   {
+      ASTField astField = (ASTField) node.jjtGetChild(0);
+      ParsedSearchKey searchKey = (ParsedSearchKey) data;
+      searchKey.addTypeRestriction(new HasFieldRestriction(astField));
+      return null;
+   }
+
+   
+   /* COMPONENT AST NODES **********************************************************/
+   
+   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);
+      }
+   }
+   
+   public FieldSearcher visit(ASTField node, Object data)
+   {
+      this.setClassExpression((ParsedSearchKey) data, node.getClazz());
+      StringBuffer expression = new StringBuffer();
+      FieldFilter filter = null;
+      ClassExpression filterTarget = appendType(node.getType(), expression);
+      if (filterTarget != null)
+      {
+         filter = new FieldTypeFilter(filterTarget);
+      }
+      expression.append(' ');
+      expression.append(node.getFieldIdentifier().getOriginal());
+      return new FieldSearcher(expression.toString(), node.getAttributes(), filter);
+   }
+
+   public Object visit(ASTConstructor node, Object data)
+   {
+      StringBuffer expression = new StringBuffer();
+      BehaviourFilter behaviourFilter = visit(node, expression, (ParsedSearchKey) data);
+      if (data == null)
+      {
+         if (behaviourFilter == null)
+         {
+            return WithinRestrictionFactory.create(expression.toString(),
+                  node.getAttributes(), node.getExceptions());
+         }
+         else
+         {
+            return WithinRestrictionFactory.create(expression.toString(),
+                  node.getAttributes(), node.getExceptions(), behaviourFilter);
+         }
+      }
+      return new BehaviourSearcher(expression.toString(), node.getAttributes(), node
+            .getExceptions(), behaviourFilter, false);   
+   }
+
+   public Object visit(ASTMethod node, Object data)
+   {
+      StringBuffer expression = new StringBuffer();
+      BehaviourFilter behaviourFilter = visit(node, expression, ((ParsedSearchKey) data));
+      if (data == null)
+      {
+         if (behaviourFilter != null)
+         {
+            return WithinRestrictionFactory.create(expression.toString(),
+                  node.getAttributes(), node.getExceptions(), behaviourFilter);
+         }
+         else
+         {
+            return WithinRestrictionFactory.create(expression.toString(),
+                  node.getAttributes(), node.getExceptions());
+         }
+      }
+      return new BehaviourSearcher(expression.toString(), node.getAttributes(), node
+            .getExceptions(), behaviourFilter, true);
+   }
+
+   public Object visit(ASTException node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTAttribute node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTParameter node, Object data)
+   {
+      StringBuffer buffer = (StringBuffer) data;
+      ClassExpression expression = node.getType();
+      if (expression.isAnnotation() || expression.isInstanceOf()
+            || expression.isInstanceOfAnnotated())
+      {
+         buffer.append("* ");
+         return expression;
+      }
+      if (expression.isTypedef())
+      {
+         buffer.append(TypedefParser.parse(expression));
+         buffer.append(' ');
+         return expression;
+      }
+      buffer.append(node.getTypeExpression()).append(' ');
+      return null;
+   }
+
+   public Object visit(ASTAllParameter node, Object data)
+   {
+      return "*";
+   }
+
+   /* HELPER METHODS ***************************************************************/
+
+   public BehaviourFilter visit(ASTConstructor node, StringBuffer expression, ParsedSearchKey searchKey)
+   {
+      // behaviour filter
+      BehaviourFilter behaviourFilter = null;
+      
+      // check target type
+      if (searchKey == null)
+      {
+         ClassExpression typeFilter = appendType(node.getClazz(), expression);
+         if (typeFilter != null)
+         {
+            behaviourFilter = new TargetTypeFilter(typeFilter);
+         }
+         expression.append('.');
+      }
+      else
+      {
+         this.setClassExpression(searchKey, node.getClazz());
+      }
+      
+      // check identifier
+      IdentifierExpression annotationExp = node.getConstructorAnnotation();
+      if (annotationExp == null)
+      {
+         expression.append("new");
+      }
+      else
+      {
+         expression.append(annotationExp.getOriginal());
+      }
+      
+      BehaviourFilter parameterFilter = printParameters(expression, node);
+      if (parameterFilter != null)
+      {
+         if (behaviourFilter == null)
+         {
+            behaviourFilter = parameterFilter;
+         }
+         else
+         {
+            behaviourFilter = new CompositeFilter(behaviourFilter, parameterFilter);
+         }
+      }
+      return behaviourFilter;
+   }
+   
+   private BehaviourFilter visit(ASTMethod node, StringBuffer expression, ParsedSearchKey searchKey)
+   {
+      // behaviour filter
+      BehaviourFilter behaviourFilter = null;
+      
+      // check return type
+      ClassExpression returnFilter = appendType(node.getReturnType(), expression);
+      if (returnFilter != null)
+      {
+         behaviourFilter = new ReturnTypeFilter(returnFilter);
+      }
+      expression.append(' ');
+      
+      // check target type
+      if(searchKey == null)
+      {
+         ClassExpression typeFilter = appendType(node.getClazz(), expression);
+         if (typeFilter != null)
+         {
+            if (behaviourFilter == null)
+            {
+               behaviourFilter = new TargetTypeFilter(typeFilter);
+            }
+            else
+            {
+               behaviourFilter = new CompositeFilter(behaviourFilter, new TargetTypeFilter(typeFilter));
+            }
+         }
+         expression.append('.');
+      }
+      else
+      {
+         this.setClassExpression(searchKey, node.getClazz());
+      }
+      
+      
+      // check identifier
+      IdentifierExpression identifier = node.getMethodIdentifier();
+      switch (identifier.getType())
+      {
+         case PATTERN:
+         case ANNOTATION:
+            expression.append(node.getMethodExpr());
+            break;
+         case IMPLEMENTS:
+         case IMPLEMENTING:
+            expression.append('*');
+            if (behaviourFilter != null)
+            {
+               behaviourFilter = new CompositeFilter(behaviourFilter, new OverridenMethodFilter(identifier));
+            }
+            else
+            {
+               behaviourFilter = new OverridenMethodFilter(identifier);
+            }
+      }
+      
+      // check parameters
+      BehaviourFilter parameterFilter = printParameters(expression, node);
+      if (parameterFilter != null)
+      {
+         if (behaviourFilter != null)
+         {
+            behaviourFilter = new CompositeFilter(behaviourFilter, parameterFilter);
+         }
+         else
+         {
+            behaviourFilter = parameterFilter;
+         }
+      }
+      
+      // result
+      return behaviourFilter;
+   }
+
+
+   
+   private ClassExpression appendType(ClassExpression type, StringBuffer buffer)
+   {
+      // check return type
+      if (type.isPackage())
+      {
+         // TODO Flavia
+         throw new RuntimeException();
+      }
+      if (type.isSimple())
+      {
+         buffer.append(type.getOriginal());
+         return null;
+      }
+      if (type.isTypedef())
+      {
+         buffer.append(TypedefParser.parse(type));
+      }
+      else
+      {
+         buffer.append('*');
+      }
+      return type;
+   }
+   
+   private void setClassExpression(ParsedSearchKey searchKey, ClassExpression classExpression)
+   {
+      if (classExpression.isSimple() || classExpression.isAnnotation())
+      {
+         searchKey.setClassExpression(classExpression.getOriginal(), false);
+      }
+      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.addTypeRestriction(new TypedefRestriction(typedef));
+   }
+
+   private BehaviourFilter printParameters(StringBuffer expression,
+         ASTBehaviour behaviour)
+   {
+      Collection<ASTParameter> parameters = behaviour.getParameters();
+      expression.append('(');
+      int startLength = expression.length();
+      boolean wildcardFound = false;
+      int currentIndex = 0;
+      PartialParameterFilter filter = null;
+      BehaviourFilter beforeWildcardFilter = null;
+      Iterator<ASTParameter> iterator = parameters.iterator();
+
+      for (ASTParameter parameter = iterator.next(); iterator.hasNext(); parameter = iterator
+            .next(), currentIndex++)
+      {
+         // found wildcard
+         if (parameter.isAnyZeroOrMoreParameters())
+         {
+            // if there are restrictions to be filtered between two wildcards
+            // abort partial filter; use full parameter filter
+            if (wildcardFound && filter != null)
+            {
+               expression.setLength(startLength);
+               expression.append("*)");
+               return new FullParameterFilter(behaviour);
+            }
+            // set flag
+            wildcardFound = true;
+            // if there is a beforeWildcardFilter, save it and reset filter
+            if (filter != null)
+            {
+               beforeWildcardFilter = filter;
+               filter = null;
+            }
+            // add the wildard to the expression
+            expression.append('*');
+         }
+         // no wildcard
+         else
+         {
+            // get the expression of a restriction to be filtered
+            ClassExpression classExpression = (ClassExpression) this.visit(
+                  parameter, expression);
+            // if there is a restriction, add it to the appropriate filter
+            if (classExpression != null)
+            {
+               if (filter == null)
+               {
+                  // initialize filter accordingly to wildcardFound value
+                  filter = wildcardFound ? new DecrescentPartialParameterFilter(
+                        parameters.size()) : new CrescentPartialParameterFilter(
+                        parameters.size());
+               }
+               // add the restriction to the filter
+               filter.addExpression(classExpression, currentIndex);
+            }
+         }
+      }
+      // finish parameter list expression
+      expression.append(')');
+      // if there is a filter to be applied on parameters before wildcard
+      if (beforeWildcardFilter != null)
+      {
+         // and there is a filter to be applied on parameters after wildcard
+         if (filter != null)
+         {
+            // use composite filter
+            return new CompositeFilter(beforeWildcardFilter, filter);
+         }
+         // otherwise, use the beforeWildcardFilter
+         return beforeWildcardFilter;
+      }
+      // use current filter (may be null)
+      return filter;
+   }
+
+   
+   /**** OTHER METHODS ****/
+   
+   public Object visit(SimpleNode node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTExecutionOnly node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTBoolean node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   
+   public Object visit(ASTCFlowExpression node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTCFlowBoolean node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTNotCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTCompositeCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTSubCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTAndCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTOrCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+
+   public Object visit(ASTCFlow node, Object data)
+   {
+      throw new RuntimeException("This method should not be called");
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/Searcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,31 @@
+/*
+ * 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.JoinPointInfo;
+
+interface Searcher<N>
+{
+   public void search(N node, Collection<JoinPointInfo> searchResult);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SimpleSearchKey.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,134 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+abstract class SimpleSearchKey extends ParsedSearchKey
+{
+   protected ArrayList<TypeRestriction> typeRestrictions;
+   protected ArrayList<WithinRestriction> withinRestrictions;
+   protected ArrayList<ParsedSearchKey> negativeSearchKeys;
+   private Object lastElementAdded = null;
+   
+   public void addTypeRestriction(TypeRestriction typeRestriction)
+   {
+      if (typeRestrictions == null)
+      {
+         typeRestrictions = new ArrayList<TypeRestriction>(1);
+      }
+      typeRestrictions.add(typeRestriction);
+      lastElementAdded = typeRestriction;
+   }
+   
+   public Collection<TypeRestriction> getTypeRestrictions()
+   {
+      return this.typeRestrictions;
+   }
+   
+   public void addWithinRestriction(WithinRestriction withinRestriction)
+   {
+      if (withinRestrictions == null)
+      {
+         withinRestrictions = new ArrayList<WithinRestriction>(1);
+      }
+      withinRestrictions.add(withinRestriction);
+      lastElementAdded = withinRestriction;
+   }
+   
+   Collection<WithinRestriction> getWithinRestrictions()
+   {
+      return this.withinRestrictions;
+   }
+   
+   public void addNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      if (this.negativeSearchKeys != null)
+      {
+         this.negativeSearchKeys = new ArrayList<ParsedSearchKey>(1);
+      }
+      this.negativeSearchKeys.add(searchKey);
+      this.lastElementAdded = searchKey;
+   }
+
+   public Object getLastAddedElement()
+   {
+      return this.lastElementAdded;
+   }
+
+   public void replaceTypeRestriction(TypeRestriction restriction)
+   {
+      this.typeRestrictions.set(typeRestrictions.size() -1, restriction);
+   }
+
+   public void replaceWithinRestriction(WithinRestriction restriction)
+   {
+      this.withinRestrictions.set(withinRestrictions.size() -1, restriction);
+   }
+   
+   public void replaceNegativeSearchKey(ParsedSearchKey searchKey)
+   {
+      this.negativeSearchKeys.set(negativeSearchKeys.size() -1, searchKey);
+   }
+   
+   public void merge(SimpleSearchKey simpleSearchKey)
+   {
+      if (simpleSearchKey.typeRestrictions != null)
+      {
+         if (this.typeRestrictions == null)
+         {
+            this.typeRestrictions = simpleSearchKey.typeRestrictions;
+         }
+         else
+         {
+            this.typeRestrictions.addAll(simpleSearchKey.typeRestrictions);
+         }
+      }
+      if (simpleSearchKey.withinRestrictions != null)
+      {
+         if (this.withinRestrictions == null)
+         {
+            this.withinRestrictions = simpleSearchKey.withinRestrictions;
+         }
+         else
+         {
+            this.withinRestrictions.addAll(simpleSearchKey.withinRestrictions);
+         }
+      }
+      if (simpleSearchKey.negativeSearchKeys != null)
+      {
+         if (this.negativeSearchKeys == null)
+         {
+            this.negativeSearchKeys = simpleSearchKey.negativeSearchKeys;
+         }
+         else
+         {
+            this.negativeSearchKeys.addAll(simpleSearchKey.negativeSearchKeys);
+         }
+      }
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/SubtypeSearcher.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,46 @@
+/*
+ * 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.JoinPointInfo;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class SubtypeSearcher implements ClassNodeSearcher
+{
+   ClassNodeSearcher internalSearcher;
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.Searcher#search(java.lang.Object, java.util.Collection)
+    */
+   public void search(ClassNode node, Collection<JoinPointInfo> searchResult)
+   {
+      for (ClassNode classNode: node.getDirectSubtypes())
+      {
+         internalSearcher.search(classNode, searchResult);
+      }
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypeRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,61 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+
+interface TypeRestriction {
+
+   public boolean satisfies(Class target, Advisor advisor);
+}
+
+class NegativeTypeRestriction implements TypeRestriction
+{
+   private TypeRestriction typeRestriction;
+   public NegativeTypeRestriction(TypeRestriction typeRestriction)
+   {
+      this.typeRestriction = typeRestriction;
+   }
+   
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      return !typeRestriction.satisfies(target, advisor);
+   }
+}
+
+class DisjunctiveTypeRestriction implements TypeRestriction
+{
+   private TypeRestriction typeRestriction1;
+   private TypeRestriction typeRestriction2;
+   public DisjunctiveTypeRestriction(TypeRestriction typeRestriction1,
+         TypeRestriction typeRestriction2)
+   {
+      this.typeRestriction1 = typeRestriction1;
+      this.typeRestriction2 = typeRestriction2;
+   }
+   
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      return typeRestriction1.satisfies(target, advisor) ||
+         typeRestriction2.satisfies(target, advisor);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefParser.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefParser.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefParser.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,307 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.pointcut.Typedef;
+import org.jboss.aop.pointcut.TypedefExpression;
+import org.jboss.aop.pointcut.ast.ASTAllParameter;
+import org.jboss.aop.pointcut.ast.ASTAnd;
+import org.jboss.aop.pointcut.ast.ASTAttribute;
+import org.jboss.aop.pointcut.ast.ASTBoolean;
+import org.jboss.aop.pointcut.ast.ASTClass;
+import org.jboss.aop.pointcut.ast.ASTComposite;
+import org.jboss.aop.pointcut.ast.ASTConstructor;
+import org.jboss.aop.pointcut.ast.ASTException;
+import org.jboss.aop.pointcut.ast.ASTField;
+import org.jboss.aop.pointcut.ast.ASTHas;
+import org.jboss.aop.pointcut.ast.ASTHasField;
+import org.jboss.aop.pointcut.ast.ASTMethod;
+import org.jboss.aop.pointcut.ast.ASTNot;
+import org.jboss.aop.pointcut.ast.ASTOr;
+import org.jboss.aop.pointcut.ast.ASTParameter;
+import org.jboss.aop.pointcut.ast.ASTStart;
+import org.jboss.aop.pointcut.ast.ASTSub;
+import org.jboss.aop.pointcut.ast.ClassExpression;
+import org.jboss.aop.pointcut.ast.SimpleNode;
+import org.jboss.aop.pointcut.ast.TypeExpressionParserVisitor;
+
+/**
+ *
+ */
+class TypedefParser implements TypeExpressionParserVisitor
+{
+   private static ThreadLocal<TypedefParser> INSTANCE = new ThreadLocal<TypedefParser>() {
+      protected synchronized TypedefParser initialValue() {
+         return  new TypedefParser();
+      }
+   };
+      
+   private Object OR_FOUND = new Object();
+   private enum State {INITIAL, TYPEDEF_REF, OTHER, PREFIX, PACKAGE, DEFINITIVE}; 
+   private State currentState;
+   
+   public static TypedefParser getInstance()
+   {
+      return INSTANCE.get();
+   }
+   
+   private TypedefParser() {}
+   
+   private static String parse(Collection<ClassExpression> classExpressions)
+   {
+      String bestCurrentResult = "*";
+      State bestState = State.INITIAL;
+      TypedefParser instance = INSTANCE.get();
+      for (ClassExpression classExpression: classExpressions)
+      {
+         String parsed = TypedefParser.parse(classExpression);
+         if (parsed.length() != 1)
+         {
+            if (instance.currentState == State.DEFINITIVE)
+            {
+               return parsed;
+            }
+            if (bestState.compareTo(instance.currentState) < 0)
+            {
+               bestCurrentResult = parsed;
+               bestState = instance.currentState;
+            }
+         }
+      }
+      return bestCurrentResult;
+   }
+   
+   public static Typedef getTypedef(ClassExpression classExpression)
+   {
+      String original = classExpression.getOriginal();
+      String typedefName = original.substring("$typedef{".length(),
+            original.lastIndexOf("}"));
+      AspectManager manager = AspectManager.instance(); 
+      return manager.getTypedef(typedefName);
+   }
+   
+   public static String parse(ClassExpression classExpression)
+   {
+      Typedef typedef = getTypedef(classExpression);
+      return parse(typedef);
+   }
+   
+   public static String parse(Typedef typedef)
+   {
+      if (typedef != null && typedef instanceof TypedefExpression)
+      {
+         return TypedefParser.getInstance().parseSearchExpression(typedef);
+      }
+      return "*";
+   }
+   
+   public String parseSearchExpression(Typedef typedef)
+   {
+      this.currentState = State.INITIAL;
+      TypedefExpression typedefExpression = (TypedefExpression) typedef;
+      ASTStart parsed = typedefExpression.getParsedExpression();
+      Object parsedResult = visit(parsed, null);
+      if (currentState.compareTo(State.OTHER) >= 0)
+      {
+         return (String) parsedResult;   
+      }
+      if (currentState == State.TYPEDEF_REF)
+      {
+         return TypedefParser.parse((Collection<ClassExpression>) parsedResult);
+      }
+      return "*";
+   }
+
+   public Object visit(ASTStart node, Object data)
+   {
+      return node.jjtGetChild(0).jjtAccept(this, data);
+   }
+
+   public Object visit(ASTBoolean node, Object data)
+   {
+      return node.jjtGetChild(0).jjtAccept(this, data);
+   }
+
+   public Object visit(ASTComposite node, Object data)
+   {
+      return node.jjtGetChild(0).jjtAccept(this, data);
+   }
+
+   public Object visit(ASTNot node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTSub node, Object data)
+   {
+      State oldState = currentState;
+      Object currentResult = null;
+      for (int i = 0; i < node.jjtGetNumChildren(); i++)
+      {
+         Object result = node.jjtGetChild(i).jjtAccept(this, data);
+         if (result == null)
+         {
+            continue;
+         }
+         if (result == OR_FOUND)
+         {
+            currentState = oldState;
+            return null;
+         }
+         if (currentState == State.TYPEDEF_REF)
+         {
+            if (result instanceof ClassExpression)
+            {
+               if (currentResult == null)
+               {
+                  currentResult = new ArrayList();
+               }
+               ((Collection) currentResult).add(result);
+            }
+            else if (currentResult == null)
+            {
+               currentResult = result;
+            }
+            else
+            {
+               ((Collection) currentResult).addAll((Collection<ClassExpression>) result);
+            }
+         }
+         else
+         {
+            currentResult = result;
+         }
+      }
+      return currentResult;
+   }
+
+   public Object visit(ASTAnd node, Object left)
+   {
+      return node.jjtGetChild(0).jjtAccept(this, null);
+   }
+
+   public Object visit(ASTOr node, Object left)
+   {
+      return OR_FOUND;
+   }
+
+
+   public Object visit(SimpleNode node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTHas node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTHasField node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTClass node, Object data)
+   {
+      ClassExpression classExpression = node.getClazz();
+      if (classExpression.isPackage())
+      {
+         if (currentState.compareTo(State.PACKAGE) >= 0)
+         {
+            return null;
+         }
+         currentState = State.PACKAGE;
+         return classExpression;
+      }
+      if (classExpression.isSimple())
+      {
+         String expression = classExpression.getOriginal();
+         int index = expression.indexOf('*');
+         if (index == -1)
+         {
+            this.currentState = State.DEFINITIVE;
+         }
+         if (index == 0)
+         {
+            if (currentState.compareTo(State.OTHER) >= 0)
+            {
+               return null;
+            }
+            currentState = State.OTHER;
+         }
+         else
+         {
+            if (currentState.compareTo(State.PREFIX) >= 0)
+            {
+               return null;
+            }
+            currentState = State.PREFIX;
+         }
+         return expression;
+      }
+      if (classExpression.isTypedef() && currentState.compareTo(State.TYPEDEF_REF) <= 0)
+      {
+         currentState = State.TYPEDEF_REF;
+         return classExpression;
+      }
+      return null;
+   }
+
+   public Object visit(ASTMethod node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTAttribute node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTConstructor node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTParameter node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTAllParameter node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTField node, Object data)
+   {
+      return null;
+   }
+
+   public Object visit(ASTException node, Object data)
+   {
+      return null;
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/TypedefRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,47 @@
+/*
+ * 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 org.jboss.aop.Advisor;
+import org.jboss.aop.pointcut.Typedef;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+public class TypedefRestriction implements TypeRestriction
+{
+   private Typedef typedef;
+   
+   public TypedefRestriction(Typedef typedef)
+   {
+      this.typedef = typedef;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.joinpoint.graph.TypeRestriction#satisfies(java.lang.Class, org.jboss.aop.Advisor)
+    */
+   public boolean satisfies(Class target, Advisor advisor)
+   {
+      return typedef.matches(advisor, target);
+   }
+}
\ No newline at end of file

Added: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestriction.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestriction.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestriction.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,240 @@
+/*
+ * 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;
+
+
+abstract class WithinRestriction
+{
+   String searchExpression;
+   
+   public WithinRestriction(String searchExpression)
+   {
+      this.searchExpression = searchExpression;
+   }
+   
+   abstract void search(BehaviourNode node, Collection<JoinPointInfo> searchResult);
+}
+
+class OptimizedWithinRestriction extends WithinRestriction
+{
+   public OptimizedWithinRestriction(String searchExpression)
+   {
+      super(searchExpression);
+   }
+   
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      node.searchCallers(searchExpression, searchResult);
+   }
+}
+
+abstract class NonOptimizedWithinRestriction extends WithinRestriction
+{
+   private static ThreadLocal<Collection<JoinPointInfo>> TEMP = new ThreadLocal<Collection<JoinPointInfo>>()
+   {
+      protected synchronized Collection<JoinPointInfo> initialValue()
+      {
+         return new ArrayList<JoinPointInfo>(2);
+      }
+   };
+    
+   public NonOptimizedWithinRestriction(String searchExpression)
+   {
+      super(searchExpression);
+   }
+   
+   public void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Collection<JoinPointInfo> temp = TEMP.get();
+      node.searchCallers(searchExpression, 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);
+   
+}
+
+class AttExcWithinRestriction extends NonOptimizedWithinRestriction
+{
+   private Collection<ASTAttribute> attributes;
+   private Collection<ASTException> exceptions;
+   public AttExcWithinRestriction(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());
+   }
+}
+
+class FilteredWithinRestriction extends NonOptimizedWithinRestriction
+{
+   private BehaviourFilter behaviourFilter;
+   
+   public FilteredWithinRestriction(String searchExpression, BehaviourFilter filter)
+   {
+      super(searchExpression);
+      this.behaviourFilter = filter;
+   }
+   
+   protected boolean accept(Method method)
+   {
+      return behaviourFilter.accept(method);
+   }
+   
+   protected boolean accept(Constructor constructor)
+   {
+      return behaviourFilter.accept(constructor);
+   }
+}
+
+class AttExcFilteredWithinRestriction extends NonOptimizedWithinRestriction
+{
+   private Collection<ASTAttribute> attributes;
+   private Collection<ASTException> exceptions;
+   private BehaviourFilter behaviourFilter;
+   
+   public AttExcFilteredWithinRestriction(String searchExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
+         BehaviourFilter 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);
+   }
+}
+
+class NegativeWithinRestriction extends WithinRestriction
+{
+   private WithinRestriction withinRestriction;
+   
+   public NegativeWithinRestriction(WithinRestriction withinRestriction)
+   {
+      super(null);
+      this.withinRestriction = withinRestriction;
+   }
+
+   void search(BehaviourNode 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);
+   }
+}
+
+class DisjunctiveWithinRestriction extends WithinRestriction
+{
+   private WithinRestriction withinRestriction1;
+   private WithinRestriction withinRestriction2;
+   
+   public DisjunctiveWithinRestriction(WithinRestriction withinRestriction1, WithinRestriction withinRestriction2)
+   {
+      super(null);
+      this.withinRestriction1 = withinRestriction1;
+      this.withinRestriction2 = withinRestriction2;
+   }
+
+   void search(BehaviourNode node, Collection<JoinPointInfo> searchResult)
+   {
+      Set<JoinPointInfo> temp = new HashSet<JoinPointInfo>();
+      withinRestriction1.search(node, temp);
+      withinRestriction2.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/WithinRestrictionFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestrictionFactory.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/WithinRestrictionFactory.java	2008-03-11 04:51:15 UTC (rev 70726)
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+/**
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ *
+ */
+class WithinRestrictionFactory
+{
+
+   public static WithinRestriction create(String withinExpression)
+   {
+      return new OptimizedWithinRestriction(withinExpression);
+   }
+   
+   public static WithinRestriction create(String withinExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions)
+   {
+      if (attributes.isEmpty() && exceptions.isEmpty())
+      {
+         return new OptimizedWithinRestriction(withinExpression);
+      }
+      else
+      {
+         return new AttExcWithinRestriction(withinExpression, attributes, exceptions);
+      }
+   }
+   
+   public static WithinRestriction create(String withinExpression,
+         Collection<ASTAttribute> attributes, Collection<ASTException> exceptions,
+         BehaviourFilter behaviourFilter)
+   {
+      if (attributes.isEmpty() && exceptions.isEmpty())
+      {
+         return new FilteredWithinRestriction(withinExpression, behaviourFilter);
+      }
+      else
+      {
+         return new AttExcFilteredWithinRestriction(withinExpression, attributes,
+                     exceptions, behaviourFilter);
+      }
+   }  
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list