Re: [aspectwerkz-user] Question on Runtime Weaving Example
"Alexandre Vasseur" <[email protected]> Thu, 24 Jul 2008 20:38:37 +0200
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
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=85? > > Please help me to run this=85 > > > Thakns lot. > > > Thanks and Regards, > Kumaravel Ganesan > HP R&D. > > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email