org.apache.xmlrpc.server

Class AbstractReflectiveHandlerMapping

Implemented Interfaces:
XmlRpcHandlerMapping, XmlRpcListableHandlerMapping
Known Direct Subclasses:
PropertyHandlerMapping

public abstract class AbstractReflectiveHandlerMapping
extends java.lang.Object
implements XmlRpcListableHandlerMapping

Abstract base class of handler mappings, which are using reflection.

Nested Class Summary

static interface
AbstractReflectiveHandlerMapping.AuthenticationHandler
An object implementing this interface may be used to validate user names and passwords.

Field Summary

protected Map
handlerMap

Method Summary

AbstractReflectiveHandlerMapping.AuthenticationHandler
getAuthenticationHandler()
Returns the authentication handler, if any, or null.
XmlRpcHandler
getHandler(String pHandlerName)
Returns the XmlRpcHandler with the given name.
String[]
getListMethods()
protected String
getMethodHelp(Class pClass, Method[] pMethods)
Creates a help string for the given method, when applied to the given class.
String
getMethodHelp(String pHandlerName)
String[][]
getMethodSignature(String pHandlerName)
RequestProcessorFactoryFactory
getRequestProcessorFactoryFactory()
Returns the mappings RequestProcessorFactoryFactory.
protected String[][]
getSignature(Method[] pMethods)
Creates a signature for the given method.
TypeConverterFactory
getTypeConverterFactory()
Returns the mappings TypeConverterFactory.
protected boolean
isHandlerMethod(Method pMethod)
boolean
isVoidMethodEnabled()
Returns, whether void methods are enabled.
protected XmlRpcHandler
newXmlRpcHandler(Class pClass, Method[] pMethods)
Creates a new instance of XmlRpcHandler.
protected void
registerPublicMethods(String pKey, Class pType)
Searches for methods in the given class.
void
setAuthenticationHandler(AbstractReflectiveHandlerMapping.AuthenticationHandler pAuthenticationHandler)
Sets the authentication handler, if any, or null.
void
setRequestProcessorFactoryFactory(RequestProcessorFactoryFactory pFactory)
Sets the mappings RequestProcessorFactoryFactory.
void
setTypeConverterFactory(TypeConverterFactory pFactory)
Sets the mappings TypeConverterFactory.
void
setVoidMethodEnabled(boolean pVoidMethodEnabled)
Sets, whether void methods are enabled.

Field Details

handlerMap

protected Map handlerMap

Method Details

getAuthenticationHandler

public AbstractReflectiveHandlerMapping.AuthenticationHandler getAuthenticationHandler()
Returns the authentication handler, if any, or null.

getHandler

public XmlRpcHandler getHandler(String pHandlerName)
            throws XmlRpcNoSuchHandlerException,
                   XmlRpcException
Returns the XmlRpcHandler with the given name.
Specified by:
getHandler in interface XmlRpcHandlerMapping
Parameters:
pHandlerName - The handlers name
Throws:
XmlRpcNoSuchHandlerException - A handler with the given name is unknown.

getListMethods

public String[] getListMethods()
            throws XmlRpcException
Specified by:
getListMethods in interface XmlRpcListableHandlerMapping

getMethodHelp

protected String getMethodHelp(Class pClass,
                               Method[] pMethods)
Creates a help string for the given method, when applied to the given class.

getMethodHelp

public String getMethodHelp(String pHandlerName)
            throws XmlRpcException
Specified by:
getMethodHelp in interface XmlRpcListableHandlerMapping

getMethodSignature

public String[][] getMethodSignature(String pHandlerName)
            throws XmlRpcException
Specified by:
getMethodSignature in interface XmlRpcListableHandlerMapping

getRequestProcessorFactoryFactory

public RequestProcessorFactoryFactory getRequestProcessorFactoryFactory()
Returns the mappings RequestProcessorFactoryFactory.

getSignature

protected String[][] getSignature(Method[] pMethods)
Creates a signature for the given method.

getTypeConverterFactory

public TypeConverterFactory getTypeConverterFactory()
Returns the mappings TypeConverterFactory.

isHandlerMethod

protected boolean isHandlerMethod(Method pMethod)

isVoidMethodEnabled

public boolean isVoidMethodEnabled()
Returns, whether void methods are enabled. By default, null values aren't supported by XML-RPC and void methods are in fact returning null (at least from the perspective of reflection).

newXmlRpcHandler

protected XmlRpcHandler newXmlRpcHandler(Class pClass,
                                         Method[] pMethods)
            throws XmlRpcException
Creates a new instance of XmlRpcHandler.
Parameters:
pClass - The class, which was inspected for handler methods. This is used for error messages only. Typically, it is the same than
pInstance.getClass()
.
pMethods - The method being invoked.

registerPublicMethods

protected void registerPublicMethods(String pKey,
                                     Class pType)
            throws XmlRpcException
Searches for methods in the given class. For any valid method, it creates an instance of XmlRpcHandler. Valid methods are defined as follows:
  • They must be public.
  • They must not be static.
  • The return type must not be void.
  • The declaring class must not be java.lang.Object.
  • If multiple methods with the same name exist, which meet the above conditins, then only the first method is valid.
Parameters:
pKey - Suffix for building handler names. A dot and the method name are being added.
pType - The class being inspected.

setAuthenticationHandler

public void setAuthenticationHandler(AbstractReflectiveHandlerMapping.AuthenticationHandler pAuthenticationHandler)
Sets the authentication handler, if any, or null.

setRequestProcessorFactoryFactory

public void setRequestProcessorFactoryFactory(RequestProcessorFactoryFactory pFactory)
Sets the mappings RequestProcessorFactoryFactory. Note, that this doesn't affect already registered handlers.

setTypeConverterFactory

public void setTypeConverterFactory(TypeConverterFactory pFactory)
Sets the mappings TypeConverterFactory.

setVoidMethodEnabled

public void setVoidMethodEnabled(boolean pVoidMethodEnabled)
Sets, whether void methods are enabled. By default, null values aren't supported by XML-RPC and void methods are in fact returning null (at least from the perspective of reflection).

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.