[jboss-cvs] JBossAS SVN: r63481 - in projects/aop/trunk/aop/docs/examples: aspect and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 12 14:47:19 EDT 2007


Author: flavia.rainone at jboss.com
Date: 2007-06-12 14:47:19 -0400 (Tue, 12 Jun 2007)
New Revision: 63481

Modified:
   projects/aop/trunk/aop/docs/examples/annotated-parameters/jboss-aop.xml
   projects/aop/trunk/aop/docs/examples/aspect/aspect.html
   projects/aop/trunk/aop/docs/examples/beforeafter/beforeafter.html
   projects/aop/trunk/aop/docs/examples/overloaded-advices/JoinPointAspect.java
   projects/aop/trunk/aop/docs/examples/overloaded-advices/jboss-aop.xml
   projects/aop/trunk/aop/docs/examples/overloaded-advices/overloaded-advices.html
   projects/aop/trunk/aop/docs/examples/return-types/jboss-aop.xml
Log:
[JBAOP-384] Updated examples to use the new tag around only on xml files that mix different advice types.

Modified: projects/aop/trunk/aop/docs/examples/annotated-parameters/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/docs/examples/annotated-parameters/jboss-aop.xml	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/annotated-parameters/jboss-aop.xml	2007-06-12 18:47:19 UTC (rev 63481)
@@ -19,7 +19,7 @@
    <bind pointcut="execution(POJO->new(java.lang.String))">
       <after name="afterJoinPoint" aspect="Aspect"/>
       <before name="beforeConstructorArg" aspect="Aspect"/>
-      <advice name="aroundConstructorArg" aspect="Aspect"/>
+      <around name="aroundConstructorArg" aspect="Aspect"/>
    </bind>
    
    <bind pointcut="execution(* POJO->someMethod(..))">
@@ -30,7 +30,7 @@
    
    <bind pointcut="execution(* POJO->method(..))">
       <after name="afterArg" aspect="Aspect"/>
-      <advice name="aroundArgs" aspect="Aspect"/>
+      <around name="aroundArgs" aspect="Aspect"/>
       <after name="afterArgs" aspect="Aspect"/>
    </bind>
 
@@ -41,7 +41,7 @@
    </bind>
       
    <bind pointcut="call(* POJO->calledMethod(..))">
-      <advice name="aroundJoinPoint" aspect="Aspect"/>
+      <around name="aroundJoinPoint" aspect="Aspect"/>
       <before name="beforeTarget" aspect="Aspect"/>
       <after name="afterTarget" aspect="Aspect"/>
       <before name="beforeCaller" aspect="Aspect"/>
@@ -49,8 +49,8 @@
    </bind>
    
    <bind pointcut="call(* POJO->callMethod())">
-      <advice name="aroundCaller" aspect="Aspect"/>
-      <advice name="aroundArgs" aspect="Aspect"/>
+      <around name="aroundCaller" aspect="Aspect"/>
+      <around name="aroundArgs" aspect="Aspect"/>
    </bind>
          
 </aop>
\ No newline at end of file

Modified: projects/aop/trunk/aop/docs/examples/aspect/aspect.html
===================================================================
--- projects/aop/trunk/aop/docs/examples/aspect/aspect.html	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/aspect/aspect.html	2007-06-12 18:47:19 UTC (rev 63481)
@@ -20,6 +20,7 @@
 </p><p>
 You can also <a href="../overloaded-advices/overloaded-advices.html">overload methods</a>.
 </p><p>
+<a name="aspectxml"/>
 <h4>Scope and XML definitions</h4>
 
 You can specify the scope of an aspect's instance.  By Scope, I mean whether the aspect is allocated once per JVM, once per Class it is tied to, or once per Instance.  You must declare an aspect definition in XML.  The Scope is optional and defaults to once per JVM.  Open up jboss-aop.xml to see declarations of aspects.

