Hi,

On Wed, Dec 17, 2014 at 11:02 PM, Trent DiBacco <[email protected]> wrote:
> I would like to instrument a few classes using AOP...

Registering an OSGi WeavingHook [1] service allows you to instrument
classes provided by bundles, before they are used.

You can for example register a WeavingHook in a bundle Activator, and
use bytecode manipulation in that service's weave(...) method.

The WeavingHook needs to be registered before any classes that need
manipulation are loaded, so you might need to start that bundle at a
low OSGi start level.

I'm not familiar enough with bytecode manipulation to recommend one
library over another. The maven-scr-plugin that we are using uses ASM,
source code at [2] if you want to have a look.

-Bertrand

[1] 
http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/hooks/weaving/WeavingHook.html

[2] http://svn.apache.org/repos/asf/felix/trunk/scrplugin/generator

Reply via email to