org.apache.xmlrpc.server
Class PropertyHandlerMapping

java.lang.Object
  extended by org.apache.xmlrpc.server.PropertyHandlerMapping
All Implemented Interfaces:
XmlRpcHandlerMapping

public class PropertyHandlerMapping
extends java.lang.Object
implements XmlRpcHandlerMapping

A handler mapping based on a property file. The property file contains a set of properties. The property key is taken as the handler name. The property value is taken as the name of a class being instantiated. For any non-void, non-static, and public method in the class, an entry in the handler map is generated.
The following constrains apply to the classes:

  1. The classes must be stateless. In other words, any instance of the class must be completely thread safe.
A typical use would be, to specify interface names as the property keys and implementations as the values.


Constructor Summary
PropertyHandlerMapping(java.lang.ClassLoader pClassLoader, java.io.File pFile)
          Creates a new instance, loading the given property file.
PropertyHandlerMapping(java.lang.ClassLoader pClassLoader, java.lang.String pResource)
          Creates a new instance, loading the properties from the given resource.
PropertyHandlerMapping(java.lang.ClassLoader pClassLoader, java.net.URL pURL)
          Creates a new instance, loading the property file from the given URL.
 
Method Summary
 XmlRpcHandler getHandler(java.lang.String handlerName)
          Return the handler for the specified handler name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHandlerMapping

public PropertyHandlerMapping(java.lang.ClassLoader pClassLoader,
                              java.net.URL pURL)
                       throws java.io.IOException,
                              XmlRpcException
Creates a new instance, loading the property file from the given URL.

Parameters:
pClassLoader - Classloader being used to load the classes.
pURL - The URL, from which the property file is being loaded.
Throws:
java.io.IOException - Loading the property file failed.
XmlRpcException - Initializing the handlers failed.

PropertyHandlerMapping

public PropertyHandlerMapping(java.lang.ClassLoader pClassLoader,
                              java.io.File pFile)
                       throws java.io.IOException,
                              XmlRpcException
Creates a new instance, loading the given property file.

Parameters:
pClassLoader - Classloader being used to load the classes.
pFile - File being loaded.
Throws:
java.io.IOException - Loading the property file failed.
XmlRpcException - Initializing the handlers failed.

PropertyHandlerMapping

public PropertyHandlerMapping(java.lang.ClassLoader pClassLoader,
                              java.lang.String pResource)
                       throws java.io.IOException,
                              XmlRpcException
Creates a new instance, loading the properties from the given resource.

Parameters:
pClassLoader - Classloader being used to locate the resource.
pResource - Resource being loaded.
Throws:
java.io.IOException - Loading the property file failed.
XmlRpcException - Initializing the handlers failed.
Method Detail

getHandler

public XmlRpcHandler getHandler(java.lang.String handlerName)
                         throws XmlRpcNoSuchHandlerException,
                                XmlRpcException
Description copied from interface: XmlRpcHandlerMapping
Return the handler for the specified handler name.

Specified by:
getHandler in interface XmlRpcHandlerMapping
Parameters:
handlerName - The name of the handler to retrieve.
Returns:
Object The desired handler. Never null, an exception is thrown if no such handler is available.
Throws:
XmlRpcNoSuchHandlerException - The handler is not available.
XmlRpcException - An internal error occurred.


Copyright 2001-2001-2006 Apache Software Foundation. All Rights Reserved.