Announcement Announcement Module
No announcement yet.
Can I use AOP to proxy a .class from a 3rd party jar that depends on native libs. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I use AOP to proxy a .class from a 3rd party jar that depends on native libs.

    We make use of a 3rd party library that comes as a .jar and we have to use the .class simply as

    SomeCalculator calc = CalcFactory.getSomeCalculator();
    CalcFactory is our factory and it just calls

    new SomeCalculator("config params");

    and doStuff() calls all sorts of native libraries and so on. We only have the underlying application on a couple of developer systems so it's limiting who can run the modules of our system that use this code.
    These guys don't even provide an interface. (C programmers...)

    Obviously I'd like to hide that behind some kind of interface or proxy. I'd love to use profiles to supply a pretend SomeCalculator when running in development. Also I'm interested in mock objects for unit testing.

    I'm wondering if AOP proxies are the right way to go. I think I need to proxy this class and pass the methods either to a fake implementation or onto the real implementation. Or maybe AOP is just used by developers and not in production.

    I use java config files for all beans.
    I've read the relevant sections of the reference guide but I think I just need some hints.
    thanks for suggestions