This would be lovely, I have been musing over something like that for months. +1 from me.
One change to the idea that might be nice is to do the introspection once at deployment time instead of on each call. Using an interface is a nice touch, I was thinking about using method attributes (using commons-attributes or something else) or a separate XML deployment descriptor. Different use case :)
See you on the dev list,
-- Ryan Hoegg ISIS Networks http://www.isisnetworks.net
Life is hard, and then you die wrote:
Hi,
I would like to be able provide a handler and have the methods automatically looked up, just like the Invoker does, but export only a subset of the available methods, as defined by an interface (the case I'm running into this is when the handlers are avalon components - they implement various interfaces, but only one of them is what I'd like to export as rpc methods). One minimal change to accomplish this would be to add another constructor to org.apache.xmlrpc.Invoker which takes both the targetObject and the targetClass:
/** * Create a new Invoker instance which limits the methods that can be * invoked on the target. The invoker will only invoke methods on the * given target which are defined as public in the given interface class. * * @param target the object on which to invoke the methods * @param iface the exported methods that can be invoked */ public Invoker(Object target, Class iface) { if (!iface.isInstance(target)) throw new IllegalArgumentException("target " + target + " is not an instance of " + iface.getName()); invokeTarget = target; targetClass = iface; }
Does this sound like a reasonable enhancement?
Cheers,
Ronald