View Javadoc

1   /*
2    *  Copyright (c) 2008 Rodrigo Ruiz
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.message.addressing.handler;
17  
18  import org.apache.axis.AxisFault;
19  import org.apache.axis.Handler;
20  import org.apache.axis.MessageContext;
21  import org.apache.ws.addressing.handler.ClientSideAddressingHandler;
22  import org.w3c.dom.Document;
23  import org.w3c.dom.Element;
24  
25  import javax.xml.namespace.QName;
26  import java.util.Hashtable;
27  import java.util.List;
28  
29  /**
30   * Axis-specific client-side WS-Addressing handler.
31   *
32   * @author Davanum Srinivas
33   * @author Ian P. Springer
34   * @version $Revision: 14 $
35   */
36  public class AxisClientSideAddressingHandler extends ClientSideAddressingHandler
37    implements Handler {
38  
39    /**
40     * <code>serialVersionUID</code> attribute.
41     */
42    private static final long serialVersionUID = 340258144585488893L;
43    /**
44     * Wrapped handler.
45     */
46    private GenericAxisHandler axisHelperHandler = new GenericAxisHandler(this);
47  
48    /**
49     * @see org.apache.axis.Handler#init()
50     */
51    public void init() {
52      axisHelperHandler.init();
53    }
54  
55    /**
56     * @see org.apache.axis.Handler#cleanup()
57     */
58    public void cleanup() {
59      axisHelperHandler.cleanup();
60    }
61  
62    /**
63     * {@inheritDoc}
64     */
65    public boolean canHandleBlock(QName qname) {
66      return (axisHelperHandler.canHandleBlock(qname));
67    }
68  
69    /**
70     * {@inheritDoc}
71     */
72    public void setOption(String name, Object value) {
73      axisHelperHandler.setOption(name, value);
74    }
75  
76    /**
77     * Set a default value for the given option: if the option is not already set,
78     * then set it. if the option is already set, then do not set it.
79     * <p>
80     * If this is called multiple times, the first with a non-null value if 'value'
81     * will set the default, remaining calls will be ignored.
82     *
83     * @param name Option name
84     * @param value Option default value
85     * @return true if value set (by this call), otherwise false
86     */
87    public boolean setOptionDefault(String name, Object value) {
88      return axisHelperHandler.setOptionDefault(name, value);
89    }
90  
91    /**
92     * {@inheritDoc}
93     */
94    public Object getOption(String name) {
95      return axisHelperHandler.getOption(name);
96    }
97  
98    /**
99     * {@inheritDoc}
100    */
101   public Hashtable<?, ?> getOptions() {
102     return axisHelperHandler.getOptions();
103   }
104 
105   /**
106    * {@inheritDoc}
107    */
108   public void setOptions(Hashtable opts) {
109     axisHelperHandler.setOptions(opts);
110   }
111 
112   /**
113    * {@inheritDoc}
114    */
115   public void setName(String name) {
116     axisHelperHandler.setName(name);
117   }
118 
119   /**
120    * {@inheritDoc}
121    */
122   public String getName() {
123     return axisHelperHandler.getName();
124   }
125 
126   /**
127    * {@inheritDoc}
128    */
129   public Element getDeploymentData(Document doc) {
130     return axisHelperHandler.getDeploymentData(doc);
131   }
132 
133   /**
134    * {@inheritDoc}
135    */
136   public List<?> getUnderstoodHeaders() {
137     return axisHelperHandler.getUnderstoodHeaders();
138   }
139 
140   /**
141    * {@inheritDoc}
142    */
143   public void generateWSDL(MessageContext msgContext) throws AxisFault {
144     axisHelperHandler.generateWSDL(msgContext);
145   }
146 
147   /**
148    * {@inheritDoc}
149    */
150   public void invoke(MessageContext msgContext) throws AxisFault {
151     axisHelperHandler.invoke(msgContext);
152   }
153 
154   /**
155    * {@inheritDoc}
156    */
157   public void onFault(MessageContext msgContext) {
158     axisHelperHandler.onFault(msgContext);
159   }
160 
161   /**
162    * {@inheritDoc}
163    */
164   @Override
165   protected String generateUUId() {
166     return axisHelperHandler.generateUUId();
167   }
168 
169   /**
170    * {@inheritDoc}
171    */
172   @Override
173   protected String getSOAPAction(javax.xml.rpc.handler.MessageContext jaxRpcMsgContext) {
174     MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
175     return msgContext.getSOAPActionURI();
176   }
177 
178   /**
179    * {@inheritDoc}
180    */
181   @Override
182   protected void setSOAPAction(javax.xml.rpc.handler.MessageContext jaxRpcMsgContext,
183       String actionURI) {
184     MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
185     msgContext.setUseSOAPAction(true);
186     msgContext.setSOAPActionURI(actionURI);
187   }
188 
189   /**
190    * {@inheritDoc}
191    */
192   @Override
193   protected String getEndpointURL(javax.xml.rpc.handler.MessageContext jaxRpcMsgContext) {
194     return (String) jaxRpcMsgContext
195     .getProperty(org.apache.axis.MessageContext.TRANS_URL);
196   }
197 
198 }