Modified: projects/aop/trunk/aop/docs/examples/beforeafter/beforeafter.html
===================================================================
--- projects/aop/trunk/aop/docs/examples/beforeafter/beforeafter.html	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/beforeafter/beforeafter.html	2007-06-12 18:47:19 UTC (rev 63481)
@@ -44,20 +44,62 @@
 <h3>Binding Before/After Advices</h3>
 
 </p><p>
-To bind a before/after advice to a pointcut, you only need to declare an xml binding as
-follows (open up <tt>jboss-aop.xml</tt> to see this example):
+To bind a before and after advices to a pointcut, you need to follow this structure:
 </p><p>
 <pre>
+&lt;aspect class="<i>aspect class name</i>" scope="<i>scope of the aspect</i>"&gt;
+
+&lt;bind pointcut="<i>pointcut expression</i>"&gt;
+      &lt;before name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+&lt;/bind&gt;
+   
+&lt;bind pointcut="<i>pointcut expression</i>"&gt;
+      &lt;after name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+&lt;/bind&gt;
+</pre>
+</p><p>
+As you can see, it is as simple as declaring a usual <tt>&lt;bind&gt;</tt> tag, and
+adding to it <tt>&lt;before&gt;</tt> and <tt>&lt;after&gt;</tt> tags for before and
+after advices respectively. Not forgetting that we need to declare each aspect class
+with the <tt>&lt;aspect&gt;</tt> tag (in the same way shown
+<a href="../aspect/aspect.html#aspectxml"/> before</a>). We can also mix interceptor
+declarations and around, before, and after advices declarations in a single binding,
+like follows:
+</p><p>
+<pre>
+&lt;bind pointcut="<i>pointcut expression</i>"&gt;
+      &lt;interceptor class="<i>interceptor class name</i>"/&gt;
+      &lt;advice name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+      &lt;before name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+      &lt;after name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+&lt;/bind&gt;
+</pre>
+</p><p>
+The tag <tt>&lt;advice&gt;</tt> above has been introduced by the
+<a href="../aspect/aspect.html">previous example</a>, and refers to
+advices of the default type, around. As an alternative, you can specify explicitly
+the type of an advice to be around by using the tag <tt>&lt;around&gt;</tt> as follows:
+</p><p>
+<pre>
+&lt;bind pointcut="<i>pointcut expression</i>"&gt;
+      &lt;around name="<i>advice name</i>" aspect="<i>aspect class name</i>"/&gt;
+&lt;/bind&gt;
+</pre>
+<p></p>
+For clarity, we have opted to use the tag <tt>&lt;around&gt;</tt> instead of
+<tt>&lt;advice&gt;</tt> on all examples of this tutorial that involve typed advices.
+<p></p>
+Open up <tt>jboss-aop.xml</tt> to see an example of binding with typed advices:
+</p><p>
+<pre>
 &lt;bind pointcut="execution(public void $instanceof{Transaction}-&gt;run())"&gt;
       &lt;before name="beforeAdvice" aspect="mypackage.MutexAspect"/&gt;
       &lt;after name="afterAdvice" aspect="mypackage.MutexAspect"/&gt;
 &lt;/bind&gt;
 </pre>
 </p><p>
-As you can see, you just need to declare a usual bind tag, and add to it
-<tt>&lt;before&gt;</tt> and <tt>&lt;after&gt;</tt> tags for before and after advices
-respectively. We can also mix interceptor declarations and around, before, and
-after advices declarations in a single binding.
+For more examples on typed advices bindings, refer the <tt>jboss-aop.xml</tt> file
+of our <a href="../annotated-parameters/annotated-parameters.html">next example</a>
 </p><p>
 
 <h3>Around, Before and After Advices</h3>

