KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > ime > internal > util > handler > MessageExchangeHandler


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.ime.internal.util.handler;
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.axis.handlers.BasicHandler;
22 import org.apache.axis.ime.MessageExchange;
23 import org.apache.commons.logging.Log;
24
25 /**
26  * This could probably be a bit more sophisticated,
27  * but it works for now
28  *
29  * @author James M Snell (jasnell@us.ibm.com)
30  */

31 public class MessageExchangeHandler
32     extends BasicHandler {
33     
34     protected static Log log =
35         LogFactory.getLog(MessageExchangeHandler.class.getName());
36     
37     private MessageExchange messageExchange;
38     
39     public MessageExchangeHandler() {}
40     
41     public MessageExchangeHandler(MessageExchange exchange) {
42         this.messageExchange = exchange;
43     }
44     
45     public void invoke(
46             MessageContext msgContext)
47             throws AxisFault {
48         if (log.isDebugEnabled()) {
49             log.debug("Enter: MessageExchangeHandler::invoke");
50         }
51         msgContext = messageExchange.sendAndReceive(msgContext);
52         if (log.isDebugEnabled()) {
53             log.debug("Exit: MessageExchangeHandler::invoke");
54         }
55     }
56     
57     public MessageExchange getMessageExchange() {
58         return this.messageExchange;
59     }
60     
61     public void setMessageExchange(MessageExchange exchange) {
62         this.messageExchange = exchange;
63     }
64 }
65
Popular Tags