Equinox Aspect: Example from Martin Lippert
Martin Lippert is a senior consultant and coach at akquinet it-agile GmbH. His main work and research focuses on Agile Software Development, Refactoring, Eclipse-Technology, OSGi, Spring and Aspect-Oriented Programming.
Eclipse Monitor Demo
This demo features the relatively old Eclipse Monitor application that Chris Laffra wrote a while ago. It visualizes plugin activities within your Eclipse application and you can analyze what is going on. This monitor uses Equinox Aspects to weave an aspect into all your bundles at load-time to gather the information of what is going on at runtime. It uses AspectJ advises for all methods and object creations. While this is a pretty heavy use of load-time weaving (you will notice a huge performance impact at first startup) it demos nicely the caching feature of Equinox Aspects. The second startup of your monitored app will perform very similar to a startup without any aspect weaving. (more)
Dependency Injection with Spring Dynamic Modules and Equinox Aspects
Spring provides this nice mechanism to inject dependencies in domain objects via the @Configurable annotation (see more here: http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-atconfigurable).
The main difference to general spring beans is that the creation of those domain objects is not done by the application context of Spring. Therefore Spring uses an aspect to call the application context after object creation to inject all necessary dependencies. In plain old Spring applications this aspect is woven into the system using load-time weaving.
Wouldn’t that be a nice mechanism to inject dependencies into Eclipse extensions (like views or editors)? Just annotate your extension with @Configurable and define the dependencies to be injected inside the application context of your bundle (using the Spring Dynamic Modules stuff)? (more)