Re: [aspectwerkz-user] Is there a way to get a pointcut name from within an around advic e?

Alexandre Vasseur <[email protected]>
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Hi

You may have an aspect constructor that accepts
org.codehaus.aspectwerkz.AspectContext as single parameter.
From that instance you can access the AspectDefinition that should
contain what you need.

Another option would be to use Annotation defined aspect and access
the annotation using the AspectWerkz Annotations.* API (works on Java
1.4 as well).

Last, another option would be to use
SystemDefinitionContainer.getDefinition(uuid, ClassLoader) that should
contain the AspectDefinitions of the deployed aspects.

Alex


On Apr 8, 2005 3:31 PM, Krasheninnikov, Konstantin
<[email protected]> wrote:
>  
> 
> Hello, 
> 
> Given 
> 
> ... 
>        <aspect class="HelloWorldHijacker"> 
>             <pointcut name="greetMethod" expression="execution(*
> testAOP.HelloWorld2.greet(..))"/> 
>             <advice name="yellifyier" type="around" bind-to="greetMethod"/> 
>        </aspect> 
> 
> ...and 
> 
> public class HelloWorldHijacker { 
>     public Object yellifyier( JoinPoint joinPoint )   { 
>         String ret = null; 
>         try  { 
> 
>             // How to get to the pointcut name (which is "greetMethod") here
> ?? 
> 
>             Object greeting = joinPoint.proceed(); 
>             ret = "<yell>" + greeting + "</yell>"; 
>         } 
>         catch( Throwable e ) { 
>             e.printStackTrace(); 
>         } 
>         return ret; 
>     } 
> } 
> 
> Q: Is there a way to get the pointcut name from within the around advice? 
> 
> Thanks in advance, 
> 
> -krosh- 
> 
> P.S. I am attching the ML subscription reply: 
> 
>  <<WELCOME to [email protected]>> 
> 
> ---------- Forwarded message ----------
> From: [email protected]
> To: "Krasheninnikov, Konstantin "
> <[email protected]>
> Date: Fri, 8 Apr 2005 09:15:19 -0400
> Subject: WELCOME to [email protected]
>  
> 
> Hi! This is the ezmlm program. I'm managing the 
> [email protected] mailing list. 
> 
> I'm working for my owner, who can be reached 
> at [email protected]. 
> 
> Acknowledgment: I have added the address 
> 
>    [email protected] 
> 
> to the user mailing list. 
> 
> Welcome to [email protected]! 
> 
> Please save this message so that you know the address you are 
> subscribed under, in case you later want to unsubscribe or change your 
> subscription address. 
> 
> To unsubscribe, send a message to: 
> 
>    
> <user-unsubscribe-Konstantin.Krasheninnikov=gs.com@aspectwerkz.codehaus.org>
>  
> 
> --- Administrative commands for the user list --- 
> 
> I can handle administrative requests automatically. Please 
> do not send them to the list address! Instead, send 
> your message to the correct command address: 
> 
> For help and a description of available commands, send a message to: 
>    <[email protected]> 
> 
> To subscribe to the list, send a message to: 
>    <[email protected]> 
> 
> To remove your address from the list, just send a message to 
> the address in the ``List-Unsubscribe'' header of any list 
> message. If you haven't changed addresses since subscribing, 
> you can also send a message to: 
>    <[email protected]> 
> 
> or for the digest to: 
>    <[email protected]> 
> 
> For addition or removal of addresses, I'll send a confirmation 
> message to that address. When you receive it, simply reply to it 
> to complete the transaction. 
> 
> If you need to get in touch with the human owner of this list, 
> please send a message to: 
> 
>     <[email protected]> 
> 
> Please include a FORWARDED list message with ALL HEADERS intact 
> to make it easier to help you. 
> 
> --- Enclosed is a copy of the request I received. 
> 
> Return-Path: <[email protected]> 
> Received: (qmail 18015 invoked from network); 8 Apr 2005 13:15:18 -0000 
> Received: from inspood02.gs.com (207.17.37.107) 
>   by codehaus.org with SMTP; 8 Apr 2005 13:15:18 -0000 
> Received: from insvsod02.inz.gs.com (unknown [207.17.36.79]) 
>         by inspood02.gs.com (Postfix) with ESMTP id D52BC24902 
>         for
> <user-sc.1112965996.knhjbkmonfkoplefbobk-Konstantin.Krasheninnikov=gs.com@aspectwerkz.codehaus.org>;
> Fri,  8 Apr 2005 09:15:16 -0400 (EDT) 
> 
> Received: from gsnmp17es.firmwide.corp.gs.com
> (gsnmp17es.firmwide.corp.gs.com [148.86.104.167]) by insvsod02.inz.gs.com
> with ESMTP for
> user-sc.1112965996.knhjbkmonfkoplefbobk-Konstantin.Krasheninnikov=gs.com@aspectwerkz.codehaus.org;
> Fri, 8 Apr 2005 09:15:16 -0400 
> 
> Received: by gsnmp17es.firmwide.corp.gs.com with Internet Mail Service
> (5.5.2657.72) 
>         id <H8R0PKGV>; Fri, 8 Apr 2005 09:15:16 -0400 
> Message-Id:
> <B649D06566185B459613184B8B87794D0EC569F1@gsnmp17es.firmwide.corp.gs.com>
> From: "Krasheninnikov, Konstantin "
> <[email protected]> 
> To:
> user-sc.1112965996.knhjbkmonfkoplefbobk-Konstantin.Krasheninnikov=gs.com@aspectwerkz.codehaus.org
> Subject: RE: confirm subscribe to [email protected] 
> Date: Fri, 8 Apr 2005 09:15:15 -0400 
> MIME-Version: 1.0 
> X-Mailer: Internet Mail Service (5.5.2657.72) 
> Content-Type: text/plain 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.