Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] About aop.xml scope

Hi Simone,

	Thank you so much for your explanation. It's preety clear! 

Regards, Federico.


-----Mensaje original-----
De: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] En nombre de Simone Gianni
Enviado el: lunes, 08 de junio de 2009 13:16
Para: aspectj-users@xxxxxxxxxxx
Asunto: Re: [aspectj-users] About aop.xml scope

Hi Federico and Tahir,

Tahir guess is right : there is no "jar" scope in Java, not because it 
would not be a good idea, simply because there is no support for that in 
the Java classloading system. When using an URL classloader it is 
possible to know from which jar that resource is coming from, but only 
using methods specific to URLClassLoader and/or interpreting the 
Class.getResource returned URL in an implementation specific mapping, 
both solutions are not applicable in a real production environment, 
especially when web application servers come in play with their own 
classloaders.

Multiple aop.xml files are detected and merged together, as explained 
here 
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html 
:

When several configuration files are visible from a given weaving class 
loader their contents are conceptually merged. The files are merged in 
the order they are found on the search path (with a regular 
getResourceAsStream lookup) according to the following rules:

    *

      The set of available aspects is the set of all declared and
      defined aspects (aspect and concrete-aspect elements of the
      aspects section).

    *

      The set of aspects used for weaving is the subset of the available
      aspects that are matched by at least one include statement and are
      not matched by any exclude statements. If there are no include
      statements then all non-excluded aspects are included.

    *

      The set of types to be woven are those types matched by at least
      one weaver include element and not matched by any weaver exclude
      element. If there are no weaver include statements then all
      non-excluded types are included.

    *

      The weaver options are derived by taking the union of the options
      specified in each of the weaver options attribute specifications.
      Where an option takes a value e.g. -warn:none the most recently
      defined value will be used.

It is not an error for the same aspect to be defined to the weaver in 
more than one visible META-INF/aop.xml file. However, if the same 
concrete aspect is defined in more than one aop.xml file then an error 
will be issued. A concrete aspect defined in this way will be used to 
weave types loaded by the class loader that loaded the aop.xml file in 
which it was defined.


In a web application "the order they are found" will be :
- WEB-INF/classes/...
- WEB-INF/lib/*.jar (I don't know of any reliable standard on the 
loading order of jars here)
- Endorsed libs
- Server "common " libs
- Server libs themselves

Hope this helps,
Simone



Federico Firpo Bodner wrote:
> Thanks Tahir, but my doubt is: What happens if I put a second jar file
with
> a second aop.xml file? Both configurations are merged? Or each jar keeps
the
> settings in their own aop.xml?
>
> Regards,
> Federico
>
> -----Mensaje original-----
> De: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] En nombre de Tahir Akhtar
> Enviado el: lunes, 08 de junio de 2009 11:34
> Para: aspectj-users@xxxxxxxxxxx
> Asunto: Re: [aspectj-users] About aop.xml scope
>
> Hi,
> Here is from my own experience:
> I have a aop.xml in a jar and it is used to weave all the jars in 
> WEB-INF/lib and all the classes in WEB-INF/classes.
> When I place the jar containing aop.xml in Tomcat/common/lib it can even 
> weave the classes in jars provided by tomcat.
>
> regards,
> Tahir Akhtar
> pilux wrote:
>   
>> Hi All,
>>
>>     I have a doubt. Settings in aop.xml are scoped only to the classes
>> contained in same jar file, or are exported and merged into whole JVM
>> weaver?
>>
>> Thanks and regards, Federico
>>   
>>     
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>   


-- 
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/

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



Back to the top