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

Hi Ying,

I am currently working on the next milestone build (M3) for equinox aspects (coming end of week) and I hope your setting works a lot better with that version. I will put a new dev build online soon and would be happy to hear your feedback from using that dev build. I will let you know when its available, ok?

-Martin


Ying Jiang wrote:
Dear Martin,

Thank you for the help. I tried to modify the config.ini according to
your suggestion. I also added "osgi.clean=true":

osgi.framework.extensions=org.eclipse.equinox.weaving.hook
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true
osgi.bundles=org.eclipse.equinox.common@2:start,
org.eclipse.update.configurator@3:start,
org.eclipse.core.runtime@start,
org.eclipse.equinox.weaving.aspectj@1:start,
org.eclipse.equinox.weaving.caching@:start
osgi.clean=true

But the "hello view" was supplemented twice during startup:
--------
[org.aspectj.osgi] info adding AspectJ hooks ...

osgi> [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 myview
[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.core.runtime'
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.equinox.registry'
[org.aspectj.osgi.service.weaving] info not weaving bundle
'org.eclipse.core.runtime.compatibility.auth'
...
...
---------
It's supplemented before and after "Starting AspectJ weaving service"
respectively. And the status of "hello view"
(org.eclipse.equinox.weaving.demo.hello) is INSTALLED instead of
RESOLVED. "hello view" is not available in the "view list".

Could you please tell me why it happened and how to resolve this problem?

Regards,

Ying Jiang

On Fri, Oct 24, 2008 at 2:49 AM, Martin Lippert <lippert@xxxxxxx> wrote:
Hi Ying,

to ensure that the weaving service starts before anything else you should
add the weaving service bundle to the config.ini of your launch
configuration and set the start level to 1. So your osgi.bundles entry in
your config.ini might look like:

osgi.bundles=org.eclipse.equinox.common@2\:start,org.eclipse.update.configurator@3\:start,org.eclipse.core.runtime@start,
org.eclipse.equinox.weaving.aspectj@1\:start,
org.eclipse.equinox.weaving.caching@:start, your.aspect.bundle.symbolic.name

You could even put your aspect bundle onto that list to ensure that no
dynamic struggle happens.

And I think you don't need to depend on the aspectj bundle from your aspect
bundle. Should work without that dependency.

HTH,
-Martin




Ying Jiang wrote:
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
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev