KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > engine > SpeakingHandler1


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  
17 package org.apache.axis2.engine;
18
19 import org.apache.axis2.context.MessageContext;
20 import org.apache.axis2.description.HandlerDescription;
21 import org.apache.axis2.description.PhaseRule;
22 import org.apache.axis2.handlers.AbstractHandler;
23 import org.apache.axis2.phaseresolver.PhaseMetadata;
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 import javax.xml.namespace.QName JavaDoc;
28
29 public class SpeakingHandler1 extends AbstractHandler implements Handler {
30     private Log log = LogFactory.getLog(getClass());
31     private String JavaDoc message;
32     private QName JavaDoc name;
33
34     public SpeakingHandler1(String JavaDoc message) {
35         this.message = message;
36         HandlerDescription handlerDesc = new HandlerDescription();
37         PhaseRule rule = new PhaseRule();
38         rule.setPhaseName(PhaseMetadata.PHASE_POLICY_DETERMINATION);
39         handlerDesc.setRules(rule);
40         handlerDesc.setHandler(this);
41         init(handlerDesc);
42     }
43
44     public QName JavaDoc getName() {
45         return name;
46     }
47
48     public void invoke(MessageContext msgContext) throws AxisFault {
49         log.info("I am " + message + " Handler Running :)");
50     }
51
52     public void revoke(MessageContext msgContext) {
53         log.info("I am " + message + " Handler Running :)");
54     }
55
56     public void setName(QName JavaDoc name) {
57         this.name = name;
58     }
59     
60     public HandlerDescription getHandlerDescription(){
61         return handlerDesc;
62     }
63
64 }
65
Popular Tags