Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Load-Time weave only one single aspect of a project containing several aspects
Load-Time weave only one single aspect of a project containing several aspects [message #533825] Mon, 17 May 2010 08:25 Go to next message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi!

I use the AJDT 2.0.2.e35x with AspectJ 1.6.7 inside Eclipse 3.5.2.
There I have a project containing several different aspects I use for
inspecting some legacy java application.

Now, I'm developing a new aspect in that project, and in order to test
and debug it, I'm asking myself how to run the legacy application and
only weave in that single aspect?

I created a Run Configuration below "AsepctJ Load-Time Weaving
Application", and I've put the project containing the aspects into the
LTW Aspectpath. Unfortunately, this weaves in all aspects that are
contained in the project, and I cannot figure out how to teach it only
to use that one single aspect I'm currently interested in.

Any help?

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Load-Time weave only one single aspect of a project containing several aspects [message #533838 is a reply to message #533825] Mon, 17 May 2010 09:17 Go to previous messageGo to next message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Tassilo Horn <horn@uni-koblenz.de> writes:

> I created a Run Configuration below "AsepctJ Load-Time Weaving
> Application", and I've put the project containing the aspects into the
> LTW Aspectpath. Unfortunately, this weaves in all aspects that are
> contained in the project, and I cannot figure out how to teach it only
> to use that one single aspect I'm currently interested in.

I was able to manage this by commenting all aspects except that single
one in the aspectj project's META-INF/aop-ajc.xml. That works, but
doesn't feel right to me. Isn't there a better way?

BTW: Is it correct that I have to maintain META-INF/aop-ajc.xml on my
own? It seems that any changes I do to my aspects are not reflected in
it, and I have to update it manually (changing aspect names/files,
moving them in different packages, ...).

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Load-Time weave only one single aspect of a project containing several aspects [message #534033 is a reply to message #533838] Mon, 17 May 2010 19:07 Go to previous messageGo to next message
Andrew Clement is currently offline Andrew Clement
Messages: 162
Registered: July 2009
Senior Member
Hi,

> I was able to manage this by commenting all aspects except
> that single one in the aspectj project's META-INF/aop-ajc.xml.
> That works, but doesn't feel right to me. Isn't there a better way?

so you have commented out the source for all the aspects you don't want to include - you don't mean you have commented out the entries in the aop xml file for those you don't want to include?

And your launch configuration is for the one single project that contains all the code and the aspects? If that project is an AspectJ project, all your aspects will be getting woven in during project build. Whatever the launch configuration does, it will still find those aspects are woven into the code that is running.

There are a couple of things you can try.

1) In the project AspectJBuild>aop.xml management page, you can specify an aop.xml file that controls compilation. This can list the aspects that should be used during the build (this is entirely separate to load time weaving). It uses the same format as the regular aop.xml. So just add an aop.xml that includes your single aspect.

2) You can scope the aspects in your ltw aop.xml file. this means adding a scope to the aspect declaration lines <aspect name="Foo" scope="within(*)"/>. If you make that scope !within(*) for the aspects you don't want to apply, that will probably exclude them during ltw.

(1) is very experimental, (2) is slightly less experimental

> BTW: Is it correct that I have to maintain META-INF/aop-ajc.xml on my
> own? It seems that any changes I do to my aspects are not reflected in
> it, and I have to update it manually (changing aspect names/files,
> moving them in different packages, ...).

If you have 'outxml' set for the project (it is a project preference) then an aop.xml file will be generated on each compile. However, it will not preserve any edits you have made to it - we don't support that way of working right now.

Andy
Re: Load-Time weave only one single aspect of a project containing several aspects [message #534510 is a reply to message #534033] Wed, 19 May 2010 11:40 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Andy Clement <andrew.clement@gmail.com> writes:

Hi Andy,

>> I was able to manage this by commenting all aspects except that
>> single one in the aspectj project's META-INF/aop-ajc.xml. That works,
>> but doesn't feel right to me. Isn't there a better way?
>
> so you have commented out the source for all the aspects you don't
> want to include - you don't mean you have commented out the entries in
> the aop xml file for those you don't want to include?

No, I mean exatly the latter. My src/META-INF/aop-ajc.xml now looks
like that:

--8<---------------cut here---------------start------------->8---
<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
<aspects>
<aspect name=" de.uni_koblenz.aspects.tracing.client.state_changes.TraceCli entStateChange "/>
<aspect name=" de.uni_koblenz.aspects.tracing.client.method_calls.TraceMeth odCalls "/>
<!-- <aspect name=" de.uni_koblenz.aspects.tracing.server.state_changes.TraceSer verStateChange "/> -->
</aspects>
</aspectj>
--8<---------------cut here---------------end--------------->8---

When I run the application where I apply the aspects to as LTW
application and add my aspectj project to the aspectpath, only the first
two aspects are woven in but not the latter which is commended out.

I didn't comment any source code lines.

> And your launch configuration is for the one single project that
> contains all the code and the aspects?

No. The aspects are in a separate AspectJ-project. The application
that is instrumented with those aspects is another plain-java project.

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Load-Time weave only one single aspect of a project containing several aspects [message #600982 is a reply to message #533825] Mon, 17 May 2010 09:17 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Tassilo Horn <horn@uni-koblenz.de> writes:

> I created a Run Configuration below "AsepctJ Load-Time Weaving
> Application", and I've put the project containing the aspects into the
> LTW Aspectpath. Unfortunately, this weaves in all aspects that are
> contained in the project, and I cannot figure out how to teach it only
> to use that one single aspect I'm currently interested in.

I was able to manage this by commenting all aspects except that single
one in the aspectj project's META-INF/aop-ajc.xml. That works, but
doesn't feel right to me. Isn't there a better way?

BTW: Is it correct that I have to maintain META-INF/aop-ajc.xml on my
own? It seems that any changes I do to my aspects are not reflected in
it, and I have to update it manually (changing aspect names/files,
moving them in different packages, ...).

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Load-Time weave only one single aspect of a project containing several aspects [message #600989 is a reply to message #533838] Mon, 17 May 2010 19:07 Go to previous message
Andrew Clement is currently offline Andrew Clement
Messages: 162
Registered: July 2009
Senior Member
Hi,

> I was able to manage this by commenting all aspects except
> that single one in the aspectj project's META-INF/aop-ajc.xml.
> That works, but doesn't feel right to me. Isn't there a better way?

so you have commented out the source for all the aspects you don't want to include - you don't mean you have commented out the entries in the aop xml file for those you don't want to include?

And your launch configuration is for the one single project that contains all the code and the aspects? If that project is an AspectJ project, all your aspects will be getting woven in during project build. Whatever the launch configuration does, it will still find those aspects are woven into the code that is running.

There are a couple of things you can try.

1) In the project AspectJBuild>aop.xml management page, you can specify an aop.xml file that controls compilation. This can list the aspects that should be used during the build (this is entirely separate to load time weaving). It uses the same format as the regular aop.xml. So just add an aop.xml that includes your single aspect.

2) You can scope the aspects in your ltw aop.xml file. this means adding a scope to the aspect declaration lines <aspect name="Foo" scope="within(*)"/>. If you make that scope !within(*) for the aspects you don't want to apply, that will probably exclude them during ltw.

(1) is very experimental, (2) is slightly less experimental

> BTW: Is it correct that I have to maintain META-INF/aop-ajc.xml on my
> own? It seems that any changes I do to my aspects are not reflected in
> it, and I have to update it manually (changing aspect names/files,
> moving them in different packages, ...).

If you have 'outxml' set for the project (it is a project preference) then an aop.xml file will be generated on each compile. However, it will not preserve any edits you have made to it - we don't support that way of working right now.

Andy
Re: Load-Time weave only one single aspect of a project containing several aspects [message #600996 is a reply to message #534033] Wed, 19 May 2010 11:40 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Andy Clement <andrew.clement@gmail.com> writes:

Hi Andy,

>> I was able to manage this by commenting all aspects except that
>> single one in the aspectj project's META-INF/aop-ajc.xml. That works,
>> but doesn't feel right to me. Isn't there a better way?
>
> so you have commented out the source for all the aspects you don't
> want to include - you don't mean you have commented out the entries in
> the aop xml file for those you don't want to include?

No, I mean exatly the latter. My src/META-INF/aop-ajc.xml now looks
like that:

--8<---------------cut here---------------start------------->8---
<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
<aspects>
<aspect name=" de.uni_koblenz.aspects.tracing.client.state_changes.TraceCli entStateChange "/>
<aspect name=" de.uni_koblenz.aspects.tracing.client.method_calls.TraceMeth odCalls "/>
<!-- <aspect name=" de.uni_koblenz.aspects.tracing.server.state_changes.TraceSer verStateChange "/> -->
</aspects>
</aspectj>
--8<---------------cut here---------------end--------------->8---

When I run the application where I apply the aspects to as LTW
application and add my aspectj project to the aspectpath, only the first
two aspects are woven in but not the latter which is commended out.

I didn't comment any source code lines.

> And your launch configuration is for the one single project that
> contains all the code and the aspects?

No. The aspects are in a separate AspectJ-project. The application
that is instrumented with those aspects is another plain-java project.

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Previous Topic:Load-Time weave only one single aspect of a project containing several aspects
Next Topic:How to call inherited methods with return values?
Goto Forum:
  


Current Time: Thu Oct 23 20:39:50 GMT 2014

Powered by FUDForum. Page generated in 0.04971 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software