[jboss-cvs] JBossAS SVN: r92594 - projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 19 21:32:17 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-08-19 21:32:16 -0400 (Wed, 19 Aug 2009)
New Revision: 92594
Modified:
projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointClassifier.java
projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointFullClassifier.java
projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointSimpleClassifier.java
Log:
[JBAOP-747] Added a method to describe the joinpoint being matched: JoinpointClassifier.Matcher.getJoinpointDescription. This method is now used by
logging calls made by JoinpointSimpleClassifier and JoinpointFullClassifier.
Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointClassifier.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointClassifier.java 2009-08-20 01:26:03 UTC (rev 92593)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointClassifier.java 2009-08-20 01:32:16 UTC (rev 92594)
@@ -58,9 +58,9 @@
protected interface Matcher
{
/**
- * Checks if <code>pointcut</code> matches a joinpoint. The joinpoint this method refers
- * to is dependend of the <code>Macther</code> interface implementer. All that is known
- * about the joinpoint is the class member related to it: <code>member</code>.
+ * Checks if <code>pointcut</code> matches a joinpoint. The type of joinpoint this method
+ * matches is an implementation detail.
+ *
* @param pointcut the pointcut whose matching will be tested.
* @param advisor advisor associated with the class declaring <code>member</code>.
* @param member class member related to the joinpoint.
@@ -68,6 +68,16 @@
* @throws NotFoundException thrown if the matching of pointcut fails.
*/
boolean matches(Pointcut pointcut, Advisor advisor, CtMember member) throws NotFoundException;
+
+ /**
+ * Returns a description of the joinpoint represented by {@code member}.
+ *
+ * @param member a member to be matched by this matcher
+ * @return a description of the joinpoint to be matched by this matcher using
+ * {@code member} as a parameter
+ * @see #matches(Pointcut, Advisor, CtMember)
+ */
+ String getJoinpointDescription(CtMember member);
}
/**
@@ -79,6 +89,11 @@
{
return pointcut.matchesGet(advisor, (CtField) member);
}
+
+ public String getJoinpointDescription(CtMember member)
+ {
+ return member + " field read joinpoint";
+ }
};
/**
@@ -90,6 +105,11 @@
{
return pointcut.matchesSet(advisor, (CtField) member);
}
+
+ public String getJoinpointDescription(CtMember member)
+ {
+ return member + " field write joinpoint";
+ }
};
/**
@@ -101,6 +121,11 @@
{
return pointcut.matchesExecution(advisor, (CtConstructor) member);
}
+
+ public String getJoinpointDescription(CtMember member)
+ {
+ return member + " constructor execution joinpoint";
+ }
};
/**
@@ -112,6 +137,11 @@
{
return pointcut.matchesExecution(advisor, (CtMethod) member);
}
+
+ public String getJoinpointDescription(CtMember member)
+ {
+ return member + " method execution joinpoint";
+ }
};
protected interface BindingCollectionAccessor
Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointFullClassifier.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointFullClassifier.java 2009-08-20 01:26:03 UTC (rev 92593)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointFullClassifier.java 2009-08-20 01:32:16 UTC (rev 92594)
@@ -27,8 +27,10 @@
import javassist.NotFoundException;
import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
import org.jboss.aop.pointcut.Pointcut;
import org.jboss.aop.pointcut.PointcutInfo;
+import org.jboss.aop.util.logging.AOPLogger;
/**
* This class fully classifies joinpoints as <code>JoinpointClassification.PREPARED</code>
@@ -41,6 +43,8 @@
*/
public class JoinpointFullClassifier extends JoinpointClassifier
{
+ private static final AOPLogger logger = AOPLogger.getLogger(JoinpointSimpleClassifier.class);
+
/**
* Classifies the execution of a joinpoint. The joinpoint being classified
* is identified by <code>matcher</code>.
@@ -67,6 +71,10 @@
}
Pointcut pointcut = pointcutInfo.getPointcut();
if (joinpointMatcher.matches(pointcut, advisor, member)) {
+ if (AspectManager.verbose && logger.isDebugEnabled())
+ {
+ logger.debug(joinpointMatcher.getJoinpointDescription(member) + " matches pointcut: " + pointcut.getExpr());
+ }
// only prepare if pointcut isn't associated with a binding
if (pointcutInfo.getBinding() == null)
{
@@ -88,6 +96,10 @@
}
}
}
+ if (AspectManager.verbose && logger.isDebugEnabled() && classification == JoinpointClassification.NOT_INSTRUMENTED)
+ {
+ logger.debug(joinpointMatcher.getJoinpointDescription(member)+ " matches no pointcuts");
+ }
return classification;
}
}
\ No newline at end of file
Modified: projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointSimpleClassifier.java
===================================================================
--- projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointSimpleClassifier.java 2009-08-20 01:26:03 UTC (rev 92593)
+++ projects/aop/branches/Branch_2_1/aop/src/main/java/org/jboss/aop/instrument/JoinpointSimpleClassifier.java 2009-08-20 01:32:16 UTC (rev 92594)
@@ -64,14 +64,14 @@
{
if (AspectManager.verbose && logger.isDebugEnabled())
{
- logger.debug(member + " matches pointcut: " + pointcut.getExpr());
+ logger.debug(joinpointMatcher.getJoinpointDescription(member) + " matches pointcut: " + pointcut.getExpr());
}
return JoinpointClassification.WRAPPED;
}
}
if (AspectManager.verbose && logger.isDebugEnabled())
{
- logger.debug(member + " matches no pointcuts");
+ logger.debug(joinpointMatcher.getJoinpointDescription(member)+ " matches no pointcuts");
}
return JoinpointClassification.NOT_INSTRUMENTED;
}
More information about the jboss-cvs-commits
mailing list