Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] only weave certain aspects from aspect library with ajdt

Enhancement https://bugs.eclipse.org/bugs/show_bug.cgi?id=124460 will allow you to do sub-selection of aspects in your project.  Under that change you will be able to use an aop.xml to control compilation/weaving in the IDE just like it currently controls load time weaving.  If you deliberately exclude aspects from a library using a custom aop.xml then they will not be used for weaving.  It may be a little 'messy' in that you will have to just use a text editor initially to include/exclude your fully qualified aspects, but it will be possible.  Some progress on that enhancement has already been made and more is likely before 1.6.6 AspectJ is finished.

Andy.

2009/7/27 Andrew Eisenberg <andrew@xxxxxxxxxxxx>
Hi Kurt,

That sounds like some poorly designed aspects in your library if they
are accidentally applying in places where they shouldn't.  The way
that the library *should* have been designed is that you should be
able to easily choose which transaction aspect should apply in which
part of your code.  Ways of doing this could be:

1. The aspects only weave based on a certain annotation being present:
eg-
@RuleBasedTransactionAware  class Class1 { ...}
@RollbackTransactionAware class Class2 { ... }

2. The aspects are all declared abstract and concrete aspects can
determine exactly where their advice applies to the code.

3. Remodularize your aspect library and delete the aspects that you do
not want to apply.

Of course, the way you are describing things, it does not seem that
the first two are possible.  However, that would be the ideal way of
doing things.  #3, though less desirable should be possible.

As far as I know, there is no way to weave only a subset of existing
aspects for compile time weaving (for load-time weaving, however, that
is a different story).

On Mon, Jul 27, 2009 at 1:13 PM, Kurt Zitze<Garz@xxxxxxx> wrote:
> hi,
>
> thx for your reply, this is very kind of you.
>
> i will try to describe my problem more precisly. :)
>
> i have a library (a jar file) with some classes and in the same library, there are some aspects. the concrete use case is, there are different aspects for transaction management that advised to the classes that need
> it. obviously, weaving one transaction aspect is enough. but the library
> cant know, which one is needed, it just comes with all available transaction
> aspects. so it is the task of the user of the library to choose a certain
> transaction aspect. so i include this library into my project and then i want to somehow enable the desired transaction aspect. since i'm using
> eclipse and ajdt, it would be a dream if this could be done with it. can it be done?
>
> otherwise i think i can do it with:
> "ajc -injars mylibrary.jar -aspectpath mylibrary.jar"
> but this weaves all aspects. how can i specify that only some desired aspects from the mylibrary.jar are woven?
>
> best regards and thx again!
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> _______________________________________________
> 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


Back to the top