Announcement Announcement Module
No announcement yet.
How to proxy Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to proxy

    I just realized that I will make my life easier by using proxies to provide implementations for a set of interfaces. I'm breaking up a project that uses XML-RPC for remote invocations, but since it is an earlier version, java objects cannot be used as return or parameter types in any of the interfaces. I'm eventually going to move this system to using messaging, but first I have to refactor. I'm creating gateway interfaces that have the java objects, and xml-rpc interfaces that have the string equivalents of the java objects.


    public interface IServiceGatewayInterface {
       public MyJavaReturnObject serviceCall(MyJavaParameterObject parm1);
    public interface IXMLRPCInterface {
       public String serviceCall(String parm1);
    I need a proxy factory that will create a proxy implementation of IServiceGatewayInterface that automatically converts any non-native java object to a string such that it matches IXMLRPCInterface. I have a lot of interfaces that fit this pattern. The interfaces in both cases will have the same method names, but will differ only in type when a return or parameter is not a native java type like String, boolean, int, Integer, etc.

    I was looking at implementing a proxy factory on my own, but I'd like to do it the Spring way, using AOP, but I'm not sure how to get started. The trick of course is that the proxy must do a conversion. In this article, about 3/4's down the page, the author shows how to do something similar, providing alternate functionality when methods in the calling interface are not found in the callee.

    If anyone has a good example I could start with, or any advice, it would be greatly appreciated. I have the book AspectJ in Action and would be happy to put some of that into play.