Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] RE: How to use load time weaving(WeavingURLClassLoader)? (hermod.opstvedt@xxxxxxxxx)

Hi Hermod,


Thanks for your information, but this approach is not what I want, according to
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html
there're 3 ways to enable load-time weaving, your suggestion is #1 agent, but
I would like to use #3 Custom classloader (WeavingURLClassLoader)
.

My application is multi-Classloader application, a sub-component has its own ClassLoader (My App classloader) to load its classes to get working, my intention is to use WeavingURLClassLoader to wrap in My App classloader, so my classes can be weaved at load time.

I want to know how and what I need to do to use
WeavingURLClassLoader.

Thanks

Anfernee

On Fri, Apr 25, 2008 at 10:11 PM, <aspectj-users-request@xxxxxxxxxxx> wrote:
Send aspectj-users mailing list submissions to
       aspectj-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
       aspectj-users-request@xxxxxxxxxxx

You can reach the person managing the list at
       aspectj-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."


Today's Topics:

  1. AJDT 1.5.2 for Eclipse 3.3 now available  (incorporates
     AspectJ 1.6.0) (Andy Clement)
  2. How to use load time weaving? (Anfernee Xu)
  3. RE: How to use load time weaving? (hermod.opstvedt@xxxxxxxxx)
  4. Around Advice Generic (vtitou vergeos)
  5. Re: Around Advice Generic (Eric Bodden)
  6. Re: Around Advice Generic (Dean Wampler)


----------------------------------------------------------------------

Message: 1
Date: Thu, 24 Apr 2008 16:43:50 -0700
From: "Andy Clement" <andrew.clement@xxxxxxxxx>
Subject: [aspectj-users] AJDT 1.5.2 for Eclipse 3.3 now available
       (incorporates AspectJ 1.6.0)
To: aspectj-users@xxxxxxxxxxx,  "AspectJ Development Tools developer
       discussions" <ajdt-dev@xxxxxxxxxxx>
Message-ID:
       <689d61aa0804241643w68f5f2eendb9cdd243c0a6af4@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

AJDT 1.5.2 final is now available for Eclipse 3.3.  This includes
AspectJ1.6.0 final which shipped yesterday.

It is available at the release update site:

http://download.eclipse.org/tools/ajdt/33/update

The download page also includes a link to a downloadable zip version of AJDT:

http://www.eclipse.org/ajdt/downloads/

For more information on AspectJ 1.6.0, see the readme:

http://www.eclipse.org/aspectj/doc/released/README-160.html

The 33 dev update site for AJDT will now host AJDT 1.5.3 builds that
will incorporate early AspectJ1.6.1 builds.

---


------------------------------

Message: 2
Date: Fri, 25 Apr 2008 15:31:49 +0800
From: "Anfernee Xu" <anfernee.xu@xxxxxxxxx>
Subject: [aspectj-users] How to use load time weaving?
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <71e105540804250031o7720f8e7je5d98028e4027ddf@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Hi everyone,

I'm developing an application which will use load time weaving feature, so
that I can control whether my App classes should be weaved at runtime.
I read
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html,
learned AspectJ comes with the WeavingURLClassLoader probably can help me.
but there's no concrete example I can take a look, so could someone please
tell me how to use WeavingURLClassLoader? I have checked the source code,
there's 2
constructors available,

(1)public WeavingURLClassLoader (ClassLoader parent)

(2) public WeavingURLClassLoader (URL[] classURLs, URL[] aspectURLs,
ClassLoader parent)

Which one I should use? Could you please explain the meaning for the
parameters in detail?
Do I still need to use  <iajc> to compile my aspect source code, and  buit
them into  a jar file, and pass the jar file URL to the constructor as the
second parameter?
or only package the source code as jar file, and WeavingURLClassLoader will
do all for me?

Thanks


--
anfernee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080425/f9ef8939/attachment.html

------------------------------

Message: 3
Date: Fri, 25 Apr 2008 10:04:58 +0200
From: <hermod.opstvedt@xxxxxxxxx>
Subject: RE: [aspectj-users] How to use load time weaving?
To: <aspectj-users@xxxxxxxxxxx>
Message-ID:
       <A12D434EDE49E0438590A76648A8B78A01992439@xxxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

Hi

What JVM version is this for? If its for JDK 5 then you just have to add
-javaagent:lib/aspectjweaver.jar as JVM startup parameter to enable
weaving

Hermod

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Anfernee Xu
Sent: Friday, April 25, 2008 9:32 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] How to use load time weaving?




Hi everyone,

I'm developing an application which will use load time weaving feature,
so that I can control whether my App classes should be weaved at
runtime.
I read
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.h
tml
, learned AspectJ comes with the WeavingURLClassLoader probably can
help me.
but there's no concrete example I can take a look, so could someone
please tell me how to use WeavingURLClassLoader? I have checked the
source code,  there's 2
constructors available,

