marquee.xmlrpc
Interface XmlRpcInvocationProcessor

All Known Implementing Classes:
DebugInvocationProcessor, FilterInvocationProcessor, SessionInvocationProcessor

public interface XmlRpcInvocationProcessor

Invocation processors are called by XmlRpcServers before and after a call is dispathed to its invocation handler. Processors are called for all inbound messages regardless of destination. They server as appropriate entry points where logging and other type of processing may be inserted. For instance, a transaction processor may examine the name of the emthod being called, and if it starts with "tx_" it may add an additional transaction argument to the list of arguments received by the method. After the call is dispatched, the transaction may be commited or rolled back, in case of an error.

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

Method Summary
 void onException(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments, java.lang.Throwable exception)
          Called by an XmlRpcServer when the supplied method throws an exception.
 java.lang.Object postProcess(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments, java.lang.Object returnValue)
          Called by an XmlRpcServer after the supplied method has been called.
 boolean preProcess(int callId, java.lang.String callerIp, java.lang.String handler, java.lang.String method, java.util.List arguments)
          Called by an XmlRpcServer before the method with the supplied name is called.
 

Method Detail

preProcess

public boolean preProcess(int callId,
                          java.lang.String callerIp,
                          java.lang.String handler,
                          java.lang.String method,
                          java.util.List arguments)
Called by an XmlRpcServer before the method with the supplied name is called. The arguments vector may be altered if necessary. The method must have matching parameters, however.

If, for some reason, the processor wishes to cancel the invocation altogether, it returns false from this method. This may be the case for filtering processors where certain IP-addresses are restricted from particular methods, or if the arguments contain some encrypted password and username that does not authorize.

Parameters:
callId - A sequence number for tracing calls between preProcess() and postProcess() calls. This is unique within each session. That is, the sequence is restarted when the application restarts.
handler - The name of the handler being called.
method - The name of the method being called.
arguments - The arguments that will be sent to the method.
Returns:
true if the invocation should proceed, or false if not.

postProcess

public java.lang.Object postProcess(int callId,
                                    java.lang.String callerIp,
                                    java.lang.String handler,
                                    java.lang.String method,
                                    java.util.List arguments,
                                    java.lang.Object returnValue)
Called by an XmlRpcServer after the supplied method has been called. The processor may alter the return value, if it wants, before the response is created. This may be useful if the information therein should be encrypted or compressed, for instance.

Parameters:
callId - A sequence number for tracing calls between preProcess() and postProcess() calls. This is unique within each session. That is, the sequence is restarted when the application restarts.
handler - The name of the handler being called.
method - The name of the method that just has returned.
returnValue - The objects returned by the method. If the method returned a primitive, it is wrapped in its object counterpart.
Returns:
The (possibly modified) returnValue argument.

onException

public void onException(int callId,
                        java.lang.String callerIp,
                        java.lang.String handler,
                        java.lang.String method,
                        java.util.List arguments,
                        java.lang.Throwable exception)
Called by an XmlRpcServer when the supplied method throws an exception.

Parameters:
callId - A sequence number for tracing calls between preProcess() and postProcess() calls. This is unique within each session. That is, the sequence is restarted when the application restarts.
handler - The name of the handler being called.
method - The name of the method that just has returned by throwing an exception.
exception - The exception thrown by the method.