Question on Runtime Weaving Example

View: New views
4 Messages — Rating Filter:   Alert me  

Question on Runtime Weaving Example

by Ganesan, Kumaravel (HP STSD-Labs) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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 = 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"
<aspectwerkz>
    <system id="samples">
        <package name="examples">
            <aspect class="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 = new Target();
            
             DeploymentHandle handle1 = 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…?
 
Please help me to run this…
 
 
Thakns lot.
 
 
Thanks and Regards,
Kumaravel Ganesan
HP R&D.
 
 
 
 

Re: Question on Runtime Weaving Example

by Alexandre Vasseur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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)
<vel@...> 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 = 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="samples">
>         <package name="examples">
>             <aspect class="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 = new Target();
>
>              DeploymentHandle handle1 =
> 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…?
>
> 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



RE: Question on Runtime Weaving Example

by Ganesan, Kumaravel (HP STSD-Labs) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Alex.

But can I perform runtime/online weaving in aspectJ?


Thanks and Regards,
Kumaravel Ganesan

-----Original Message-----
From: Alexandre Vasseur [mailto:avasseur@...]
Sent: Friday, July 25, 2008 12:09 AM
To: user@...
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)
<vel@...> 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 = 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="samples">
>         <package name="examples">
>             <aspect class="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 = new Target();
>
>              DeploymentHandle handle1 =
> 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...?
>
> 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



Re: Question on Runtime Weaving Example

by neo anderson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

But I read the aspectj document, it seems like aspectj 5 does not support run-time weaving, doesn't it?

Alexandre Vasseur wrote:
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)
<vel@hp.com> 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 = 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="samples">
>         <package name="examples">
>             <aspect class="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 = new Target();
>
>              DeploymentHandle handle1 =
> 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…?
>
> 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