(1) 4 years">public WeavingURLClassLoader (ClassLoader parent)

(2) 4 years"> public WeavingURLClassLoader (URL[] classURLs, URL[]
aspectURLs, ClassLoader parent)

Which one I should use? Could you please explain the meaning for the
parameters in detail?
Do I still need to use  <iajc> to compile my aspect source code, and
buit them into  a jar file, and pass the jar file URL to the constructor
as the second parameter?
or only package the source code as jar file, and 4
years">WeavingURLClassLoader will do all for me?

Thanks


--
anfernee

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email.

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080425/68c16fe8/attachment.html

------------------------------

Message: 4
Date: Fri, 25 Apr 2008 12:35:43 +0200
From: vtitou vergeos <titou2511@xxxxxxxxxxx>
Subject: [aspectj-users] Around Advice Generic
To: <aspectj-users@xxxxxxxxxxx>
Message-ID: <BAY126-W1559177A645A241A29E348BBDD0@xxxxxxx>
Content-Type: text/plain; charset="windows-1252"

Hi,

I try to use around advice for a general use. I would like to use around for all the methods of a class which one does not know in advance the functions. For example, for a class A has which has 6 methods and a file aspectJ which defines a pointcut A.* for all the methods of A, is it possible to define a generic around for example:

pointcut methods (): execution (public A.* (...));

Object around (): methods () {
….
return proceed ();
}

knowing that the methods of A have different signatures ! I tested the code written above and it does not function, it never passes in the around  method whereas with a before or an after for the same pointcut, it works very well. If somebody already had to deal with this problem, I am waiting your answers!

Cordially

Antoine

_________________________________________________________________
Votre contact a choisi Hotmail, l'e-mail ultra sécurisé. Créez un compte gratuitement !
http://www.windowslive.fr/hotmail/default.asp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080425/7589eb67/attachment.html

------------------------------

Message: 5
Date: Fri, 25 Apr 2008 09:58:10 -0400
From: "Eric Bodden" <eric.bodden@xxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Around Advice Generic
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <804e3c660804250658i9f00533j74d1af4080209a64@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=WINDOWS-1252

Hi.

As far as I can see this advice should be correct (in the sense that
it executes but has no visible effect on the program).

Eric

2008/4/25 vtitou vergeos <titou2511@xxxxxxxxxxx>:
>
> Hi,
>
> I try to use around advice for a general use. I would like to use around for
> all the methods of a class which one does not know in advance the functions.
> For example, for a class A has which has 6 methods and a file aspectJ which
> defines a pointcut A.* for all the methods of A, is it possible to define a
> generic around for example:
>
> pointcut methods (): execution (public A.* (...));
>
> Object around (): methods () {
> ….
> return proceed ();
> }
>
> knowing that the methods of A have different signatures ! I tested the code
> written above and it does not function, it never passes in the around
> method whereas with a before or an after for the same pointcut, it works
> very well. If somebody already had to deal with this problem, I am waiting
> your answers!
>
> Cordially
>
> Antoine
>
> ________________________________
> Avec Windows Live Messenger restez en contact avec tous vos amis !
> Téléchargez Messenger, c'est gratuit !
> _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>



--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


------------------------------

Message: 6
Date: Fri, 25 Apr 2008 09:10:34 -0500
From: Dean Wampler <dean@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Around Advice Generic
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <BB1BB080-64AA-4EC5-9EDF-E6C09A9E2E7A@xxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="windows-1252"

Your "methods" pointcut is missing the return type for the method and
you should have 2 periods for the method argument list:

> pointcut methods (): execution (public * A.* (..));

Actually, AspectJ might infer the return type. I always put it in the
definition. The 2 periods is important! 3 periods should give a
compilation error.

Also, make sure that "A" is visible without the fully-qualified
package name, etc. I don't believe that AspectJ will flag an error if
no "A" is visible, but you will get a warning that no join points were
advised.

On Apr 25, 2008, at 5:35 AM, vtitou vergeos wrote:

> Hi,
>
> I try to use around advice for a general use. I would like to use
> around for all the methods of a class which one does not know in
> advance the functions. For example, for a class A has which has 6
> methods and a file aspectJ which defines a pointcut A.* for all the
> methods of A, is it possible to define a generic around for example:
>
> pointcut methods (): execution (public A.* (...));
>
> Object around (): methods () {
> ….
> return proceed ();
> }
>
> knowing that the methods of A have different signatures ! I tested
> the code written above and it does not function, it never passes in
> the around  method whereas with a before or an after for the same
> pointcut, it works very well. If somebody already had to deal with
> this problem, I am waiting your answers!
>
> Cordially
>
> Antoine
>
> Avec Windows Live Messenger restez en contact avec tous vos amis !
> Téléchargez Messenger, c'est gratuit !
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5



-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080425/1ed65f14/attachment.html

------------------------------

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


End of aspectj-users Digest, Vol 38, Issue 28
*********************************************



--
anfernee

Back to the top