In case of JDBC objects (statements, connection etc.), if you use an execution pointcut such as: execution(* java.sql.Statement.*(..)) and you weave in the JDBC driver (the jar), you should be good to go.
We use this approach in Spring Insight ( http://www.springsource.com/products/tcserver/devedition). There we use load-time weaving, but even if you use build-time weaving, as long as you manage to weave in JDBC driver jars, it should work for you. -Ramnivas On Mon, Feb 15, 2010 at 8:37 AM, Andy Clement <[email protected]>wrote: > The key thing to understand is who loads that class. Given that it > has a java prefix, it may or may not be loaded by a classloader > against which a weaver can be attached. Simplest way would be to > create the aspect you want, define the aop.xml (include the setting to > weave java prefixed packages ( <weaver > options="-Xset:weaveJavaPackages=true" ), perhaps set the options for > debug, verbose and showWeaveInfo, then launch the VM with the > aspectjweaver agent attached. You will discover which classloaders > are getting a weaver instance and a debug line will be produced if the > Statement class is ever passed to AspectJ. If it is then the > showWeaveInfo will tell you whether your advice matched. > > I know you mentioned you wanted to load time weave, but if it isn't > loaded by a classloader you can hook into the simplest thing is a > quick compile time weave of the jar containing it (you don't need the > source for Statement or anything) > > Andy > > On 14 February 2010 15:18, Aldo Bucchi <[email protected]> wrote: > > Hi, > > > > What's the simplest and less invasive way to advice around > > java.sql.Statement.executeQuery using runtime weaving? > > > > ( I mention that specific class to clearly illustrate the general > > case: A method on a 3rd party jar over which I have no control ). > > > > 1. I am not restricted to AspectJ, but I thought I'd start looking here > > 2. I am looking for a quick one-off that does not impose too many > > requirements, configurations and dependecies as the target project is > > already using complex compilation phases to integrate Scala and some > > DSLs PLUS we're using Maven. This is why RTW sounds like the right > > choice so as to avoid falling into spaghettiland > > > > Ideally, something like Spring's annotation-based RTW but w/o the > limitations. > > > > Thanks! > > A > > > > -- > > Aldo Bucchi > > skype:aldo.bucchi > > http://www.univrz.com/ > > http://aldobucchi.com/ > > > > PRIVILEGED AND CONFIDENTIAL INFORMATION > > This message is only for the use of the individual or entity to which it > is > > addressed and may contain information that is privileged and > confidential. If > > you are not the intended recipient, please do not distribute or copy this > > communication, by e-mail or otherwise. Instead, please notify us > immediately by > > return e-mail. > > _______________________________________________ > > aspectj-users mailing list > > [email protected] > > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
