That’s an interesting idea. I didn’t realize that OSGi had built-in weaving capabilities. I looked at the spec and saw that there’s a partial example of how to use WeavingHook, but it didn’t talk about how to actually perform the bytecode manipulation, leaving it instead as an “exercise to the reader”. Where can I find an example of how to do this? Or would it be easier if I simply used a tool like AspectJ? Does AspectJ play nicely with OSGi?
From: osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-boun...@mail.osgi.org] On Behalf Of Raymond Auge Sent: Thursday, February 18, 2016 11:25 AM To: OSGi Developer Mail List Subject: Re: [osgi-dev] Monitor method calls for a bundle? If you want to get really crazy you can go to full Weaving (Chapter 56 of Core spec). - Ray On Thu, Feb 18, 2016 at 11:17 AM, elias vasylenko <eliasvasyle...@gmail.com<mailto:eliasvasyle...@gmail.com>> wrote: The standard OSGi way I suppose would be to use service hooks to intercept service registrations, and re-register proxied versions. Would be simple enough to intercept invocation parameters and results in this way. Cheers, Eli On Thu, 18 Feb 2016 at 16:10 Steve Marotta <smaro...@cra.com<mailto:smaro...@cra.com>> wrote: Hello, I was wondering if there was a way, built into OSGi, to automatically listen for any time that code in one bundle invokes a method on a service in another bundle. For example, if I have a service defined with a method that takes a “name” string and queries a database to return an “address” string, I want to be able to build a separate component that will listen for these method calls and invoke a callback both when the method is called, where I can see the name string that was passed, and a callback when the method returns, where I can see the address string that comes back. I could do this manually using something like aspect-oriented programming, but if there is a way to do this that is built into OSGi, then it will save me the trouble. Thanks, Steve _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org<mailto:osgi-dev@mail.osgi.org> https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org<mailto:osgi-dev@mail.osgi.org> https://mail.osgi.org/mailman/listinfo/osgi-dev -- Raymond Augé<http://www.liferay.com/web/raymond.auge/profile> (@rotty3000) Senior Software Architect Liferay, Inc.<http://www.liferay.com> (@Liferay) Board Member & EEG Co-Chair, OSGi Alliance<http://osgi.org> (@OSGiAlliance)
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev