KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > handlers > AbstractHandler


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.handlers;
17
18 import org.apache.axis2.context.MessageContext;
19 import org.apache.axis2.description.HandlerDescription;
20 import org.apache.axis2.description.Parameter;
21 import org.apache.axis2.engine.AxisFault;
22 import org.apache.axis2.engine.Handler;
23
24 import javax.xml.namespace.QName JavaDoc;
25
26 /**
27  * Class AbstractHandler
28  */

29 public abstract class AbstractHandler implements Handler {
30
31     /**
32      * Field EMPTY_HANDLER_METADATA
33      */

34     private static HandlerDescription EMPTY_HANDLER_METADATA =
35             new HandlerDescription(new QName JavaDoc("deafult Handler"));
36
37     /**
38      * Field handlerDesc
39      */

40     protected HandlerDescription handlerDesc;
41
42     /**
43      * Constructor AbstractHandler
44      */

45     public AbstractHandler() {
46         handlerDesc = EMPTY_HANDLER_METADATA;
47     }
48
49     /**
50      * Method getName
51      *
52      * @return
53      */

54     public QName JavaDoc getName() {
55         return handlerDesc.getName();
56     }
57
58     /**
59      * Method revoke
60      *
61      * @param msgContext
62      */

63     public void revoke(MessageContext msgContext) {
64     }
65
66     /**
67      * Method cleanup
68      *
69      * @throws AxisFault
70      */

71     public void cleanup() throws AxisFault {
72     }
73
74     /**
75      * Method getParameter
76      *
77      * @param name
78      * @return
79      */

80     public Parameter getParameter(String JavaDoc name) {
81         return handlerDesc.getParameter(name);
82     }
83
84     /**
85      * Method init
86      *
87      * @param handlerdesc
88      */

89     public void init(HandlerDescription handlerdesc) {
90         this.handlerDesc = handlerdesc;
91     }
92
93     /**
94      * To get the phaseRule of a handler it is required to get the HnadlerDescription of the handler
95      * so the argumnet pass when it call return as HnadlerDescription
96      *
97      * @return
98      */

99     public HandlerDescription getHandlerDesc() {
100         return handlerDesc;
101     }
102     /* (non-Javadoc)
103      * @see java.lang.Object#toString()
104      */

105     public String JavaDoc toString() {
106         QName JavaDoc name = this.getName();
107         return (name!=null)?name.toString():null;
108     }
109
110 }
111
Popular Tags