Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Equinox Aspect for load-time weaving of AOP in OSGi

Dear Sir,

I would like to use Equinox Aspect for load-time weaving of AOP in
OSGi. I'm now trying the Quick-start guide from
"http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php";.

I make a few changes of the demo:

1. I change the bundle of "org.eclipse.equinox.weaving.demo.hello"
into a Plug-in with a View(org.eclipse.ui.part.ViewPart). Another
bundle of "org.eclipse.equinox.weaving.demo.hello.aspects" contains
the aspect of printing a string before the view is showed in the
workbench. The two bundles are two Eclipse plugin projects in my
workspace.

2. I copy the other required bundles (org.aspectj.runtime,
org.aspectj.weaver, org.eclipse.equinox.weaving.aspectj,
org.eclipse.equinox.weaving.hook... and so on) to the "plugins"
directory of eclipse.

3. I launch a new workbench by using "Eclipse Application"
configuration instead of command line.

Finally, I get the following outputs:
[org.aspectj.osgi] info adding AspectJ hooks ...

osgi> [org.aspectj.osgi] info triggering update for re-supplementing
org.eclipse.equinox.weaving.demo.hello
[org.aspectj.osgi] info supplementing
org.eclipse.equinox.weaving.demo.hello with
[org.eclipse.equinox.weaving.demo.hello.aspects]
[org.aspectj.osgi.service.weaving] info Starting AspectJ weaving service ...
[org.aspectj.osgi] info triggering update for re-supplementing
org.eclipse.equinox.weaving.demo.hello
[org.aspectj.osgi] info supplementing
org.eclipse.equinox.weaving.demo.hello with
[org.eclipse.equinox.weaving.demo.hello.aspects]
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.ui.ide.application'
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.ui.workbench'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.jface'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.swt'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.ui'
...
...
...

And I can not find the new "hello view" in the "Show View" dialog.

Could you please tell me why "org.eclipse.equinox.weaving.demo.hello"
is re-supplemented twice but fails to become "resolved"?

Here is the Manifest information of
"org.eclipse.equinox.weaving.demo.hello.aspects":
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Equinox Aspects Demo - Hello aspects
Bundle-SymbolicName: org.eclipse.equinox.weaving.demo.hello.aspects
Bundle-Version: 1.0.0
Bundle-Vendor: Heiko Seeberger
Require-Bundle: org.aspectj.runtime;bundle-version="1.6.1";visibility:=reexport,
 org.eclipse.equinox.weaving.aspectj
Export-Package: org.eclipse.equinox.weaving.demo.hello.aspects
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.4.0"
Eclipse-SupplementBundle: org.eclipse.equinox.weaving.demo.hello

If I remove the Require-Bundle of
"org.eclipse.equinox.weaving.aspectj" from the Manifest, sometimes I
get the same outputs above, but sometimes the outputs change into:
[org.aspectj.osgi] info adding AspectJ hooks ...

osgi> [org.aspectj.osgi.service.weaving] info Starting AspectJ weaving
service ...
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.ui.ide.application'
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.ui.workbench'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.jface'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.swt'
[org.aspectj.osgi.service.weaving] info not weaving bundle 'org.eclipse.ui'
...
...
...
It shows there's no weaving at all, even for
"org.eclipse.equinox.weaving.demo.hello". But in this circumstatnce,
the hello view shows well without the aspect's effect.

I wonder if the problems come from "The AspectJ weaving service
(bundle org.eclipse.equinox.weaving.aspectj) has to be started before
any classes are loaded from any bundles targeted for weaving.". I
don't know how to make sure the the AspectJ weaving service to be
started at first.

Could you tell me the reasons for the problems and the corresponding
solutions please?
It's urgent. Thank you in advance!

Ying Jiang


Back to the top