I'm currently working on an OSGi project where some parts are perfect for AOP programming. Without many experiences in AOP combined with OSGi, I would like to know how to best do AOP in an OSGi environment? I've read some articles about this problem, but did not find a solution that suits well for me. There is, for example, an Equinox Incubator project for AspectJ, but the last build was on 2008. But since I'm using Apache Felix and Bnd(tools) I want to avoid using something from Equinox. Btw., one requirement for the weaving process will be that it should be at compile-time and maybe later load-time as well. Furthermore I'm using Ant and Bnd to build my bundles. So it would be great if I can integrate Aspectj into this build process as well.
Hopefully someone can share experiences with such a use case.
EDIT
Summary so far:
I think you can take a look at Aries JPA. Load time weaving was added recently there. Seems like there is also a weaving hook in the newer OSGi spec. So support for AspectJ and the like may be quite possible now. I have not yet seen it in action though.
A big question is of course. Why do you need AOP and what do you want to do with it? In general AOP in most cases looks simpler than it is and gives you lees benefits than you think at first. So my advice is be careful and think twice before using AOP too much.