[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Re: Eclipse Aspects

Rowan,

I have good news for you: I have it running by just changing your config.ini. You have to start the weaving service before the demo bundle. Otherwise weaving will occour after the Activaor has run. Please find the modified config.ini attached.

The real problem is, that there is no suitable documentation for Equinox Aspects. I will try to provide a quick start guide and a simple demo which shows all necessary steps to get started with Equinox Aspects soon. Please stay tuned ..

Heiko

Attachment: config.ini
Description: Binary data


Am 10.06.2008 um 18:37 schrieb Rowan Limb:

Heiko,

no - still does not work. My jar file now looks like this:

META-INF/
META-INF/MANIFEST.MF
hooktest/
hooktest/MyAspects.class
org/
org/aspectj/
org/aspectj/aop.xml

I assume I just have to install that bundle (although I did 'start' it
as well). When I first install it (simplebundle being already installed)
I get this:


[org.aspectj.osgi] info triggering update for re-supplementing
simplebundle
[org.aspectj.osgi] info supplementing simplebundle with [hooktest]

which suggests something correct is happening ?

When I start simplebundle I just get
osgi> start 19
A simple bundle!

No output from the aspects.

Also tried a completely new, clean install of equinox but made no
difference.

Rowan

On Tue, 2008-06-10 at 17:53 +0200, Heiko Seeberger wrote:
Rowan,

If we are lucky, it is indeed simple: When using aspect bundles the
aop.xml file always has to be on the bundle classpath, not in the
META-INF directory.
According to your config.ini it has to be in a package org.aspectj.
You also could put it into hooktest if you modify config.ini
(org.aspectj.weaver.loadtime.configuration=hooktest), but I would not
do that (Best practice: Use always one and the same package).

Give it a try and let me know ...

Heiko

Your aop.xml has to be in a org.aspectj package, not in the META-INF
directory.
It always has to be on the bundle classpath and must match a package

2008/6/10 Rowan Limb <rowan.limb@xxxxxx>:
       Heiko,

       I'm sure you are right and we can crack this. I am also sure
       it is
       something simple that I have missed.

       Anyway, attached is a zip file of src, manifest files and an
       aop.xml.
       Also in there is my config.ini and a text file 'screenshot' of
       the
       output of doing an 'ss' in the equinox console.

       When I install simplebundle and simple-aspects in equinox and
       start
       simplebundle I get this on the console:

       osgi> start 63
       A simple bundle!

       When I use aspectj on the commandline with the same jar files
       I get
       this:

aj5 -classpath
simplebundle/simplebundle.jar:simple-aspects/simple- aspects.jar:/opt/aspectj1.6/lib/aspectjrt.jar simple.Simple
advice after Simple constructor
Before Simple println()
A simple bundle!



I saw a thread describing a similar problem on eclipsezone:

       http://www.eclipsezone.com/eclipse/forums/m92227380.html

       Martin Lippert answered (in reply 5) saying:
       Just implement your aspect inside a bundle, define the aop.xml
       file and
       "Eclipse-SupplementBundle: *" in the manifest. Thats it.

       mmmmm.

       Annoyingly the original poster said the problem was solved but
       didn't
       say what the solution was!

       I really appreciate you taking the time to help me on this.

       Rowan



On Tue, 2008-06-10 at 05:59 +0200, Heiko Seeberger wrote:
Hi Rowan,

Don't get frustrated, we will get that thing running.
I cannot see any mistakes "from here". Would it be possible
for you to
export your sources and send them to me?

Heiko

Am 09.06.2008 um 18:50 schrieb Rowan Limb:


Heiko,

I hope you don't mind me contacting you directly. I
recently asked a
question on the eclipse-dev message list regarding running
eclipse
aspects in a standalone instance of equinox (rather than
in eclipse).
You were kind enough to respond and invite further
requests for
help. I
am getting increasingly frustrated and the message list is
not easy
for
me to use due to restrictions at work, hence my direct
email.

Progress so far:

I can get aspects to work in equinox if the java code
(simple 'hello
world') AND the aspects are in one bundle.

I can get the aspects to work outside of equinox using
just aspectj on
the commandline with the 'hello world' code in one jar
file and the
aspects in a separate jar file. (this proves to me there's
nothing
wrong
with the basic setup or my aspects definitions.

What I can not get to work is running the aspects as a
separate bundle
in equinox. I have one bundle for the 'hello world' code
- starts
fine
and prints to console. The separate aspects bundle
installs and I can
start/stop it (not sure if I should need to do this) but
when I start
the hello world bundle nothing extra happens (my aspects
define 2
pointcuts, one for a constructor of a class and one for a
method call
which will print a suitable message if 'trapped'. Both
constructor and
method are in the 'hello world' bundle.

My manifest for the aspects bundle looks like this:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Simple Aspects Co-opt
Bundle-SymbolicName: hooktest
Bundle-Version: 1.0.0
Bundle-Localization: plugin
Export-Package: hooktest,org.aspectj
Require-Bundle: org.aspectj.runtime;visibility:=reexport
Eclipse-SupplementBundle: *
Bundle-ClassPath: .

When I first install the aspects bundle I get this at the
console:

[org.aspectj.osgi] info triggering update for
re-supplementing
javax.servlet
[org.aspectj.osgi] info supplementing javax.servlet with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
org.eclipse.osgi.services
[org.aspectj.osgi] info supplementing
org.eclipse.osgi.services with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
org.aspectj.runtime
[org.aspectj.osgi] info supplementing org.aspectj.runtime
with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
org.mortbay.jetty
[org.aspectj.osgi] info supplementing org.mortbay.jetty
with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
org.apache.commons.logging
[org.aspectj.osgi] info supplementing
org.apache.commons.logging with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
org.aspectj.weaver
[org.aspectj.osgi] info supplementing org.aspectj.weaver
with
[hooktest]
[org.aspectj.osgi] info triggering update for
re-supplementing
simplebundle
[org.aspectj.osgi] info supplementing simplebundle with
[hooktest]


Note that simplebundle is my 'hello world' bundle.

I do not get any messages in the equinox log file or in
the console.

I am using org.aspectj.osgi_1.1.0.200803102211 and I've
tried both 1.5
and 1.6 of the aspectj runtime/weaver jar files.

I have looked at the slides you suggested looking at and
to the best
of
my knowledge have followed what it says there.

I have tried placing the aop.xml file in META-INF and in
org.aspectj
but
it makes not difference.

I really want to get this to work, any pointers or
suggestions would
be
much appreciated.

Rowan





--
Rowan Limb
Senior Researcher, Pervasive ICT Research Centre
BT Group Chief Technology Office
___________________________
Office: 01473 640872
Mobile:
Email: rowan.limb@xxxxxx

British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 1800000

This electronic message contains information from British
Telecommunications plc which may be privileged or
confidential. The
information is intended to be for the use of the
individual(s) or
entity
named above. If you are not the intended recipient be
aware that any
disclosure, copying, distribution or use of the contents
of this
information is prohibited. If you have received this
electronic
message
in error, please notify us by telephone or email (to the
numbers or
address above) immediately.

Activity and use of the British Telecommunications plc
email system is
monitored to secure its effective operation and for other
lawful
business purposes. Communications using this system will
also be
monitored and may be recorded to secure effective
operation and for
other lawful business purposes.