1 package org.codehaus.xfire.handler; 2 3 import javax.xml.namespace.QName; 4 5 import org.codehaus.xfire.MessageContext; 6 import org.codehaus.xfire.fault.XFireFault; 7 8 /*** 9 * <p> 10 * A handler is just something that processes an XML message. 11 * </p> 12 * <p> 13 * If an exception occurrs in the invoke method, the entity which 14 * started the invocation, is responsible for turning the exception 15 * into a fault. 16 * </p> 17 * 18 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse </a> 19 * @since Feb 18, 2004 20 */ 21 public interface Handler 22 { 23 String ROLE = Handler.class.getName(); 24 25 /*** 26 * @return null or an empty array if there are no headers. 27 */ 28 QName[] getUnderstoodHeaders(); 29 30 /*** 31 * The roles which this service applies to. 32 * 33 * @return <code>null</code> or an empty if this endpoint handles no 34 * roles. 35 */ 36 String[] getRoles(); 37 38 /*** 39 * Invoke a handler. If a fault occurs it will be handled via the 40 * <code>handleFault</code> method. 41 * 42 * @param message 43 * The message context. 44 */ 45 void invoke(MessageContext context) 46 throws Exception; 47 48 /*** 49 * Handles faults that occur in this handler. This is not responsible for 50 * actually writing the fault response message. 51 * 52 * @param context 53 */ 54 void handleFault(XFireFault fault, MessageContext context); 55 }