1 /* 2 * Copyright 2004,2005 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.axis2.engine; 17 18 import org.apache.axis2.context.MessageContext; 19 import org.apache.axis2.description.HandlerDescription; 20 import org.apache.axis2.description.Parameter; 21 22 import javax.xml.namespace.QName; 23 import java.io.Serializable; 24 25 /** 26 * Interface Handler 27 */ 28 public interface Handler extends Serializable { 29 /** 30 * Method init 31 * 32 * @param handlerdesc 33 */ 34 public void init(HandlerDescription handlerdesc); 35 36 /** 37 * Invoke is called to do the actual work of the Handler object. 38 * If there is a fault during the processing of this method it is 39 * invoke's job to catch the exception and undo any partial work 40 * that has been completed. Once we leave 'invoke' if a fault 41 * is thrown, this classes 'onFault' method will be called. 42 * Invoke should rethrow any exceptions it catches, wrapped in 43 * an AxisFault. 44 * 45 * @param msgContext the <code>MessageContext</code> to process with this 46 * <code>Handler</code>. 47 * @throws AxisFault if the handler encounters an error 48 */ 49 public void invoke(MessageContext msgContext) throws AxisFault; 50 51 52 /** 53 * Method getName 54 * 55 * @return 56 */ 57 public QName getName(); 58 59 /** 60 * Method getParameter 61 * 62 * @param name 63 * @return 64 */ 65 public Parameter getParameter(String name); 66 67 /** 68 * Method cleanup 69 * 70 * @throws AxisFault 71 */ 72 public void cleanup() throws AxisFault; 73 74 /** 75 * To get the phaseRule of a handler it is required to get the HnadlerDescription of the handler 76 * so the argumnet pass when it call return as HnadlerDescription 77 * 78 * @return 79 */ 80 public HandlerDescription getHandlerDesc(); 81 } 82