This class generates clients for Apache XML-RPC.
The basic idea goes as follows:
- Provide a class implementing the interface
XmlRpcCaller
. - Provide a server side class being called via XML-RPC. The class
must have a public default constructor, should be stateless, and
all callable methods must be public instance methods.
- Run the generator, specifying a target package.
On the client, use the generated class, as if it were the server
side class.
addClass
public JavaSource addClass(JavaSource pSource,
JavaSourceResolver pResolver)
throws SecurityException,
NoSuchMethodException
Creates a new client class, which is invoking the given
server side class pSource
.
addMethod
protected String addMethod(JavaMethod pMethod)
Generates a name for the method pMethod
and
adds it to the method map, the name being the key.
getDispatcher
public JavaSource getDispatcher(JavaQName pQName)
pQName
- Fully qualified class name of the dispatcher class.
getDispatcherInvokeMethod
protected JavaMethod getDispatcherInvokeMethod(JavaSource pSource,
JavaQName pInvoker)
Creates the dispatchers invoke
method.
getFactory
public JavaSourceFactory getFactory()
Returns the factory, that was submitted to the constructor.
getInputValue
protected Object getInputValue(JavaMethod pMethod,
JavaQName pType,
Object pValue)
Converts the given input pValue
with type
pType
into a valid XML-RPC type.
getInvokerClass
public JavaSource getInvokerClass(JavaSource pSource)
Generates the abstract invoker class.
getInvokerMap
protected JavaField getInvokerMap(JavaSource pSource)
Creates the field with the Map
of invokers.
getMethod
protected JavaMethod getMethod(JavaSource pJs,
JavaField pCaller,
String pName,
JavaMethod pMethod)
throws SecurityException,
NoSuchMethodException
Generates a method, invoking method pMethod
using
the name pName
.
getResultValue
protected Object getResultValue(JavaMethod pMethod,
JavaQName pType,
Object pValue)
Converts the result value pValue
into the
requested type pType
.
getTargetPackage
public String getTargetPackage()
Returns the target package, that was submitted to the constructor.
isDispatcherImplementsXmlRpcHandler
public boolean isDispatcherImplementsXmlRpcHandler()
Returns whether the generated dispatcher implements
XmlRpcHandler. The default value is true.
isMethodGenerated
protected boolean isMethodGenerated(JavaMethod pMethod)
Returns, whether a remote method call is generated for method
pMethod
. The default implementation returns true,
if the method is public and not static.
setDispatcherImplementsXmlRpcHandler
public void setDispatcherImplementsXmlRpcHandler(boolean pDispatcherImplementsXmlRpcHandler)
Sets whether the generated dispatcher implements
XmlRpcHandler. The default value is true.