KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > handlers > JAXRPCHandler


1 /*
2  * Copyright 2001-2004 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.axis.handlers;
17
18 import org.apache.axis.AxisFault;
19 import org.apache.axis.MessageContext;
20 import org.apache.axis.components.logger.LogFactory;
21 import org.apache.commons.logging.Log;
22
23 import java.util.Map JavaDoc;
24
25 /**
26  * Handles JAXRPC style handlers.
27  *
28  * @author Davanum Srinivas (dims@yahoo.com)
29  */

30 public class JAXRPCHandler extends BasicHandler {
31     protected static Log log =
32             LogFactory.getLog(JAXRPCHandler.class.getName());
33
34     protected HandlerChainImpl impl = new HandlerChainImpl();
35
36     public void init() {
37         super.init();
38         String JavaDoc className = (String JavaDoc)getOption("className");
39         if (className != null) {
40             addNewHandler(className, getOptions());
41         }
42     }
43
44     public void addNewHandler(String JavaDoc className, Map JavaDoc options) {
45         impl.addNewHandler(className, options);
46     }
47
48     public void invoke(MessageContext msgContext) throws AxisFault {
49         log.debug("Enter: JAXRPCHandler::enter invoke");
50         if (!msgContext.getPastPivot()) {
51             impl.handleRequest(msgContext);
52         } else {
53             impl.handleResponse(msgContext);
54         }
55         log.debug("Enter: JAXRPCHandler::exit invoke");
56     }
57
58     public void onFault(MessageContext msgContext) {
59         impl.handleFault(msgContext);
60     }
61
62     public void cleanup() {
63         impl.destroy();
64     }
65 }
66
Popular Tags