Quantcast

only weave certain aspects from aspect library with ajdt

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

only weave certain aspects from aspect library with ajdt

garz
Hi,

i have an aspect library with some classes and some aspects. those aspects are features for the classes in the library that can be turned on or off. what i want to do is, using this library with the desired aspects enabled. how can this be done in eclipse that has the the ajdt-plugin installed? respectively is that even possible at all?

Regards
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

Andrew Eisenberg
I'm not exactly sure what you are suggesting.  Are you asking how to
turn on and off weaving a particular aspect library into your code?
If that is the question, then it is possible.

Go to your project properties and configure your AspectJ Build path.
Add the library that you require to the Aspect Path.

If this is not your question, then please be more specific and I will
try to help.



On Mon, Jul 27, 2009 at 6:56 AM, Kurt Zitze<[hidden email]> wrote:

> Hi,
>
> i have an aspect library with some classes and some aspects. those aspects are features for the classes in the library that can be turned on or off. what i want to do is, using this library with the desired aspects enabled. how can this be done in eclipse that has the the ajdt-plugin installed? respectively is that even possible at all?
>
> Regards
> --
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
> _______________________________________________
> aspectj-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

garz
In reply to this post by garz
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
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

Andrew Eisenberg
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<[hidden email]> 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
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

Andy Clement
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 <[hidden email]>
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<[hidden email]> 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
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

garz
In reply to this post by Andrew Eisenberg
Hi Andrew,

My use case is, that all transaction aspects are doing the same. They
differntiate in the transaction-libraries they use.
One weaves the Spring managed transactions into the code, another one
uses the Hibernate transactions, if the user
doesnt want a dependency to Spring. Or the user solves the transaction
problem in a completely different way, not
using any of the transaction aspects, by using proxies for example. The
library is just supposed to present solutions.
Which solution the user chooses is up to him. Compared to traditional
classes in a library, when there are some
classes that present solutions for the same problem, there is no problem
to choose a class and instantiate it. The
same should be possible with aspects.

A question to you first suggestion: I think, if i annotate my class with
@RuleBasedTransactionAware etc,
the seperation of concerns is again beeing hurt, because now the class
has the information, that it is
RuleBasedTransactionAware. Don't you think so?

Regards

Andrew Eisenberg schrieb:

> 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<[hidden email]> 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
>> [hidden email]
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>>    
> _______________________________________________
> aspectj-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>  

_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

garz
In reply to this post by Andy Clement
Thats exactly what i need. Thx for the kind information. So i will have
to wait for this feature and it saved me alot of researching
that would have end in the void. Big Thanks.

Andy Clement schrieb:

> 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 <[hidden email]
> <mailto:[hidden email]>>
>
>     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<[hidden email]
>     <mailto:[hidden email]>> 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
>     > [hidden email] <mailto:[hidden email]>
>     > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>     >
>     _______________________________________________
>     aspectj-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> aspectj-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>  

_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: only weave certain aspects from aspect library with ajdt

nealeu
In reply to this post by garz
Hi Kurt,

A quick thought if it helps.

I've been doing some stuff recently that's using Spring's transaction
management, and using Maven for dependency resolution.

The challenge that you face with your library is in pulling in the
dependencies too.  I would break it into components:
- core
- spring
- hibernate

So that the user either needs to have the Hibernate aspect library
(which depends on core - whatever is common within your library), or the
Spring one.

I also suspect that you could also write some AJ advice which would
ensure that only one implementation was being woven, and would cause an
error to be raised if someone accidentally included both.

Cheers,

Neale



> My use case is, that all transaction aspects are doing the same. They
> differntiate in the transaction-libraries they use.
> One weaves the Spring managed transactions into the code, another one
> uses the Hibernate transactions, if the user
> doesnt want a dependency to Spring. Or the user solves the transaction
> problem in a completely different way, not
> using any of the transaction aspects, by using proxies for example. The
> library is just supposed to present solutions.
> Which solution the user chooses is up to him. Compared to traditional
> classes in a library, when there are some
> classes that present solutions for the same problem, there is no problem
> to choose a class and instantiate it. The
> same should be possible with aspects.
>
> A question to you first suggestion: I think, if i annotate my class with
> @RuleBasedTransactionAware etc,
> the seperation of concerns is again beeing hurt, because now the class
> has the information, that it is
> RuleBasedTransactionAware. Don't you think so?
>
> Regards
>
> Andrew Eisenberg schrieb:
> > 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<[hidden email]> 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
> >> [hidden email]
> >> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >>
> >>    
> > _______________________________________________
> > aspectj-users mailing list
> > [hidden email]
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >  
>
> _______________________________________________
> aspectj-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
--
  Neale Upstone
  [hidden email]

_______________________________________________
aspectj-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Loading...