RE: [aspectwerkz-user] Question on Runtime Weaving Example

"Ganesan, Kumaravel (HP STSD-Labs)" <[email protected]> Thu, 24 Jul 2008 18:42:51 +0000
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <3F648E4BDEC90248B0AA21B7E67A11A02EE9D9B5E3@GVW1162EXB.americas.hpqcorp.net>
Thanks Alex.

But can I perform runtime/online weaving in aspectJ?


Thanks and Regards,
Kumaravel Ganesan

-----Original Message-----
From: Alexandre Vasseur [mailto:[email protected]]
Sent: Friday, July 25, 2008 12:09 AM
To: [email protected]
Subject: Re: [aspectwerkz-user] Question on Runtime Weaving Example

Hi
I advise you to use AspectJ instead since merged AspectWerkz with it.
Alex

On Thu, Jul 24, 2008 at 8:22 PM, Ganesan, Kumaravel (HP STSD-Labs)
<[email protected]> wrote:
> Hi .
>
> Greetings.
>
> I am new to AspectWerkz.
>
> I am trying with following example(in Eclipse , without Plugin) :
>
>
> Target class:
>
> public class Target {
>
>     public void step1() {
>         System.out.println("  --> invoking step1");
>         step2();
>     }
>
>     public void step2() {
>         System.out.println("  --> invoking step2");
>     }
> }
>
> Aspect Class :
>
> public class Aspect_Tenant1 {
>
>         /**
>      * @Expression execution(void examples.cflow.Target.step1())
>      */
>     Pointcut myDynamicAspect;
>
>
>
>     /**
>      * @Before myDynamicAspect
>      */
>     public Object myAdvice(final JoinPoint joinPoint) throws Throwable {
>         Object result =3D joinPoint.proceed();
>         System.out.println("  --> ADVICE : invoking advice triggered by
> step3 for Tenant 2");
>         return result;
>     }
>
> AOP.XML in META-INF folder under src:
>
> <!DOCTYPE aspectwerkz PUBLIC
>     "-//AspectWerkz//DTD//EN"
>     "http://aspectwerkz.codehaus.org/dtd/aspectwerkz2.dtd">
> <aspectwerkz>
>     <system id=3D"samples">
>         <package name=3D"examples">
>             <aspect class=3D"cflow.Aspect_Tenant1"></aspect>
>         </package>
>     </system>
> </aspectwerkz>
>
>
>
>
> I set JVM argument as
> "-javaagent:C:\aspectwerkz-2.0\lib\aspectwerkz-jdk5-2.0.jar"
>
> Then I am I try to run the following code :
> public class Weaver_Tenant2 {
>         public static void main(String[] args) {
>
>
>              Target t =3D new Target();
>
>              DeploymentHandle handle1 =3D
> Deployer.deploy(Aspect_Tenant1.class);
>
>         t.step1();
>
>                 }
> }
>
> RESULT :
>
>
> AspectWerkz - INFO - Pre-processor
> org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor loaded and
> initialized
> Deployer::INFO - deploying aspect [examples.cflow.Aspect_Tenant2] in clas=
s
> loader [sun.misc.Launcher$AppClassLoader@92e78c]
>   --> invoking step1
>   --> invoking step2
>
>
> Here advice is not weaved.
>
> Am I doing any mistake ? or am I missing any  settings...?
>
> Please help me to run this...
>
>
> Thakns lot.
>
>
> Thanks and Regards,
> Kumaravel Ganesan
> HP R&D.
>
>
>
>

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

    http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email