marquee.xmlrpc
Class XmlRpcDispatcher

java.lang.Object
  extended bymarquee.xmlrpc.XmlRpcParser
      extended bymarquee.xmlrpc.XmlRpcDispatcher
All Implemented Interfaces:
org.xml.sax.DocumentHandler

public class XmlRpcDispatcher
extends XmlRpcParser

Objects of the XmlRpcDispather class performs the actual parsing of inbound XML-RPC messages received by an XmlRpcServer and are responsible for invoking handlers and dealing with their return values and exceptions.

Since:
JDK 1.1
Version:
$Revision: 1.13 $
Author:
Greger Ohlson (greger.ohlson@marquee.se)

Field Summary
 
Fields inherited from class marquee.xmlrpc.XmlRpcParser
ARRAY, BASE64, BOOLEAN, DATE, DOUBLE, I4, INT, MEMBER, NAME, STRING, STRUCT, VALUE
 
Constructor Summary
XmlRpcDispatcher()
           
 
Method Summary
 byte[] dispatch(java.io.InputStream xmlInput)
          Inbound XML-RPC messages to a server are delegated to this method.
 void endElement(java.lang.String name)
          Override the endElement() method of the XmlRpcParser class, and catch the method name element.
static XmlRpcDispatcher getDispatcher(XmlRpcServer server, java.lang.String callerIp)
          Aquires a dispatcher from the pool of available dispatchers, or creates a new dispatcher if the pool is empty.
 void release()
          Returns the dispatcher back into the dispatcher pool for use in future invocations.
 
Methods inherited from class marquee.xmlrpc.XmlRpcParser
characters, endDocument, ignorableWhitespace, parse, processingInstruction, setDocumentLocator, setDriver, setDriver, startDocument, startElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcDispatcher

public XmlRpcDispatcher()
Method Detail

getDispatcher

public static XmlRpcDispatcher getDispatcher(XmlRpcServer server,
                                             java.lang.String callerIp)
Aquires a dispatcher from the pool of available dispatchers, or creates a new dispatcher if the pool is empty. Dispatchers are used both from XmlRpcConnections when running as a service, and in servlet environments.

Parameters:
server - The server object the dispatcher shall use. This object contains the registered invocation handlers and invocation processors needed by a dispatcher.
callerIp - This is supplied for informational purposes and is made available to custom processors. TODO: The processor objects should have the possibility to abort an invocation based on this information. The XmlRpcProcessor interface should be able to throw exceptions in preProcess.
Returns:
An XmlRpcDispatcher that can be used to dispatch a call.

release

public void release()
Returns the dispatcher back into the dispatcher pool for use in future invocations.


dispatch

public byte[] dispatch(java.io.InputStream xmlInput)
                throws java.lang.Throwable
Inbound XML-RPC messages to a server are delegated to this method. It performs the parsing of the message, through the inherited parse() method, and locates and invokes the appropriate invocation handlers.

Parameters:
xmlInput -
Returns:
Throws:
java.lang.Throwable

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Override the endElement() method of the XmlRpcParser class, and catch the method name element. The method name element is unique for XML-RPC calls, and belongs here in the server.

Specified by:
endElement in interface org.xml.sax.DocumentHandler
Overrides:
endElement in class XmlRpcParser
Throws:
org.xml.sax.SAXException