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

neo anderson <[email protected]> Sat, 13 Sep 2008 02:35:04 -0700 (PDT)
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
But I read the aspectj document, it seems like aspectj 5 does not support
run-time weaving, doesn't it?


Alexandre Vasseur wrote:
>=20
> Hi
> I advise you to use AspectJ instead since merged AspectWerkz with it.
> Alex
>=20
> 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
>> class
>> 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=E2=80=A6?
>>
>> Please help me to run this=E2=80=A6
>>
>>
>> Thakns lot.
>>
>>
>> Thanks and Regards,
>> Kumaravel Ganesan
>> HP R&D.
>>
>>
>>
>>
>=20
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>=20
>     http://xircles.codehaus.org/manage_email
>=20
>=20
>=20
>=20

--=20
View this message in context: http://www.nabble.com/Question-on-Runtime-Wea=
ving-Example-tp18637735p19468969.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