Modified: projects/aop/trunk/aop/docs/examples/overloaded-advices/JoinPointAspect.java
===================================================================
--- projects/aop/trunk/aop/docs/examples/overloaded-advices/JoinPointAspect.java	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/overloaded-advices/JoinPointAspect.java	2007-06-12 18:47:19 UTC (rev 63481)
@@ -69,13 +69,13 @@
    public void otherTypeOfAdvice(@JoinPoint MethodExecution joinPoint)
    {
       System.out.println(">>> otherTypeOfAdvice on method execution: " +
-            joinPoint.getAdvisedMethod().getName());
+            joinPoint.getMethod().getName());
    }
       
    public void otherTypeOfAdvice(@JoinPoint FieldAccess joinPoint)
    {
       System.out.println(">>> otherTypeOfAdvice on field" +
          (joinPoint.isRead()? "read: ": "write: ") +
-         joinPoint.getAdvisedField().getName());
+         joinPoint.getField().getName());
    }
 }
\ No newline at end of file

Modified: projects/aop/trunk/aop/docs/examples/overloaded-advices/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/docs/examples/overloaded-advices/jboss-aop.xml	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/overloaded-advices/jboss-aop.xml	2007-06-12 18:47:19 UTC (rev 63481)
@@ -5,7 +5,7 @@
 
    <bind pointcut="all(POJO)">
       <before name="otherTypeOfAdvice" aspect="JoinPointAspect"/>
-      <advice name="aroundAdvice" aspect="JoinPointAspect"/>
+      <around name="aroundAdvice" aspect="JoinPointAspect"/>
    </bind>
 
    <aspect class="MixedParametersAspect" scope="PER_VM"/>

Modified: projects/aop/trunk/aop/docs/examples/overloaded-advices/overloaded-advices.html
===================================================================
--- projects/aop/trunk/aop/docs/examples/overloaded-advices/overloaded-advices.html	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/overloaded-advices/overloaded-advices.html	2007-06-12 18:47:19 UTC (rev 63481)
@@ -46,7 +46,7 @@
 ___________________________
 
 &lt;bind pointcut="all(POJO)"&gt;
-   &lt;advice name="aroundAdvice" aspect="JoinPointAspect"/&gt;
+   &lt;around name="aroundAdvice" aspect="JoinPointAspect"/&gt;
 &lt;/bind&gt;
 </pre>
 </p><p>

Modified: projects/aop/trunk/aop/docs/examples/return-types/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/docs/examples/return-types/jboss-aop.xml	2007-06-12 17:54:32 UTC (rev 63480)
+++ projects/aop/trunk/aop/docs/examples/return-types/jboss-aop.xml	2007-06-12 18:47:19 UTC (rev 63481)
@@ -4,22 +4,22 @@
    <aspect class="Aspect" scope="PER_VM"/>
 
    <bind pointcut="execution(int POJO->*())">
-      <advice name="aroundDefaultSignature" aspect="Aspect"/>
-      <advice name="aroundAnnotatedParam" aspect="Aspect"/>
+      <around name="aroundDefaultSignature" aspect="Aspect"/>
+      <around name="aroundAnnotatedParam" aspect="Aspect"/>
       <after name="afterOverwriteReturnValue" aspect="Aspect"/>
       <after name="afterVoid" aspect="Aspect"/>
    </bind>
    
    <bind pointcut="execution(java.util.List POJO->*())">
-      <advice name="aroundDefaultSignature" aspect="Aspect"/>
-      <advice name="aroundCollection" aspect="Aspect"/>
+      <around name="aroundDefaultSignature" aspect="Aspect"/>
+      <around name="aroundCollection" aspect="Aspect"/>
       <after name="afterUnmodifiableList" aspect="Aspect"/>
       <after name="afterVoid" aspect="Aspect"/>
    </bind>
    
    <bind pointcut="execution(void POJO->*())">
-      <advice name="aroundDefaultSignature" aspect="Aspect"/>
-      <advice name="aroundVoid" aspect="Aspect"/>
+      <around name="aroundDefaultSignature" aspect="Aspect"/>
+      <around name="aroundVoid" aspect="Aspect"/>
       <after name="afterVoid" aspect="Aspect"/>
    </bind>
    




More information about the jboss-cvs-commits mailing list