[aspectwerkz-user] Aspect selection due to caller (newbe)

titöf <[email protected]> Wed, 19 Dec 2007 03:23:57 -0800 (PST)
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Hi!

I have two aspects (A1 and A2) which both derive from a base class. Is it
possible to define these aspects in a way that depending on the calling
class A1 or A2 is used? I tried several things in the pointcut definition
but always the first aspect mentioned in the aop.xml file gets used... 

So for beeing in class "myotherpackage.Sample_AOPConfiguration" I want to
use aspect "A1" and for the the second class
"myotheroackage.TestCase_AOPConfiguration" I want to use "A2". Consider this
like an attempt to use a different aspect implementation in testing/mocking
than production or something similar.

My "aop.xml"


<aspectwerkz>
    <system id="MySystem">
        <package name="mypackage">
            <aspect class="A1">
                <pointcut name="pcn1"
                         
expression="within(myotherpackage.Sample_AOPConfiguration) and
                          execution(@mypackage.MyInject mypackage.ResultData
*.*.get(..))"/>
            </aspect>

            <aspect class="A2">
                <pointcut name="pcn2"
expression="within(myotherpackage.TestCase_AOPConfiguration) and
                          execution(@mypackage.MyInject myPackage.ResultData
*.*.get(..))"/>
            </aspect>
        </package>
    </system>
</aspectwerkz>


Thanks in advance

Jens
-- 
View this message in context: http://www.nabble.com/Aspect-selection-due-to-caller-%28newbe%29-tp14415135p14415135.html
Sent from the AspectWerkz - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email