Equinox Weaving

The purpose of Equinox Weavong is to allow developers to use the Equinox together with AspectJ by combining the benefits of both worlds. Using a load-time weaving extension you are able to add AspectJ aspects to your bundle-based system just by putting them into general OSGi bundles. It does not matter if the pointcuts you defined inside the aspects contain join points that are defined by classes within the same bundle or any other bundle in your installation. The load-time weaving extension will take care that your aspects are woven with the appropriate classes at load-time.

To illustrate this lets assume the following situation: You would like to write an aspect that traces something within the JDT plug-ins of Eclipse. Without some kind of load-time aspect weaving you would somehow need to recompile those JDT plug-ins using AJDT (for example) together with your aspect. By using the load-time aspect weaving extension all you need is to implement your aspect and add that bundle to your system. The load-time aspect weaving extension takes care of weaving your aspect with the JDT code as it is loaded. And it doesn't matter if a new JDT is installed by the user later on. The next time your application is started the load-time aspect weaving will take care of weaving your aspect into these bundles as well, if necessary.

With this technology is becomes possible to modularize crosscutting concerns across different plug-ins while keeping the idea of separate compilation for bundles.

Working with Equinox Weaving

Quick Start Guide - See the quick start guide for getting up and running aspect weaving with Equinox.

Weaving Bundles

The Weaving work component consists of several bundles maintained in Equinox GIT repository. See the resources page for information on repository location and access. In general the name of the project matches the symbolic name of the resultant bundle.

Weaving Hook (org.eclipse.equinox.weaving.hook) status:green
This is the framework extension project containing the hooks to insert bytecode weaving and caching at load-time.
AspectJ Weaving (org.eclipse.equinox.weaving.aspectj) status:green
This bundle contains the bridge to use AspectJ as load-time weaving implementation.
Standard Caching (org.eclipse.equinox.weaving.caching) status:green
This bundle provides a caching for woven bytecode for standard Java virtual machines.
J9-Specific Caching (org.eclipse.equinox.weaving.caching.j9) status:green
This bundle contains a cache alternative cache implementation that uses IBM J9 VM shared classes for caching woven classes.

Status key
green - bundle is production ready.
red - bundle development is in progress.

The team typically develops using Eclipse itself so getting and managing the projects is quite straightforward. Simply start Eclipse, and use Import > CVS > Projects from CVS. Enter the repo access information and choose the projects you want to load into the workspace.

If you are working without Eclipse (gads! :-) then use your favorite CVS client and check out the relevant projects.

OSGi Weaving Specification vs. Equinox Weaving

Equinox Weaving and the OSGi Weaving Specification are separate things at the moment. The general Equinox OSGi runtime implements the OSGi Weaving Specification out of the box. This allows you to implement and inject our own bytecode modifiers into the OSGi runtime. Equinox Weaving was implemented a long time before the OSGi Weaving Specification was available, mostly to allow AspectJ aspects to be woven into bundles at load-time. Therefore Equinox Weaving uses Equinox-specific hooks to inject bytecode weaving into the runtime.

When to use what?

If you are looking towards implementing your own bytecode modifier for OSGi to do some special kind of bytecode manipulation at load-time, you should take a look at the hooks provided by the OSGi Weaving Specification. If you wanna use a ready-to-use aspect weaving solution for AspectJ and also wanna have caching of woven bytecode to improve performance and footprint at the second startup, you should take a look at using Equinox Weaving.

Outlook

The future plan is to have the AspectJ weacing and caching parts of Equinox Weaving being reimplemented on top of the OSGi Weaving Specification. Contributions to this are highly welcome!

History

The project was developed under the name "Equinox Aspects" as part of the incubator of the Equinox project some time ago. Therefore if you find resources calling it Equinox Aspects, thats we this comes from. Equinox Aspects graduated and was renamed into Equinox Weaving within the Helios release timeframe.

Committers

The following people are committers on the Equinox Weaving component:

  • Martin Lippert, VMware

Previous, now inactive committers:

  • Matthew Webster, IBM
  • Heiko Seeberger, WeigleWilczek
Buy The Book

Equinox News feed
EclipseRT